fix(agent): render skipped-call notices from the recorded reason

Both sequential skip sites hardcoded a user-initiated cause ("User sent a new
message" / "skipped due to user interrupt"), so any system abort that reached
them asserted an action the user never took.

Render the notice from the published reason instead: a system issuer describes
itself, and only the genuinely user-initiated reasons keep the user-facing
wording.

(cherry picked from commit 8efe429e2a485a183c7ad46522d9a5c99cef6a9c)
This commit is contained in:
alrcatraz
2026-10-04 20:36:25 +08:00
committed by kshitij
parent 1e26d03291
commit 3336c96b87

View File

@@ -31,6 +31,7 @@ from agent.display import (
_detect_tool_failure,
)
from agent.compression_marker import _COMPRESSION_MARKER_PREFIX
from agent.interrupt_control import interrupt_skip_wording
from agent.message_sanitization import coalesce_tool_call_id
from agent.inline_tool_executors import (
INLINE_TOOL_EXECUTORS,
@@ -1860,7 +1861,7 @@ def _execute_tool_calls_sequential(agent, assistant_message, messages: list, eff
if not _skip_remaining_sequential(
agent, messages, tool_calls[i - 1:], effective_task_id,
notice="tool call(s)",
content="[Tool execution cancelled — {name} was skipped due to user interrupt]",
content=f"[Tool execution cancelled — {{name}} was skipped. {interrupt_skip_wording(agent)}]",
hook_error_type="user_interrupt",
hook_id=lambda tc: getattr(tc, "id", "") or "",
flush_stage="cancelled tool result",
@@ -1893,7 +1894,7 @@ def _execute_tool_calls_sequential(agent, assistant_message, messages: list, eff
if not _skip_remaining_sequential(
agent, messages, tool_calls[i:], effective_task_id,
notice="remaining tool call(s)",
content="[Tool execution skipped — {name} was not started. User sent a new message]",
content=f"[Tool execution skipped — {{name}} was not started. {interrupt_skip_wording(agent)}]",
flush_stage="skipped tool result",
):
return