Skip to content

Commit b406012

Browse files
committed
docs(tools): explain best-effort suppression in batch salvage paths
1 parent 9948eb6 commit b406012

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cubepi/agent/tools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ async def _run(prep: _PreparedToolCall) -> _FinalizedOutcome:
679679
except asyncio.CancelledError:
680680
raise
681681
except Exception:
682+
# Salvage is best-effort by contract: a failure while emitting
683+
# already-completed results must never mask the CancelledError
684+
# being re-raised below (mirrors _complete_cancelled_tool_calls).
682685
pass
683686
raise
684687

@@ -743,6 +746,9 @@ async def _run(prep: _PreparedToolCall) -> _FinalizedOutcome:
743746
try:
744747
await _emit_tool_result_messages(finalized_list, emit_fn)
745748
except Exception:
749+
# Best-effort: sibling persistence must never swallow the
750+
# control exception — the suspend/abort machinery depends on
751+
# it propagating; unanswered ids are backfilled on resume.
746752
pass
747753
raise control_exc
748754

0 commit comments

Comments
 (0)