fix(agent-core): backstop missing tool-call input on replay - #89
Merged
Conversation
A tool call aborted mid input-stream (or persisted by an older path) can
carry no `input` at all. Anthropic requires every `tool_use` block to have
an `input` object, so an absent one yields `tool_use.input: Field required`
400s when the history is replayed.
`finalizeOrphanToolParts` now defaults `input` to `{}` for any tool part
that lacks one, independent of the orphan-state rewrite it already did.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying openacme-ai with
|
| Latest commit: |
2a25c8b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://756e615b.openacme-ai.pages.dev |
| Branch Preview URL: | https://fix-tool-input-backstop.openacme-ai.pages.dev |
ukanwat
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
finalizeOrphanToolPartsnow defaults a tool part'sinputto{}whenever it's missing, independent of the existing orphan-state rewrite.Why
A tool call aborted mid input-stream — or persisted by an older code path — can carry no
inputat all. Anthropic requires everytool_useblock to have aninputobject, so an absent one producestool_use.input: Field required400s when the session history is replayed.The previous logic only rewrote parts in
input-streaming/input-availablestates tooutput-error; a completed-but-input-less part slipped through and broke replay. Now any tool part lackinginputgets{}, and the orphan rewrite still applies on top where relevant.Test
pnpm --filter @openacme/agent-core check-typesclean; full-workspace check-types ran clean via the pre-commit hook.🤖 Generated with Claude Code