Skip to content

fix(agent-core): backstop missing tool-call input on replay - #89

Merged
ukanwat merged 1 commit into
mainfrom
fix/tool-input-backstop
Jun 24, 2026
Merged

fix(agent-core): backstop missing tool-call input on replay#89
ukanwat merged 1 commit into
mainfrom
fix/tool-input-backstop

Conversation

@sandydasari

Copy link
Copy Markdown
Owner

What

finalizeOrphanToolParts now defaults a tool part's input to {} 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 input at all. Anthropic requires every tool_use block to have an input object, so an absent one produces tool_use.input: Field required 400s when the session history is replayed.

The previous logic only rewrote parts in input-streaming / input-available states to output-error; a completed-but-input-less part slipped through and broke replay. Now any tool part lacking input gets {}, and the orphan rewrite still applies on top where relevant.

Test

pnpm --filter @openacme/agent-core check-types clean; full-workspace check-types ran clean via the pre-commit hook.

🤖 Generated with Claude Code

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>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying openacme-ai with  Cloudflare Pages  Cloudflare Pages

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

View logs

@ukanwat
ukanwat merged commit f684c90 into main Jun 24, 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