Skip to content

Reconcile Think follow-ups and extend runTurn stream input#1799

Merged
threepointone merged 5 commits into
mainfrom
fix/design-reconciliation-d6-runturn
Jun 23, 2026
Merged

Reconcile Think follow-ups and extend runTurn stream input#1799
threepointone merged 5 commits into
mainfrom
fix/design-reconciliation-d6-runturn

Conversation

@threepointone

@threepointone threepointone commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reconcile stale design/RFC status for shipped Turns, sub-agent routing, and Channels work, and document the accepted tool-approval-dedup SIGKILL coverage gap separately from skipped test debt.
  • Broaden chat:turn:* metadata coverage for wait/continuation/RPC/sequential turns, skipped empty input, and the current absence of channel on the turn observability payload.
  • Extend Think.runTurn({ mode: "stream" }) to accept array and function inputs by widening chat() to resolve TurnInputMessages inside the queued turn.
  • Keep submit + function input rejected because durable submission cannot serialize a function input yet.

Why

The design docs had drifted behind implementation state, and runTurn stream mode still had an artificial input-shape gap after _admitTurn shipped. This PR lines the docs up with the code, adds executable coverage for the turn metadata contract, and makes stream mode match the practical wait mode input surface for arrays/functions.

Implementation notes

  • Static empty stream input ("" / []) still creates a request id, calls onStart, then calls onDone without running inference or persisting messages.
  • Function input is evaluated inside _admitTurn against the in-queue transcript. A function returning [] preserves existing programmatic behavior: it runs against existing history when present rather than being pre-skipped.
  • Array stream input is stamped with channel metadata consistently with other message-input paths.
  • D6 client retry hardening is intentionally not included here because agents pins partysocket at 1.2.0; it should land after the upstream shouldReconnectOnClose release from Add partysocket terminal close reconnect predicate partykit#409.

Test plan

  • pnpm exec vitest --run -c src/tests/vitest.config.ts src/tests/run-turn.test.ts from packages/think: passed, 26 tests.
  • pnpm run check: passed, including Sherif, export checks, format check, oxlint, and typecheck across 113 projects.

Made with Cursor


Open in Devin Review

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a3633e6

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

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

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 Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

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

@cloudflare/ai-chat

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

@cloudflare/codemode

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

create-think

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

hono-agents

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

@cloudflare/shell

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

@cloudflare/think

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

@cloudflare/voice

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

@cloudflare/worker-bundler

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

commit: a3633e6

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread packages/think/src/think.ts Outdated
threepointone and others added 4 commits June 23, 2026 13:51
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@threepointone threepointone merged commit 3c2afc9 into main Jun 23, 2026
7 checks passed
@threepointone threepointone deleted the fix/design-reconciliation-d6-runturn branch June 23, 2026 13:43
@github-actions github-actions Bot mentioned this pull request Jun 22, 2026
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