Skip to content

Commit fd04b7e

Browse files
committed
chore: handle possible edge case
1 parent 37ff62c commit fd04b7e

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

packages/uipath/src/uipath/_cli/_chat/_bridge.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,13 @@ def _resolve_or_store_resume(
498498
if not future.done():
499499
future.set_result(item)
500500
else:
501+
# Future was cancelled or already resolved — store the payload
502+
# so a subsequent wait_for_resume() can still find it.
501503
logger.warning(
502-
f"Duplicate resume for tool_call_id={tool_call_id} — "
503-
"future already resolved, ignoring."
504+
f"Resume for tool_call_id={tool_call_id} — "
505+
"future already done, storing as fallback."
504506
)
507+
self._tool_resume_results[tool_call_id] = item
505508
else:
506509
if tool_call_id in self._tool_resume_results:
507510
logger.warning(

packages/uipath/tests/cli/chat/test_bridge.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,9 @@ def _make_end_event(self, tool_call_id: str, output: Any = None) -> dict[str, An
683683
"toolCall": {
684684
"toolCallId": tool_call_id,
685685
"endToolCall": {
686-
"output": output or {"result": "ok"},
686+
"output": output
687+
if output is not None
688+
else {"result": "ok"},
687689
"isError": False,
688690
},
689691
},
@@ -915,7 +917,9 @@ def _make_end_event(self, tool_call_id: str, output: Any = None) -> dict[str, An
915917
"toolCall": {
916918
"toolCallId": tool_call_id,
917919
"endToolCall": {
918-
"output": output or {"result": "ok"},
920+
"output": output
921+
if output is not None
922+
else {"result": "ok"},
919923
"isError": False,
920924
},
921925
},

0 commit comments

Comments
 (0)