fix(engine,ui): strip pseudo tool-call text before it reaches the user #52
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_shrimp!52
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_strip_pseudo_tool_call_text"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements a three-layer defense against models that emit
[TOOL_CALL]{tool => ..., args => {}}[/TOOL_CALL]pseudo-syntax (e.g. minimax-m2.7 via OpenRouter) instead of using the provider tool-call protocol.Related Issue
Closes #24
Changes
tool_call_recovery.rs: Addedstrip_bracket_tool_calls(extracts[TOOL_CALL]...[/TOOL_CALL]blocks) andnormalize_arrow_syntax(converts{tool => "name", args => {...}}arrow syntax to canonical JSON). Includes 6 unit tests.tool_call_recovery_module.rs: Extendedlift_recovered_tool_callsto handle bracket syntax at the top of the function — promotes to a real tool call if the tool name is registered, otherwise sanitizes content before it reaches the user.session.rs: Addedtracing::warn!tostrip_fake_tool_call_envelopeswhen it fires (final-reply fallback, now observable). Added unit test for the bracket-only case.store.ts: AddedstripBracketToolCallshelper wired intoflushStreamBuffer(streaming defense) and theturn:endSSE handler (final display defense).Test Results
1664 tests passed. 9 pre-existing environment failures (no
/bin/sh,python3,bubblewrapin sandbox) — unrelated to these changes.[TOOL_CALL]{tool => ..., args => {}}[/TOOL_CALL]) leaks to the user #24[TOOL_CALL]{tool => ..., args => {}}[/TOOL_CALL]) leaks to the user #24