fix(tui): preserve prompts during session hydration#36433
Open
kitlangton wants to merge 1 commit into
Open
Conversation
kitlangton
force-pushed
the
fix-initial-message
branch
2 times, most recently
from
July 11, 2026 18:45
d44a729 to
0b1662f
Compare
This was referenced Jul 13, 2026
kitlangton
force-pushed
the
fix-initial-message
branch
from
July 15, 2026 19:06
37c017d to
c78a0ba
Compare
kitlangton
force-pushed
the
fix-initial-message
branch
from
July 15, 2026 19:20
c78a0ba to
17753e6
Compare
kitlangton
force-pushed
the
fix-initial-message
branch
from
July 18, 2026 00:51
17753e6 to
00ad2be
Compare
kitlangton
added a commit
that referenced
this pull request
Jul 18, 2026
Port of #36433 onto the quark timeline branch: pending operations journal, pending-derived inputs, and hydration that reappends admitted-but-unprojected prompts. Composed with part-collection reseeding.
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.
What
Prevent the V2 TUI from dropping the first user prompt when a new Session opens while that prompt is promoted from pending work into projected history. The submitted prompt remains visible through initial hydration and reconnect hydration.
Closes #35988.
Before / After
Before
The Session row owner requested pending work and projected messages independently. Promotion could occur between those snapshots:
A gated OpenCode Drive reproduction now confirms that exact visible failure against the pre-fix parent: the real TUI shows the simulated assistant response and timing metadata, but no preceding user prompt.
After
One message-hydration operation owns the sequence: reconcile pending work first, then load projected history. Pending work is the only source of pending-input identity, and admissions/promotions received during either request are replayed over the snapshot. Projected hydration retains both the reconciled pending rows and live inputs received while history loads.
The identical gated Drive scenario passes against this branch and retains both transcript rows.
How
packages/tui/src/context/data.tsxkeeps one authoritative pending store;session.inputis derived rather than separately synchronized.session.message.syncowns pending-first ordering, so callers cannot accidentally reintroduce parallel snapshot reads.packages/tui/src/routes/session/rows.tsinvokes the single message hydration operation and relies on existing reactive row reduction.Scope
Testing
bun run testfrompackages/tui: 267 passed, 1 skipped.bun typecheckfrompackages/tui: passed.Expected: "user",Received: undefined.initial message disappeared; final frame is assistant-first.The Drive trace forced this valid production ordering:
Flow
sequenceDiagram participant Events as Session events participant TUI as TUI data store participant Pending as Pending API participant Messages as Message API TUI->>Pending: Load pending work Events-->>TUI: Journal admissions/promotions/reverts Pending-->>TUI: Install snapshot with journal replayed TUI->>Messages: Load projected history Events-->>TUI: Retain live input rows Messages-->>TUI: Install projected + pending/live rows by durable ID