Repository navigation
ThinkHarness tells the model once when the tools change - #3250
Merged
Merged
Conversation
|
| Name | Type |
|---|---|
| agents | Minor |
| @cloudflare/agent-think | Patch |
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
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Contributor
|
✅ agents import sizes: no significant changes ( |
mattzcarey
marked this pull request as ready for review
November 26, 2026 10:08
…ce when they change
…ool and changed examples
…; context adds the fingerprint to a record this turn already wrote
mattzcarey
force-pushed
the
slim/ext-e3c
branch
from
November 26, 2026 10:40
b3927c9 to
4d5f87a
Compare
… against the turn's baseline and target
This was referenced Nov 26, 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.
ThinkHarness now passes the tools each model call actually sends, as names and definition hashes, to the session's context. With #3219, when a turn sends a different list from the previous turn, the model is told once, right after that turn's user message, what was added, what is gone and what changed. This is E3c of the Think extensions design: an extension loaded or unloaded, an MCP server connecting, a client tool declared late, or
beforeTurnchoosing differentactiveTools. The change costs one cache miss, and the model is told why.The context prepares a turn in two steps.
prepareTurnreads the last tool list and the turn's user message, then prepares the blocks, sobeforeTurnstill gets the system prompt. AfterbeforeTurn,recordToolstakes the tools the request sends. A record the blocks wrote carries the earlier tools forward. So a changed block doesn't hide the earlier list, a messagebeforeTurnappends doesn't move where the notice is recorded, and the blocks' reminder is sent once on a continuation or a regeneration. A hash covers what the model sees of a tool (description, input schema, input examples, provider fields) and is cached per tool object.Cost: one SHA-256 per tool object, once. Per model call, the same reads as a single
preparewith tools: the newest record and the latest leaf. With unchanged tools, nothing more is read or written and the history is projected once. Only a change adds a record write and a second projection.Validation:
harness.test.tstests: tools changed between turns, a tool declared by a client, changedinputExamples,activeToolsfiltering, a block and the tools changed before the same message, a regeneration after a block change, a message appended inbeforeTurn, and the continuation test counting the reminder once. The last four fail before the fix.pnpm run checkis green.