The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): render skip wording verbatim instead of brace-escaping it
kshitijk4poor17da1d75b7bf
diff --git a/agent/interrupt_control.py b/agent/interrupt_control.pyindex 7918a3cea09..ea0b10556e8 100644--- a/agent/interrupt_control.py+++ b/agent/interrupt_control.py@@ -46,16 +46,13 @@ def interrupt_skip_wording(agent) -> str:"""Reason a tool call was skipped/cancelled, in words safe for tool output.Derived from the RECORDED reason rather than the call site, so a system-initiated- abort reads as one instead of asserting a user message that never existed (#130207).- Braces are escaped: the wording is interpolated into notice templates, and a caller-- supplied reason must never become a format field."""+ abort reads as one instead of asserting a user message that never existed (#130207)."""reason = getattr(agent, "_tool_interrupt_reason", None)if not reason:return "Turn interrupted"- if reason in USER_INTERRUPT_REASONS:- return _USER_STOP_WORDING.get(reason, str(reason))- wording = f"Turn aborted — {str(reason).replace('_', ' ')}"- return wording.replace("{", "{{").replace("}", "}}")+ if reason in _USER_STOP_WORDING:+ return _USER_STOP_WORDING[reason]+ return f"Turn aborted — {str(reason).replace('_', ' ')}"def interrupted_during_api_call_reason(agent) -> str:diff --git a/tests/agent/test_interrupt_issuer_attribution.py b/tests/agent/test_interrupt_issuer_attribution.pyindex 1db2b27eb9f..bb40f7afff8 100644--- a/tests/agent/test_interrupt_issuer_attribution.py+++ b/tests/agent/test_interrupt_issuer_attribution.py@@ -10,7 +10,7 @@ import loggingimport threadingfrom agent.interrupt_compat import request_hard_interrupt-from agent.interrupt_control import interrupt_issuer+from agent.interrupt_control import interrupt_issuer, interrupt_skip_wordingfrom tools.interrupt import set_interrupt@@ -109,5 +109,8 @@ def test_soft_interrupt_with_tool_reason_is_attributed_to_the_system():assert interrupt_issuer(agent) == "terminal_batch_timeout"# No message: gateway/CLI re-queue ``_interrupt_message`` as the user's next turn.assert agent._interrupt_message is None+ # Rendered verbatim: consumers substitute ``{name}`` with str.replace, never str.format.+ agent._tool_interrupt_reason = "guard {x}"+ assert interrupt_skip_wording(agent) == "Turn aborted — guard {x}"finally:set_interrupt(False)