Repository navigation
ThinkHarness: operations are runs on its own Tasks instance - #3147
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 61d8038 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Contributor
🔴 agents import sizes: 3 entry points over threshold
Changed exports (196)
…and 146 more exports in the workflow artifact. How this worksEach 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 |
mattzcarey
marked this pull request as ready for review
November 25, 2026 11:46
… carried-forward seals keep their partial; settled store rows dropped unread
…settled operations; docs wait for the release (#3152)
…-call markers go with the next state write
This was referenced Nov 25, 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.
ThinkHarnessruns each operation as a run on aTasksinstance it composes (tasks/@think-harness), one lane per session.submitistasks.run,waitistasks.wait,abortistasks.cancel, a turn's progress is the run's checkpoint, and each server tool call is arun.dostep that runs the tool and writes its result to the transcript. The harness's own wake job, 30 s heartbeat, backoff formula, waiter map, drive map andonMemoryLimitare gone, andrecords.tskeeps only sessions and client tools.Operations were the last thing the harness scheduled itself (THINK-HARNESS.md, H1):
recoverypolicy decides as before: reported as interrupted, or rerun when markedrecovery: "rerun". A tool that finished is never run again: its step completes after its result is in the transcript.backoffDelay(...)(now with jitter), which keeps the lane.abort()holds the session's lane across the cancel, so the next queued operation starts after that partial is in the transcript.think/src/harness/think.ts) gives the harness the Agent's defaultthis.tasks(internaltasksoption).reset()cancels every open operation, however many.design/think-harness.mddescribes the result. The user docs change waits for the release in docs(think harness): operations run on the harness's own Tasks #3152.peekList({ lane }), forpending(session)andreset(session).Cost, per
prompt()on the test fixture, main → this PR: plain reply rows written 24 → 21, rows read 121 → 115, statements 77 → 74,setAlarm4 → 2; one tool call 38 → 35 written, 188 → 176 read, 118 → 108 statements,setAlarm4 → 2; two parallel tool calls 42 → 39, 199 → 186, 130 → 117, 4 → 2.storage.sync()0 → 0. A cold start reads the store for open operations and deletes settled ones: 2 statements and 0 rows once the store is empty (main: 1). A settled run keeps its checkpoint (keepCheckpoint, about 150 bytes) untilreset(), as the store kept the same fields inmeta.Harness compat score (
pnpm test:harness): 131 → 133 of the 1,246 tests that construct Think, nothing that passed before fails.harness-think(80, including a reset duringafterToolCall, a clear past 100 queued operations, a carry-forward of 60 open operations behind 300 settled ones, a sealed turn carried forward, a reset between a tool and the model call after it, the abort order, the harness's runs apart from the host's ownTasks, and recovery inside a sub-agent woken through the root),tasksandchannelstests ran, pluspnpm run check.How to probe: deploy main and this head with a ThinkHarness host at the root and inside a sub-agent;
ctx.abort()mid model stream, mid server tool call (a tool that counts its runs in KV), and between the tool's result and the next model call; check the tool count stays 1 (unlessrecovery: "rerun"), the reply is one message, and an upgrade from main over a queued and a running operation finishes both.