Repository navigation
refactor(app): use current session messages - #42766
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the desktop session timeline to use the current V2 SessionMessageInfo[] stream as the single source of truth, resolving legacy Message/Part transcript data at the render boundary (similar to the TUI) and adapting E2E fixtures accordingly.
Changes:
- Remove legacy
Message/Partnormalization and store onlySessionMessageInfo[], presenting legacy-compatible rows/parts only at render time. - Add native handling for shell messages as first-class timeline rows and update timeline row construction/grouping to operate on current assistant content.
- Update prompt restore/fork/revert flows to derive prompt text, attachments, and comments from
SessionMessageUser+ metadata.
Reviewed changes
Copilot reviewed 58 out of 58 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/session-ui/src/context/data.tsx | Makes legacy message/part stores optional to support app-side refactor away from legacy transcript state. |
| packages/session-ui/src/components/message-part.tsx | Adds SessionShellMessage renderer and registers a shell tool renderer for session shell messages. |
| packages/app/src/utils/session-message.ts | Replaces legacy normalization with “present*” helpers that project current protocol messages into DOM renderer structures. |
| packages/app/src/utils/session-message.test.ts | Updates unit tests to validate presentation helpers instead of legacy normalization output. |
| packages/app/src/utils/prompt.ts | Switches prompt restore to operate on SessionMessageUser (files/agents/metadata) and exposes comment extraction. |
| packages/app/src/utils/prompt.test.ts | Updates prompt restore tests to cover attachments, optimistic data URLs, and review comments. |
| packages/app/src/utils/diffs.ts | Removes legacy message summary normalization helper, keeping only diff normalization. |
| packages/app/src/utils/diffs.test.ts | Removes tests for deleted legacy message summary normalization. |
| packages/app/src/utils/comment-note.ts | Adds readPromptPresentation helper to read displayText + comment metadata from message metadata. |
| packages/app/src/types.ts | Removes legacy transcript/message/part type system from app-level types. |
| packages/app/src/pages/session/use-session-hash-scroll.ts | Updates hash-scroll helpers to work with SessionMessageUser instead of legacy UserMessage. |
| packages/app/src/pages/session/use-session-commands.tsx | Updates revert/stage flows to restore prompts from SessionMessageUser and rehydrate comment context. |
| packages/app/src/pages/session/timeline/timeline-row.ts | Adds Shell timeline row type and keying for shell rows. |
| packages/app/src/pages/session/timeline/rows.ts | Rebuilds timeline row construction around current messages/content refs; adds content grouping and message-comment extraction from metadata. |
| packages/app/src/pages/session/timeline/rows-current.test.ts | Rewrites timeline row tests to directly use current session messages (including shell + assistant-only cases). |
| packages/app/src/pages/session/timeline/projection.ts | Removes legacy message/parts projection inputs; adds user-context projection (agent/model) derived from current stream/metadata. |
| packages/app/src/pages/session/timeline/model.ts | Updates “timeline ready” logic to consider user or shell roots in current messages. |
| packages/app/src/pages/session/timeline/model.test.ts | Updates model tests for current message shapes and revert boundary behavior. |
| packages/app/src/pages/session/timeline/message-timeline.tsx | Switches timeline rendering to resolve current content at render time; integrates shell row rendering and new “current-message” adapters. |
| packages/app/src/pages/session/timeline/current-message.tsx | New adapter components bridging current protocol messages/content into existing session-ui DOM renderers. |
| packages/app/src/pages/session/timeline/controller.tsx | Removes legacy parts plumbing; derives task descriptions from current assistant tool content. |
| packages/app/src/pages/session/timeline/controller-projection.ts | Adds visibleTimelineMessages to hide queued inbox items and apply revert boundary to current messages. |
| packages/app/src/pages/session/timeline/controller-projection.test.ts | New tests covering queued-input hiding and revert-boundary filtering for current messages. |
| packages/app/src/pages/session/session-model-helpers.ts | Narrows session restore payload to only the fields needed (sessionID/agent/model). |
| packages/app/src/pages/session/session-model-helpers.test.ts | Updates tests for the narrowed session restore payload shape. |
| packages/app/src/pages/session/session-domain.ts | Updates helpers to select/trim SessionMessageUser from current messages and apply revert boundary. |
| packages/app/src/pages/session/session-controller.ts | Updates session controller to store current session messages/user messages instead of legacy transcript messages. |
| packages/app/src/pages/session/session-controller.test.ts | Updates controller invariant tests for current message shapes. |
| packages/app/src/pages/session/composer/session-composer-state.ts | Switches composer computations to read from serverSync.session.data.message (current messages). |
| packages/app/src/pages/session.tsx | Removes turn-diff mode; updates session model sync + draft restoration to use current user messages + metadata. |
| packages/app/src/pages/directory-layout.tsx | Passes a session-ui-focused subset of sync data to DataProvider to match new optional legacy fields. |
| packages/app/src/context/server-session.ts | Removes legacy part/message projection store; uses current messages only and updates pending inbox projection metadata. |
| packages/app/src/context/server-session-v2-reducer.ts | Ensures session.text.ended updates include state from the event. |
| packages/app/src/context/prompt-state.ts | Inlines FilePartSource types locally after removing legacy app transcript types. |
| packages/app/src/context/global-sync/types.ts | Updates global sync state types to store current messages and includes pending/input collections. |
| packages/app/src/context/global-sync/session-cache.ts | Updates session cache eviction/cleanup for current message arrays (removes part caches). |
| packages/app/src/context/global-sync/session-cache.test.ts | Updates cache tests for the new current-message-only cache shape. |
| packages/app/src/context/global-sync/event-reducer.ts | Removes reducers for legacy message/part events and associated cleanup logic. |
| packages/app/src/context/global-sync/event-reducer.test.ts | Removes tests that exercised legacy message/part reducers and part-only cleanup. |
| packages/app/src/context/global-sync/child-store.ts | Updates child store initialization to include pending/input instead of legacy part stores. |
| packages/app/src/context/directory-sync.ts | Updates synced session field set to include pending/input and remove legacy part-related fields. |
| packages/app/src/components/session/session-context-tab.tsx | Updates raw message view and context breakdown computation to operate on current messages (no parts), removes system-prompt rendering. |
| packages/app/src/components/session/session-context-metrics.ts | Updates context metrics to read provider/model/tokens from current assistant messages. |
| packages/app/src/components/session/session-context-metrics.test.ts | Updates tests for current assistant/user message shapes. |
| packages/app/src/components/session/session-context-breakdown.ts | Updates token breakdown estimation to use current message content instead of legacy parts. |
| packages/app/src/components/session/session-context-breakdown.test.ts | Updates tests for breakdown estimation against current message shapes. |
| packages/app/src/components/prompt-input/submit.ts | Adds metadata (displayText/comments/agent/model) to followup draft sends for prompt restoration parity. |
| packages/app/src/components/prompt-input/submit.test.ts | Updates submit tests to assert metadata is included in the message send payload. |
| packages/app/src/components/prompt-input.tsx | Updates “has history” logic to check SessionMessageInfo.type === "user" rather than legacy role. |
| packages/app/src/components/dialog-fork.tsx | Restores fork prompt state from SessionMessageUser (including comment context) instead of legacy parts. |
| packages/app/e2e/regression/session-timeline-transport.spec.ts | Updates transport regression tests to the new “current event adaptation” + content-id mapping and acknowledgement counts. |
| packages/app/e2e/regression/session-timeline-reducer-projection.spec.ts | Updates selectors to new part/content IDs for current messages. |
| packages/app/e2e/regression/session-timeline-lifecycle-state.spec.ts | Updates selectors to use adapted current content IDs in lifecycle regression tests. |
| packages/app/e2e/regression/session-timeline-history-root.spec.ts | Replaces legacy “message.updated” test event with current session.step.* event payloads. |
| packages/app/e2e/regression/session-timeline-context-resize.spec.ts | Updates test events from legacy part updates to current tool success events. |
| packages/app/e2e/regression/session-timeline-collapse-state.spec.ts | Updates collapse-state regression tests to stream current text events and use current content IDs. |
| packages/app/e2e/performance/timeline-stability/fixture.ts | Adapts legacy timeline events into current session events, adds content-id mapping helpers, and updates transport harness APIs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Hona
force-pushed
the
current-session-model
branch
from
August 18, 2026 01:49
bdb6c62 to
438de4a
Compare
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 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.
Issue for this PR
Not required for this refactor.
Type of change
What does this PR do?
The shared client data layer now owns the V2 session transcript for both TUI and Desktop. This change removes Desktop's remaining full-transcript conversion into legacy
MessageandPartstores.The timeline derives current message and content references directly from shared
SessionMessageInfo[], renders shell messages as native rows, and converts only visible content at the existing DOM renderer boundary. Prompt display metadata, comment restoration, undo/redo prompt reconstruction, and current context views use the current message schema.It also deletes the unused App sync overlay, dead context metric helpers, and unreachable diff-summary rows.
How did you verify your code works?
bun typecheck --forceinpackages/appbun typecheckinpackages/session-uibun typecheck:e2einpackages/appbun run test:unitinpackages/app: 551 passedbun run test:browserinpackages/app: 44 passedbun testinpackages/session-ui: 87 passedThe local workspace pre-push hook also reached unrelated Node
node:sqliteand Buffer type errors inpackages/coreandpackages/cli; clean CI is running the workspace checks.Screenshots / recordings
No visual design change.
Checklist