Skip to content

fix(claude): reconcile compacted tool results#2663

Open
ryanngit wants to merge 1 commit into
decolua:masterfrom
ryanngit:claude-tool-result-pairing
Open

fix(claude): reconcile compacted tool results#2663
ryanngit wants to merge 1 commit into
decolua:masterfrom
ryanngit:claude-tool-result-pairing

Conversation

@ryanngit

Copy link
Copy Markdown
Contributor

Fixes Anthropic /v1/messages 400 responses when compacted or cross-model history retains a tool result whose matching tool use is missing or no longer immediately previous.

  • Keeps valid structured tool results in tool-use order
  • Fills missing parallel results with the existing empty-result fallback
  • Preserves orphaned and duplicate output as labeled user text
  • Handles single-message orphan history

Tested:

  • ./node_modules/.bin/vitest run --config tests/vitest.config.js --testTimeout 20000 tests/unit/claude-tool-result-pairing.test.js tests/unit/github-responses-routing.test.js tests/unit/openai-to-claude-tools-no-type.test.js tests/translator/format-roundtrip.test.js (18/18)
  • Focused ESLint and git diff --check

@ryanngit
ryanngit force-pushed the claude-tool-result-pairing branch from ee0ce30 to 9504daa Compare July 19, 2026 10:09
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