GeezerVison is showing github.com — feat(v2)!: make tools.updates a list of tool changes by rekram1-node · Pull Request #13856 · anomalyco/models.dev
Conversation
Problem
capabilities.tools.updates was a boolean, so it couldn't say which tool changes an API takes in the history. Kimi only takes additions, Anthropic takes additions, removals and redefinitions, and OpenAI Responses differs by model. @opencode/ai now plans tool changes from this per change type and folds whatever the model can't take into the top-level tool list (merged in anomalyco/opencode#64166), so it needs the list.
Change
Breaking v2 change: tools.updates is now a list of the tool changes an API accepts mid-conversation without changing the leading tool list.
// packages/core/src/schema-v2.ts
+ToolUpdateV2 = z.enum(["add", "remove", "replace"])
ToolDetailsV2 = {
strict, choice, search, freeform,
- updates: boolean
+ updates: ToolUpdateV2[] // left out = none
}
// published per API, always stated
-tools: { ..., updates: boolean }
+tools: { ..., updates: ToolUpdateV2[] } // [] when none
add: declares a tool not declared before.
remove: withdraws a declared tool.
replace: declares a tool under a name declared before (a redefinition, or re-adding a removed tool).
Left out (or []) means none, and callers fold every change into the top-level tool list. Files leave it out instead of writing updates = [], and bun validate rejects [] the same way it rejects = false. The generator publishes [] where it used to publish false. v1 doesn't publish tool details, so it's unchanged. I also updated AGENTS.md, the test fixtures, and the comments in every file whose value changed. About 1,900 other files only mention tools.updates = false in a comment. I left those alone to keep the diff small, and they still read correctly as "none".
Data
| Family / route |
Before |
After |
Tables (files) |
| Anthropic Messages: Anthropic, Bedrock InvokeModel/Mantle, Vertex, Azure, Cloudflare passthrough, Zen/Go, Command Code |
true |
["add", "remove", "replace"] |
56 (56) |
Vercel chat-completions for Claude (providerOptions.anthropic.toolChanges) |
true |
left out |
10 (10) |
| OpenAI Responses, GPT-5.6* / GPT-6* / GPT-6.1* (incl. cyber and daybreak aliases): OpenAI, Azure, Cloudflare passthrough |
true |
["add", "remove", "replace"] |
29 (29) |
| Same models on Zen/Go (pass requests through to OpenAI) |
true |
["add", "remove", "replace"] |
9 (9) |
| Same models on Bedrock Mantle Responses |
true |
["add", "remove", "replace"] |
8 (8) |
Same models on OpenRouter Responses (incl. Pro models and the ~openai/gpt-{luna,astra,sol,terra}-latest aliases) and Vercel /v1/responses |
true or unset |
["add", "remove"] |
36 (36) |
Same models on Vercel chat-completions (providerOptions.openai.additionalTools) |
true |
["add"] |
14 (14) |
| Kimi K3 / K3.1 tool-carrying system message (Moonshot, Kimi Code, Together, Novita, Fireworks, Morph, Alibaba, Cloudflare, Zen/Go) |
true |
["add"] |
31 (25) |
| OpenAI GPT-5.5 and earlier (gpt-5.x ≤ 5.5, codex, gpt-4.x, o-series) on every host |
true |
left out |
154 (122) |
OpenRouter Messages for Claude (add by tool_reference only, by value rejected) |
true |
["remove"] |
3 (3) |
Why GPT-5.5 and earlier get nothing. On those models, calls to a tool added through additional_tools come back with a namespace, and replaying the call without it fails ("Missing namespace for function_call", live 2026-11-16 on gpt-5.5, on both /responses and /responses/compact). GPT-5.6 and GPT-6.x return no namespace and accept replays either way. On those, I checked live that additions work natively, that redefinition works when every tool is declared in additional_tools, and that announced removals are followed, with the cache kept. Each affected file gets a header line explaining why the key is left out.
OpenRouter Messages. Callers send additions by value, and OpenRouter rejects those (only tool_reference works, which is tool search and belongs in tools.search), so add and replace are out. I tested a tool_removal block on its own live (2026-11-16, claude-haiku-5.5 pinned to Anthropic). The model said the weather tool was no longer available and didn't call it, and the cache read stayed at 13,977 tokens, the same as the control. So these files get ["remove"].
Set to none: OpenRouter's ~openai/gpt-mini-latest: an addition works, but a removal announcement was ignored 2/2 and the alias has no base_model, so the GPT-5.5 namespace failure can't be ruled out. The other -latest aliases and the Pro models were tested live and behave like their base models.
Live checks of the request shapes @opencode/ai sends (2026-11-17, 3 runs per case, script and output in my notes). Each case: add a tool, redefine a tool with a new required field, remove a tool, plus a control with no change.
| Host |
add |
replace |
remove |
| OpenAI Responses (gpt-6-astra, gpt-5.6-sol) |
3/3 |
3/3 |
3/3 |
| Bedrock Mantle Responses (same models) |
3/3 |
3/3 |
3/3 |
OpenRouter Responses, Vercel /v1/responses (same models) |
3/3 |
0/3: the call keeps the old schema |
3/3 |
| Zen Responses and Messages (gpt-6-astra, gpt-5.6-sol, claude-opus-5-5, claude-haiku-5-5) |
3/3 |
3/3 |
3/3 |
| Anthropic (claude-opus-4-8, fable-5, fable-5-1, fable-5-2, opus-5, haiku-5-5) |
3/3 |
3/3 |
3/3 |
| Bedrock Mantle Messages (claude-opus-5-5, claude-opus-4-8) |
3/3 |
3/3 |
3/3 |
OpenRouter Responses Pro models (gpt-6-luna-pro, gpt-5.6-sol-pro) and -latest aliases |
2/2 |
0/2 |
2/2 (mini-latest 0/2) |
| Vertex (claude-opus-5-5, claude-opus-5, claude-opus-4-8) |
3/3 |
3/3 |
3/3 |
Vercel chat-completions for Claude via @ai-sdk/gateway |
not expressible: toolChanges only references declared tools |
not expressible |
ignored 3 of 6 times with cache control on |
Not re-tested: Cloudflare passthrough (the gateway key returned 401), Vertex Sonnet/Haiku/Fable (not enabled in the project I tested), Azure and Command Code (no keys). Their values follow the upstream API they pass through.
Verification
bun validate: passes
bun run v1:check: "v1 output is byte-identical."
bun test: the same 14 failures as on clean origin/dev, and no new ones
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Action items
- [low] [possible mistake]
.pr-review/pull-request.json (PR body) vs. head commit 4dc3a38 ("chore: keep comment-only tools.updates wording out of this change", diff.patch:29876) - Check: The PR description must describe the change that actually merges. Why: The body says "Comments that said = false now say = [], which is why the diff touches ~2,200 files," but the second commit reverts all 1,924 comment-only rewordings (each reverted file is a single comment-line swap back to the base blob, e.g. diff.patch:31806-31815). The net merge result leaves those comments in the old boolean wording and changes only ~300 files (code, tests, AGENTS.md, and the TOMLs with real updates data changes), so a maintainer approving from the body would be misled about the PR's scope and final file state. Action: Update the PR body (Change narrative, Data table file counts, and the ~2,200-file claim) to match the head state — comments intentionally left with the old wording, net diff limited to data/schema changes — or drop the revert commit if the rewording was actually intended.
- [low] [possible mistake]
providers/openrouter/models/anthropic/claude-haiku-5.5.toml:5 (also claude-opus-5.5.toml, claude-sonnet-5.5.toml) - Check: tools.updates values must list every change type the host actually accepts, per the new AGENTS.md rule ("List only what the host does"). Why: The diff deletes capabilities = { tools = { updates = true } } from [api.messages] (diff.patch:20709, 20792) while the kept comment still asserts "tool_addition/tool_removal system blocks with anthropic-beta inline-tools-2026-09-15 keep the cache (live 2026-10-23)." The stated reason for leaving updates out covers only add (by-value rejected; by-reference is tool search). Nothing in the file or diff shows remove fails on OpenRouter's /api/v1/messages, so authoring "none" both contradicts the comment's own evidence and makes clients fold removals into the top-level tool list (losing the cache) if tool_removal blocks actually work there. Action: Verify whether a tool_removal block (by name) is accepted and keeps the cache on OpenRouter's Messages route; if it does, author updates = ["remove"] on [api.messages] for these three files, and if it does not, correct the comment so it no longer claims tool_removal blocks keep the cache.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks. The body is updated to match the head: the comment-only rewording is reverted to stay under the 300-file diff limit. On OpenRouter Messages, I tested a tool_removal block live (2026-11-16, claude-haiku-5.5): the model followed it and the cache read matched the control (13,977 tokens). Those three files now set updates = ["remove"], and the comment says so.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Action items
- [medium] [possible mistake]
providers/openrouter/models/~openai/gpt-luna-latest.toml:35 - Check: tools.updates on OpenRouter's /api/v1/responses for the GPT‑5.6/6 Luna family. Why: The PR deletes this file's live-probed capabilities = { tools = { updates = true } } from [api.responses] and justifies leaving it out with the "on GPT-5.5 and earlier, calls to tools added through additional_tools come back namespaced" rationale — but this alias tracks the GPT‑6-generation Luna (its own header cites live probes on gpt-6-luna; no Luna model is ≤5.5). The retained comment in the same file still documents that additional_tools items keep the cache on this exact route, so the file is self-contradictory, and the alias now publishes [] while gpt-5.6-luna and gpt-6-luna on the same host and route publish ["add", "remove"] (patches 1+4). This is a published-data regression (true → none) that makes clients fold tool changes into the top-level list and bust caches. Action: Restore updates = ["add", "remove"] on [api.responses] (aligned with the Luna entries per the 2026‑11‑17 probe) and fix or drop the GPT‑5.5-and-earlier comment; ~openai/gpt-mini-latest is the only alias where that rationale actually applies.
- [low] [possible mistake]
providers/openrouter/models/openai/gpt-5.6-luna-pro.toml:23 - Check: tools.updates on OpenRouter /api/v1/responses for the -pro and -latest GPT‑5.6/6/6.1 entries. Why: Patch 4 applies its live-probe result (["add", "remove"], probed on gpt-6-astra and gpt-5.6-sol) to every non-pro GPT‑5.6/6/6.1 file — including gpt-6-astra, which previously had no value, and mirroring Vercel where the previously-valueless gpt-6.1-terra entries also got the list — but the eight -pro files (gpt-5.6-{luna,sol,terra}-pro, gpt-6-{astra,luna,sol}-pro, gpt-6.1-{sol,terra}-pro) and the ~openai/gpt-{astra,sol,terra}-latest aliases keep [api.responses] tools with no updates on the same route and lab base models, with only a Chat Completions justification in their comments. They now assert "no tool changes" on a surface the PR's own probe says accepts add and remove. Action: Add updates = ["add", "remove"] to these sibling entries' [api.responses] capabilities, or document per host/model evidence why they differ from the canonical entries.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Action items
- [medium] [possible mistake]
providers/openai/models/gpt-5.6-luna.toml:26 - Check: updates = ["add", "remove", "replace"] on OpenAI's own GPT-5.6/GPT-6 Responses entries (also gpt-5.6/sol/terra/cyber, gpt-6*, gpt-daybreak-*, and the Azure/Cloudflare AI Gateway/OpenCode Zen files that follow them, plus the new AGENTS.md sentence "takes all three on GPT-5.6 and GPT-6"). Why: No documentation citation or live-probe note was added to any providers/openai GPT-5.6/6 file for remove/replace, while this PR's own 2026-11-17 probes of the same models through Responses routes pinned to OpenAI (OpenRouter [api.responses], Vercel AI Gateway [api.responses]) found "a redefinition keeps the old schema (0/3)"; only Bedrock Mantle (AWS's re-implementation, not a passthrough) showed redefinitions working (3/3). If OpenAI's own API also ignores redefinitions, consumers will plan in-history tool redefinitions that silently keep the old schema on the most-used models. Action: Verify redefinition (and re-adding a removed tool) on OpenAI's own Responses API, record the evidence in the file headers, and narrow these entries (and the AGENTS.md text) to ["add", "remove"] if it doesn't hold.
- [low] [possible mistake]
providers/anthropic/models/claude-opus-5.toml:22 - Check: updates = ["add", "remove", "replace"] on the Anthropic Messages family (anthropic, azure, amazon-bedrock, vertex, cloudflare-ai-gateway, commandcode claude files). Why: The pre-existing header only documents "tool_addition/tool_removal blocks (inline-tools-2026-09-15) keep the cache", which evidences add and remove; the new replace entry (redefinition, or re-adding a removed tool) has no documentation or live-probe note in any of these files, unlike every relay in this PR which received an explicit per-change-type evidence comment. Action: Cite Anthropic documentation or a live probe covering redefinition/re-add in the family's file headers, or narrow these entries to ["add", "remove"].
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Action items
-
[medium] [possible mistake] packages/core/test/github-copilot.test.ts:309 - Check: The updated assertion must hold against the fixture the test pins byte-for-byte. Why: The test reads providers/github-copilot/models/claude-opus-4.8.toml from the repo (unchanged by this PR), asserts expect(synced).toBe(opus), and then expects top-level capabilities: { tools: { supported = true, updates = [...] }, system_updates = true }. That file deliberately leaves tools.updates out everywhere (its header: tool_addition/tool_removal "need Anthropic betas that GitHub doesn't document for Copilot") and sets system_updates = true only on [api.messages]; since the copilot sync only patches cost and patchModelV2 preserves the file's own v2 tables, the sync cannot produce the asserted top-level flags. Note the PR validation workflow runs only bun validate and the SDK tests, not the core suite, so this won't surface in CI. Action: Run bun test from the repo root and reconcile the test with the catalog file — fix the expected capabilities to the file's actual conservative flags (or update the copilot catalog files if the flags were meant to change), so a future "fix the red test" edit can't publish incorrect Copilot data.
-
[low] [possible mistake] providers/vercel/models/anthropic/claude-haiku-5.5.toml:2 - Check: Header comments must match the values the PR leaves in the file. Why: Patch 4 removes tools = { updates = [...] } from [api.chat-completions] (live check: the gateway's providerOptions.anthropic.toolChanges can't add/redefine and removals were ignored 3/6 runs) and adds a "no tools.updates" line, but the unchanged "Per API: system_updates, effort_updates, tools.updates on [api.chat-completions] (@ai-sdk/gateway) only…" line above it still tells editors that tools.updates is set there — two comment lines in the same header now contradict each other. The same stale "Per API: tools.updates on [api.chat-completions] … and [api.responses] …" line remains in the Vercel GPT-5.5-and-earlier files (e.g. gpt-5.2.toml, gpt-4.1-mini.toml) where this PR removed the values. Action: Drop tools.updates from those "Per API" comment lines in the affected Vercel Anthropic and GPT-≤5.5 files so the header states one consistent truth.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This branch had an error being deployed
1 failed
deployment
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|