{{ message }}
Repository navigation
refactor(schema): rename provider replay data to native - #56640
Merged
Merged
Conversation
This was referenced Oct 19, 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.

Problem
Provider replay data appeared in messages and events under the names
stateandproviderState, typed asProviderState. On tool parts,statealready means the tool's lifecycle status (streaming,running,completed,error), while on text and reasoning parts the samestatekey held provider data.Change
Provider replay data is now
native, typed asSessionMessage.Native.session.text.ended,session.reasoning.started,session.reasoning.ended,session.tool.calledstatenativesession.step.ended,session.step.failed,session.compaction.endedproviderStatenativesession.tool.success,session.tool.failedresultStateDurable event versions are unchanged. The result-side fields keep their names; only their type reference changes from
ProviderStatetoNative. The pluginSessionCompactionResult.providerStateis nownative, and the plugin docs are updated.Existing data
There is no database migration. Stored events, projected messages, and exported sessions keep whatever shape they were written in.
@opencode/schema/session-legacyupgrades old field names before decoding, and each source has a single entry point:state(its status) is never touched.nativeon text, reasoning, and tool parts.POST /api/experimental/session/importkeepsmessagesas plain JSON on the wire, so OpenAPI and the promise client accept any export file. The payload schema upgrades transcripts from earlier releases, then decodes them against the current message schema. Invalid messages fail through the shared schema-error middleware as a400 InvalidRequestErrorwithkind: "Payload". The Effect client's import input is still typedSessionMessage.Info, so an export round-trips. The handler is unchanged. The CLI and the app send export files unchanged.The CLI
--format jsonoutput keeps its V1-styleproviderCall: { executed, state }andproviderResult: { executed, state }keys; only the source of the values changed.Out of scope
providerResultStateandresultStateare left for a follow-up.Verification
packages/schema/test/session-legacy.test.tschecks that:native;session.message.content.updatedparts are upgraded and the tool status is left alone;packages/core/test/session-projector.test.ts"reads and replays native data stored under its pre-v2.1 names":session_messageandeventrows, then checksSessionStore.messagesandBus.log;session.step.endedevent, then checks it is stored asnativeand projected onto the legacy row;nativeintact.The replay assertion fails with
Replay divergedwithout the idempotency fix.packages/server/test/session-import.test.ts:location-switchedmessage, and fails without the payload-schema upgrade;packages/cli/test/import-export.test.ts"import sends the file unchanged to the resolved location": legacy fields reach the server intact.bun typecheckpasses in schema, protocol, core, client, cli, tui, server, plugin, sdk, session-ui, and app, apart from errors that were already onv2.1intui/dialog-workspaces.tsx,tui/prompt/autocomplete.tsx,app/runtime/server/persistence.ts, andapp/settings/model.tsx.Tests:
bun test test/session* test/v1-migration.test.ts test/bus*.test.ts test/database-migration.test.tsbun testbun testbun testbun test test/run test/acp test/import-export.test.tsbun test test/cli/tui/data.test.tsx test/mini test/app-lifecycle.test.tsxtest:unitcheck:generatedpasses in packages/protocol, packages/client, and services/www.