Skip to content

harness-backed Think: runTurn's turns as on Think (run-turn 15 -> 34 of 35) - #3481

Merged
mattzcarey merged 9 commits into
mainfrom
slim/nightly-runturn
Nov 28, 2026
Merged

mattzcarey merged 9 commits into
mainfrom
slim/nightly-runturn

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Brings runTurn and the turns it starts on the harness-backed Think to Think's behaviour. On the harness config, run-turn.test.ts goes from 15 to 34 of 35. A full harness-config run loses none of the tests harness-compat.json records as passing.

One commit per change:

  • Every turn that runs emits chat:turn:start and chat:turn:finish, with Think's payload: request id, trigger, admission, continuation, generation, then status and duration. Turns a method call asks for (saveMessages, runTurn, continueLastTurn) are named programmatic.
  • runTurn checks its options in Think's order and with Think's messages: an unknown mode, continuation outside wait mode, stream mode without a callback, a submit or stream without input, and a function submit. Static empty input runs no turn: wait mode returns skipped, and stream mode starts and ends at once.
  • A turn that waits for its own reply (saveMessages, continueLastTurn, runTurn in wait or stream mode, chat) throws Think's error when asked for from inside the agent's running turn. A submit and addMessages are still allowed there.
  • runTurn's continuation skips when the last message is not the assistant's.
  • ThinkHarness gets an @internal reply input: an operation that brings no message and answers the history with a new assistant message after the latest one. This is arch's ruling for continueLastTurn ("an answer turn with no question"); the public API does not change, and a recovery still continues in place. Two harness tests cover it.
  • The shell uses reply for continueLastTurn, runTurn's continuation, an empty saveMessages and a chat whose function adds nothing, so each writes a new reply, as Think does. runTurn's continuation goes through an overridden continueLastTurn, and these turns tell beforeTurn and the writer they are continuations, as on the class.

does not borrow an old assistant when a continuation persists no content still fails: it needs structured output (think_final_answer) on the shell. Stacked on #3474. No changeset: the harness-backed Think is not exported, and the reply input is @internal.

Validated: run-turn.test.ts 34 of 35 on the harness config and 35 of 35 on the class config; harness/think tests 162 of 162; a full harness-config run compared against harness-compat.json.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d2b3009

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

agents

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

@cloudflare/ai-chat

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

@cloudflare/codemode

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

hono-agents

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

@cloudflare/shell

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

@cloudflare/think

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

@cloudflare/voice

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

@cloudflare/worker-bundler

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

commit: d2b3009

@agent-think

agent-think Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🔴 agents import sizes: 1 entry point over threshold

Entry point Exports Largest gzip change Size now
🔴 agents/chat 24 resized up to +2.2 KiB (+410.34%) 2.7 KiB
Changed exports (24)
Import Gzip change Size now
🔴 agents/chat#INTERRUPTED_TOOL_ERROR_TEXT +2.2 KiB (+410.34%) 2.7 KiB
🔴 agents/chat#clientResolvableToolNames +2.2 KiB (+493.16%) 2.6 KiB
🔴 agents/chat#persistRepairedTranscript +2.2 KiB (+345.72%) 2.8 KiB
🔴 agents/chat#streamChunksFinished +2.2 KiB (+460.37%) 2.6 KiB
🔴 agents/chat#unexecutedToolNames +2.2 KiB (+441.15%) 2.7 KiB
🔴 agents/chat#pausedExecutionUpdate +2.2 KiB (+408.7%) 2.7 KiB
🔴 agents/chat#applyToolUpdate +2.2 KiB (+373.56%) 2.7 KiB
🔴 agents/chat#toolPartHasSettledResult +2.2 KiB (+452.36%) 2.6 KiB
🔴 agents/chat#toolResultUpdate +2.1 KiB (+372.74%) 2.7 KiB
🔴 agents/chat#crossMessageToolResultUpdate +2.1 KiB (+371.14%) 2.7 KiB
🔴 agents/chat#toolApprovalUpdate +2.1 KiB (+365.38%) 2.7 KiB
🔴 agents/chat#stripTrailingReasoning +2.1 KiB (+306.49%) 2.8 KiB
🔴 agents/chat#hasIncompleteToolBatch +2.1 KiB (+345.61%) 2.7 KiB
🔴 agents/chat#partAwaitsClientInteraction +2.1 KiB (+362.04%) 2.7 KiB
🔴 agents/chat#interruptedToolPartAsError +2.1 KiB (+280.65%) 2.9 KiB
🔴 agents/chat#continuationWaitsOnClient +2.1 KiB (+335.25%) 2.7 KiB
🔴 agents/chat#replyToContinueIsEmpty +2.1 KiB (+272.95%) 2.9 KiB
🔴 agents/chat#removeEmptyReplyToContinue +2.1 KiB (+198.34%) 3.2 KiB
🔴 agents/chat#hasPendingToolInteraction +2.1 KiB (+275.48%) 2.9 KiB
🔴 agents/chat#applyToolPartUpdate +2.1 KiB (+223.77%) 3 KiB
🔴 agents/chat#unsettledToolCallIds +2.1 KiB (+332.4%) 2.7 KiB
🔴 agents/chat#repairInterruptedToolParts +2 KiB (+142.49%) 3.3 KiB
🔴 agents/chat#repairTranscriptBeforeTurn +1.9 KiB (+122.13%) 3.5 KiB
🔴 agents/chat#settleInterruptedReply +1.9 KiB (+120.44%) 3.5 KiB
How this works

Each runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement.

Compared 372822c4 → d2b3009f · workflow run · reported by agent-think[bot]

devin-ai-integration[bot]

This comment was marked as resolved.

@mattzcarey
mattzcarey marked this pull request as draft November 27, 2026 14:58
mattzcarey added a commit that referenced this pull request Nov 27, 2026
… a client, runs on the channel its caller names, and a new reply stays a continuation after a restart (Devin, #3481)
@mattzcarey
mattzcarey marked this pull request as ready for review November 27, 2026 15:05
@mattzcarey
mattzcarey marked this pull request as draft November 27, 2026 15:14
@mattzcarey
mattzcarey marked this pull request as ready for review November 27, 2026 15:14
@mattzcarey
mattzcarey changed the base branch from slim/harness-group-a to main November 27, 2026 15:37
…turn that runs, programmatic turns named as such
…age is not the assistant's, as continueLastTurn does
…a new assistant message after the latest one
…pty saveMessages and an empty chat write a new reply, as on Think; runTurn's continuation goes through an overridden continueLastTurn
… a client, runs on the channel its caller names, and a new reply stays a continuation after a restart (Devin, #3481)
…till one when it runs again; the record read only for a turn that could be a new reply, and the client-tool check reads the declared names, not a build (rv-1)
@mattzcarey
mattzcarey marked this pull request as draft November 28, 2026 12:40
@mattzcarey
mattzcarey marked this pull request as ready for review November 28, 2026 12:41
devin-ai-integration[bot]

This comment was marked as resolved.

… on a client; an empty saveMessages asks the model, as on Think (Devin, #3481)
@mattzcarey
mattzcarey marked this pull request as draft November 28, 2026 13:05
@mattzcarey
mattzcarey marked this pull request as ready for review November 28, 2026 13:05

@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 new potential issue.

Devin Review

@mattzcarey
mattzcarey merged commit ca1fc52 into main Nov 28, 2026
28 checks passed
@mattzcarey
mattzcarey deleted the slim/nightly-runturn branch November 28, 2026 14:30
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