{{ message }}
Repository navigation
refactor: v2.1 minor breaking changes - #57260
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
I found nothing that blocks this. I read the legacy upgraders, the kept-message rebuild in history.ts, the fork ID remap, and the import and redaction paths. A quick script confirmed that old credentials, assistant messages, compactions and events are upgraded on read. The closest tests all pass (core 122, schema 89, server session-import 5, cli auth/import-export 18), and type checks are clean for core, cli and schema.
Public API: not backwards compatible for current consumers. Stored data and old export files are still upgraded on read.
- Message parts:
- Text and reasoning:
state→native. - Tool:
providerState→native, andproviderResultStateis removed; its data now lives instate.nativeon completed or errored tools. - Assistant message:
providerState→native. - Compaction message:
providerState→native, andrecentis removed in favour ofmetadata.firstKeptMessageID. - Type
Session.Message.ProviderState→Session.Message.Native.
- Text and reasoning:
- Events:
session.text.ended,session.reasoning.started/ended,session.tool.called:state→native.session.step.ended/failed:providerState→native.session.tool.success/failed:resultState→native.session.compaction.started/ended:recentremoved, andendedrenamesproviderState→native.session.compactedis removed.
- Credentials:
Credential.Key.configurationis removed; its answers merge intometadata. - Plugin:
SessionCompactionResult.providerState→native. - HTTP:
experimental.session.importnow also accepts transcripts exported before v2.1.
SDK clients, plugins and event consumers that read the old names will need to switch to native and metadata.
8 of 10 tasks
9 of 11 tasks
vleonbonnet
added a commit
to vleonbonnet/opencode
that referenced
this pull request
Oct 20, 2026
Upstream's 97 commits since the port include v2.1's breaking changes (anomalyco#57260) and a shared Code Mode runtime per tool inventory (anomalyco#57172). - Code Mode fetch keeps asking for webfetch permission as the calling execute: with the runtime shared, the fetch global returns an Effect that reaches its execution's check through the runtime's per-execution Run service. The interpreter now runs a global's returned Effect in the execution's context, inside the extension hooks, and interrupts it when the execution ends, which withdraws a pending permission request and aborts the request. - The tool snapshot keeps exposure across selectable agents and delegation ceilings, now also deciding upstream's cached catalog. - The cache ledger and preflight follow v2.1's renames: native data (`state`, `providerState`) is `native`, and history is bounded by the model reference, as the runner does, now that the provider context module is gone. - Summarized thinking still wraps the request after model hooks; the provider-context route check went with that module. - Replayed dropped thinking and both sides' new event handlers and tests are kept; upstream's encoding test now expects permission reasons. - Generated client types and OpenAPI documents are regenerated.
12 tasks
3 of 6 tasks
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.

v2.1 minor breaking changes
Small, intentional changes to make the public API's names and data shapes more consistent. SDK consumers need to use the new fields. Existing stored data and old session imports remain readable through boundary decoders, without database migrations.
1. One name for provider replay data:
nativeProvider-owned data was called
state,providerStateorresultStatedepending on the message or event. These are now consistently namednative, distinct from a tool's executionstateand UImetadata.statenativeproviderStatenativesession.tool.calledstatenativesession.compaction.endedproviderStatenativesession.tool.success/session.tool.failedresultStatenativeThe exported schema name
SessionMessage.ProviderStatealso becomesSessionMessage.Native.2. Tool call and result replay data share one
tool.nativeSuccess and failure events merge their
nativeinto the tool's existingnative. Missing result data preserves call data; result values win on duplicate keys. There is nostate.native.Replay passes the whole merged blob to the protocol, which reads the fields it needs:
nativewhenThis avoids a second nested
native, a one-offresultNativefield, or a tool-specific{ call, result }envelope. Protocol implementations must use distinct keys for distinct call/result values. Current Anthropic hosted calls carry no replay data; Responses hosted calls and results carry the sameitemId.Old stored/imported
providerResultStateis merged intotool.nativewhen read. Tool status and readable result content stay instate.3. Key credential form answers use
metadataCredential.Key type: "key" key metadata? # now also holds setup-form answers - configuration? # setup-form answers (Form.Answer)Credential.Key.configurationis removed. Setup-form answers now go in the existingmetadatafield, rather than keeping two bags of provider configuration. Stored credentials andauth importaccept the old shape: a legacyconfigurationis merged intometadata, and theconfigurationvalue wins when both have the same key. Public credential writes must usemetadata.4. Compactions reference kept messages instead of storing
recentkeepIDidentifies the first message retained verbatim beside the summary. History reconstructs the text from that message through the compaction boundary, avoiding a duplicated, flattened copy in storage. Forks remap the reference to their copied messages; compaction hooks can override it through metadata.The
recentfield is removed from compaction messages and the started/ended events. Old storedrecenttext remains readable through the compatibility decoder.keepIDis the only name for the new reference—there is no alias for its unreleased earlier name.5. Remove unused
session.compactedThe unused transitional event is removed from the public event surface. Current compaction lifecycle events remain.
6. Provider compaction windows live in
native.messagesmodelhas the current provider ID and model ID. That's the same rule assistant parts use. Otherwise history sends the original messages.native. A compaction hook'sresult.nativeis still stored, and itsnative.messagesis treated as a replay window.providerContextrows and events are converted tonative.messageswhen read, including the media format from before 2.0.15.Other visible changes
metadata.recent, which is where replay reads it. New compactions store onlymetadata.keepID.Integration
Includes #56640, #56934, #56999, #56954, #57203, #57167, #57241 and #57286. Latest
devis merged intov2.1; the compaction conflict resolution retains both prompt-cache reuse and kept-message references. Generated client and OpenAPI files are updated.The hosted-tool provider-switch fix remains separate in #57256. No release/version bump is included.
Verification
Run on
v2.1after #57241:bun run checkpackages/schemabun testpackages/serverbun testcheck:generatedin protocol, client, wwwAdditional verification for #57286: root checks, changed-file lint and generated-file checks pass. Live Anthropic server-side web search, web fetch and failed web fetch all replayed successfully after restarting the CLI. Stored data uses only
tool.native; captured result blocks matched the stored payloads, including encrypted search content.