Skip to content

Sanitize malformed tool-call arguments before echoing history - #168

Merged
w4ffl35 merged 1 commit into
masterfrom
fix/pilot-sanitize-echoed-args
Oct 14, 2026
Merged

w4ffl35 merged 1 commit into
masterfrom
fix/pilot-sanitize-echoed-args

Conversation

@w4ffl35

@w4ffl35 w4ffl35 commented Oct 14, 2026

Copy link
Copy Markdown
Member

Root cause of the three provider-or-unclassified-error aborts in the #11 fixed-harness lineage (seed-202 epoch 1, wrong-key-path-2 epochs 1-2).

Mechanism, reproduced live against OpenRouter/Meta: when a tool call's arguments string is truncated (152-char cutoff mid-string observed twice) or empty (observed once), the harness echoes it verbatim in the next request's history and Meta 400s with 'arguments must be valid JSON', fail-closing the pilot. Control with '{}' succeeds (gen-1791947436).

Fix: toolCallMessage replaces unparseable arguments with '{}' for the wire request only. The journal keeps the raw response in llm_response_received, the run records the parse error, and the trajectory continues through the designed error-nudge/consecutive-error-stop path instead of crashing the pilot.

Tests: new synthetic case asserts the echoed wire arguments are '{}' (failed pre-fix with the malformed string echoed); full live-runner suite passes; tsc clean; check-standards 0 new; check-architecture 0 new.

A truncated or empty arguments string echoed back in conversation
history makes Meta 400 the next request ('arguments must be valid
JSON'), fail-closing the pilot. Replace unparseable arguments with {}
on the wire; the journal keeps the raw response and the run continues
through the designed error-nudge path.
@w4ffl35
w4ffl35 force-pushed the fix/pilot-sanitize-echoed-args branch from 671e6ec to b3bf49f Compare October 14, 2026 03:18
@w4ffl35
w4ffl35 merged commit c5e7b1b into master Oct 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant