Skip to content

refactor(schema): simplify session fragment state#35272

Open
kitlangton wants to merge 2 commits into
fix-shell-testsfrom
event-fragments
Open

refactor(schema): simplify session fragment state#35272
kitlangton wants to merge 2 commits into
fix-shell-testsfrom
event-fragments

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Closes #35019.

Summary

Simplifies V2 assistant fragment and provider-continuation state while preserving provider-native correlation inside @opencode-ai/llm.

  • Removes textID / reasoningID from session events and projected text/reasoning parts.
  • Enforces one open text and one open reasoning fragment at the Session publisher boundary.
  • Fixes OpenAI Responses text lifecycle closure at response.output_text.done / completed message-item boundaries.
  • Replaces nested providerMetadata with un-nested state / resultState event payloads.
  • Projects tool continuation as providerState / providerResultState, with executed top-level.
  • Drops the duplicate tool name from session.tool.called; session.tool.input.started.name remains authoritative.
  • Publishes live session.compaction.delta events and renders the streaming summary in the TUI.
  • Renames session.revert.committed.messageID to to.

Provider state is extracted using the route provider (model.provider, e.g. openai) rather than the catalog provider identity, then re-nested only when replaying history through the same model.

Fragment premise

The adapter audit found no provider-valid overlapping text/reasoning fragments in Anthropic or Bedrock recordings/contracts. OpenAI Responses appeared overlapping because completed text blocks were left open until response finish; this PR closes them at their real done boundaries and adds a sequential-message regression test. Provider block IDs remain internal to packages/llm.

Persistence

20260703200000_reset_v2_event_fragments clears V2 events, sequences, projected messages, and admitted inputs. Changed durable contracts restart at version 1.

Verification

  • Schema: 10 focused tests
  • LLM OpenAI Responses: 56 tests
  • Core: 116 focused tests, including provider/catalog identity mismatch coverage
  • TUI: 25 focused tests
  • Run compatibility: 26 passed, 3 skipped
  • Shell aggregate: 13 passed on top of test(core): release shell test locations #35271
  • All affected package typechecks passed
  • Full-repo pre-push typecheck passed
  • Client and legacy SDK generators reproduced cleanly on consecutive runs
  • Prettier clean; file-scoped oxlint has 0 errors

Base #35271 is a one-file test isolation prerequisite; this PR's product diff is otherwise independent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant