Skip to content

Fix tool input reconstruction for approval requests - #2021

Draft
threepointone wants to merge 1 commit into
mainfrom
codex/fix-1872-approval-input
Draft

Fix tool input reconstruction for approval requests#2021
threepointone wants to merge 1 commit into
mainfrom
codex/fix-1872-approval-input

Conversation

@threepointone

Copy link
Copy Markdown
Contributor

Fixes #1872.

What changed

  • Accumulate AI SDK tool input text deltas using the current inputTextDelta field and parse them at a safe boundary.
  • Preserve compatibility with custom/older streams that provide parsed input on delta chunks.
  • Allow a canonical input-available chunk to complete server-side reconstruction after approval-requested without regressing the approval state or rebroadcasting a stale client transition.
  • Add regression coverage for both event orderings and the compatibility path.
  • Add patch changesets for agents and @cloudflare/ai-chat.

Reproduction

Before the fix, the new regression cases reproduced the report: streamed arguments remained undefined both when deltas preceded approval and when approval-requested preceded input-available.

Validation

  • agents chat suite: 26 files, 517 tests passed
  • ai-chat Workers suite: 49 files, 655 tests passed
  • affected TypeScript configs passed
  • repository formatting and lint passed
  • package export validation passed
  • sherif passed with the two existing missing-package warnings for examples/harness-deck and examples/think-standalone

No documentation update is needed because this restores internal stream reconstruction behavior without changing the public API.

@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5aa7ce2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
agents Patch
@cloudflare/ai-chat Patch
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2021

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2021

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2021

create-think

npm i https://pkg.pr.new/create-think@2021

hono-agents

npm i https://pkg.pr.new/hono-agents@2021

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2021

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2021

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2021

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2021

commit: 5aa7ce2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant