Skip to content

fix(agent): preserve tool arguments and recover malformed calls - #48

Merged
lynnlink merged 2 commits into
mainfrom
codex/fix-long-tool-arguments
Oct 9, 2026
Merged

lynnlink merged 2 commits into
mainfrom
codex/fix-long-tool-arguments

Conversation

@lynnlink

@lynnlink lynnlink commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Tool arguments longer than 1,200 characters were omitted during history replay. Malformed streamed arguments could also become empty executable defaults or abort the entire model round, losing valid sibling calls.

This change preserves complete arguments in both current-turn and session history. Each identifiable malformed call produces a failed tool result with its original argument text, allowing the agent to repair that call while valid siblings execute normally. Anthropic uses raw streaming events so SDK JSON parsing cannot discard later calls. Normal text replies, cancellation, permission handling, and internal-tool visibility retain their existing behavior.

The desktop CI exposed an existing order-dependent test leak: WordHostApp applies English to the shared translator, and two presentation suites also switch to English without restoring it. Their teardown now restores the test suite's Chinese baseline in finally, without changing production behavior.

Validation:

  • Agent and provider suites: 1,088 parameterized cases passed.
  • Related frontend reducer and history tests: 141 cases passed.
  • Real Anthropic SDK exercised with mocked HTTP streams, including malformed-first batches, long Unicode arguments, signed thinking, and usage accounting.
  • Reproduced all eight desktop CI failures locally by replaying the exact CI test-file order; the same order passes after the isolation fix: 2,573 passed and 6 skipped across 278 files.
  • Desktop lint, typecheck, naming, documentation links, locale parity, and comment-language checks passed.
  • Validate CI on the updated head: both desktop and backend jobs passed.

@lynnlink
lynnlink merged commit 8e53f47 into main Oct 9, 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.

2 participants