Repository navigation
fix(transcript): keep a delivered prompt above the reply it triggers - #1415
Conversation
pascalandr
left a comment
There was a problem hiding this comment.
@heunghingwan I reviewed 038e783aa. The SDK does move an admitted prompt to the tail on delivery, but the row following an enqueued prompt does not establish its native delivery order. Four P2 findings block this approach; the ordinary-order reproductions pass on the base and regress on this head.
P2: the captured follower can reverse native message order
packages/ui/src/stores/opencode-data.ts:344-348,354-364
Two prompts enqueued as steers and delivered before their reply produce native/reducer order [Q1,Q2,reply], but this projection produces [Q2,Q1,reply]. This reproduces both with synchronous projection and frame coalescing, including the real browser. A private native 2.2.6 run also confirmed the three-steer version: its authoritative page held [Q1,Q2,Q3,assistant], while replaying its actual events through this head displayed users [Q3,Q1,Q2].
Another case: enqueue Q during an existing turn, start its next assistant step A2, then deliver Q. The native/reducer order is [A1,A2,Q]; the projection changes it to [A1,Q,A2]. A shell, compaction or interrupted/idle follower can likewise be earlier work rather than Q's reply.
Please restore only relationships established by authoritative native order; otherwise reconcile the message page on delivery, coalescing requests. Raw enqueue position cannot identify the reply. Message IDs/timestamps are not a replacement ordering authority either: #1294 deliberately preserves incoming native page order.
P2: authoritative reducer replacement retains obsolete anchors
packages/ui/src/stores/opencode-data.ts:79,327-331
The map belongs to TranscriptEntry, but replaceTranscriptEntry replaces only its DataEntry. A pruning resync that returns authoritative [previous-step,Q] is immediately projected as [Q,previous-step] by an anchor left from the old reducer.
Please drop obsolete ordering state when accepting an authoritative replacement. Clearing the map at that boundary makes the independent reproduction pass.
P2: verified reconnect loses the correction but keeps the corrupted reducer order
packages/ui/src/stores/opencode-data.ts:319,436-464
- Establish the late-admission case covered by the PR: reducer
[reply,user], display[user,reply]. - Admit a same-daemon
server.connected. - Continue streaming.
Reconnect captures raw reducer rows, destroys the anchors and seeds [reply,user] again. The next projection sinks the prompt below its reply. Continuous streaming postpones the quiet authoritative reconciliation.
Please preserve corrected order across verified continuity seeding, for example by capturing a corrected row-list clone. Authoritative replacement should still discard obsolete corrections.
P2: the new browser file fails the fixture-wiring gate
packages/ui/tests/browser/inbox-delivery-order.test.ts:18
It starts its own Vite server without borrowing the shared fixture or registering an exemption. fixture-wiring.test.ts fails locally, and the same PR-caused failure is present in browser shard 1 of run 42578736671.
Please use borrowFixture; an owned server instead needs a justified exemption and heavy-tier registration.
P3: the fixture immediately closes its EventSource response
packages/ui/tests/browser/inbox-delivery-order.test.ts:48
An empty text/event-stream response ends immediately, causing EOF/reconnect rather than a persistent fixture stream. Please use fixtureEventStream and keep console/network error collection strict.
Validation
UI typecheck and 377 focused store tests across 33 files pass twice. The new browser file passes three runs; streaming projection, tool images, compaction responsiveness, focused history/scroll cases and session rendering also pass. Independent ordering/lifetime probes expose the regressions despite those green suites.
The new browser test catches disabling restoration or capturing after delivery, but still passes when anchor consumption is removed or authoritative-replacement cleanup is added: multiple deliveries, replacement and reconnect need explicit regressions.
The Ubuntu WebKit failure is separate: AppImage bundling received HTTP 504 downloading AppRun-x86_64 from GitHub. That does not explain the fixture-wiring failure above. Merge checks against current dev and #1414 were clean.
|
@pascalandr Thank you for the thorough review — all four P2s and the P3 are addressed in 8af56a7. P2 (order restored only from authoritative native order): the per-transcript anchor map is gone entirely. A P2 (obsolete anchors across replacement) and P2 (reconnect losing the correction): both dissolve with the state removal — the read heals the reducer itself, so P2 (fixture wiring) and P3: the browser file now borrows the shared fixture, launches through Validation: 235 focused store tests, UI typecheck, the wiring gate, the three borrowed-fixture runs and the 48-test session-rendering suite. One honest note: your probes confirm the base already renders the daemon's ordinary delivery orders correctly, so the original two-terminal report this PR started from likely has a different mechanism — my best candidate from reading the server relay is |
pascalandr
left a comment
There was a problem hiding this comment.
@heunghingwan I re-reviewed 8af56a77. Moving the authority to the native page fixes the ordering findings: two/three steers (including the replay of recorded native 2.2.6 events), and prior assistant, shell, compaction and idle followers all keep native order before and after the read. Authoritative replacement passes, the fixture now borrows the shared server with a persistent event stream, and tail-only delivery issues zero reads. Three lifetime/gating issues around the asynchronous repair remain; each reproduces on this head.
P2: the repair's completion bypasses the display-window gates
packages/ui/src/stores/opencode-data.ts:349-351, publishing at :1010
- Keep a reducer with parked
q1,q2while the session displays a history window containing onlyhistory. - Deliver
q1and hold its read; then resolve it.
The live dispatcher correctly leaves the history window alone, but the completion calls projectOpenCodeMessages directly and turns that window's membership into [history,q1,q2] while keeping its history cursors. The same happens after switching to another session.
Please publish through the existing gated projection path (active-session/latest-window gates), as live events do. A scratch change routing it through the scheduler passes both gate probes.
P2: normal settlement retires the reducer under an outstanding repair
packages/ui/src/stores/opencode-data.ts:947-960
- An interrupted-turn read returns
[old,idle,user,reply]before the delivery SSE arrives (a genuine HTTP-ahead crossing). - Delivery moves
userbelowreplyand starts the repair read. - Hold that read; admit
step.endedandexecution.succeeded. - Resolve the read.
With nothing pending in the inbox and no unsettled rows, retireDrainedTranscript destroys the reducer before the read completes, so the display stays [old,reply,user]. This fails standalone and with #1414 merged.
Please treat the owed read as a retirement barrier. Checking #1414's entry-scoped pending read in the retirement guard makes this probe pass.
P2: verified reconnect abandons a pending repair behind the quiet timer
packages/ui/src/stores/opencode-data.ts:417-450, opencode-reconnect.ts:49-76
- Hold a delivery repair while reducer/display order is
[reply,user]. - Admit a verified same-daemon
server.connected. - Keep streaming deltas every 500 ms; complete the abandoned old read.
After five simulated seconds no replacement read has started and the order is still [reply,user]: continued activity keeps postponing the quiet reconciliation.
Please carry the outstanding repair demand across verified reconnect and resume it after seeding instead of relying only on the quiet timer.
P3: the browser fixture only collects page exceptions
packages/ui/tests/browser/inbox-delivery-order.test.ts:36
Please also fail on request failures, HTTP errors and console errors, as the neighboring fixtures do.
Scope and test coverage
The genuine bug this fixes is the HTTP-ahead crossing above: base sinks the delivered user below a reply already received over HTTP, and this head repairs it while the reducer lives. The three authored browser tests and the burst store test also pass on base and with delivery reconciliation disabled, so they do not protect that fix. Only the reconnect store test fails on base, and it forces the page/event relationship. Please add a regression for the natural crossing (an interrupted-turn or settlement read carrying the newer delivered user and reply before their SSE), plus the settlement-during-repair and reconnect-during-repair lifetimes.
I agree the original two-terminal report is not demonstrated by this PR. The unresolved-location relay drop is worth a separate investigation with a reproduction.
#1414 interaction
Merging with the approved #1414 head (08699226) gives two textual conflicts around the post-emission hooks. Resolved in scratch, both reconciliations work, and #1414's promise-following fixes this helper publishing read A while a queued read B is outstanding. It does not fix the three P2s above. Rebasing after #1414 lands, on its completeSettlementRead, is probably the simplest path.
Validation
UI typecheck passes standalone and combined with #1414. Focused units pass 378/378 twice standalone and 384/384 twice combined. The delivery browser file passes three runs; fixture wiring, streaming projection, tool images, compaction responsiveness and session rendering (48/48) pass. Two/three-steer bursts coalesce to two reads; 100 deltas during a held repair keep their text with no extra reads; full-window queued replay reconciliation passes.
The current CI run is still waiting at authorize, so it has no results for this head yet.
|
@pascalandr All three P2 lifetimes and the P3 are addressed in 5cd1a05. Gated publication: the repair's completion now publishes through Retirement barrier: an outstanding repair read now blocks Reconnect carry-over: the reconnect capture records the outstanding demand ( Coverage: the natural HTTP-ahead crossing now has the regression you asked for — an interrupted round's held settlement read returns the page with the delivered prompt above its reply, the delivery's own SSE then lands late ( I'll rebase onto #1414's |
pascalandr
left a comment
There was a problem hiding this comment.
@heunghingwan I re-reviewed 5cd1a058. The history-window and inactive-session gates hold (an inactive refusal also invalidates the loaded flag), the held repair now survives settlement, and reconnect resumes the repair during continuous streaming. The new HTTP-ahead regression fails on base with a feasible page/SSE crossing. One lifetime issue remains in the new retirement barrier.
P2: a completed repair leaves the settled reducer resident
packages/ui/src/stores/opencode-data.ts:362-363, :974-975, :1049
- Hold the delivery repair.
- Admit the round's settlement.
- Complete, reject or abort the repair.
- Deliver no further native event.
completeSettlementRead calls retireDrainedTranscript at :1049 while deliveryRepairPending is still above zero, so retirement refuses. The caller's finally at :363 then decrements the counter but never retries retirement. In all three outcomes the reducer stays resident with its rows (five in the probe) instead of retiring; with an animation frame held, the retirement flush never happens either.
Please retry retireDrainedTranscript right after decrementing, in the same finally; its current-transcript guard already protects abandoned scopes. With that one addition, the combined probe set (with #1414 merged) goes from 25/29 to 29/29.
P3: the receipts-abort exclusion hides unrelated failures
packages/ui/tests/browser/inbox-delivery-order.test.ts:38-40
Any /permission-receipts request failing with net::ERR_ABORTED is ignored without correlating it to an owned cancellation; a probe that issued and aborted an unrelated receipts request went unrecorded. Please remove the exclusion or match the exact owned cancellation, as neighboring fixtures do.
P3: no authored test protects the publication gates
Reversing gated publication fails both independent gate probes, but the authored delivery/reconnect tests all still pass. Please add history-window and inactive-session completion regressions.
Checked
Session deletion, instance removal and eviction during a repair or during reconnect seeding; different-daemon and unattributed reconnects (no carried repair); authoritative replacement with the preceding read held; tail-only delivery (zero reads); two/three-steer bursts (two coalesced reads); 100 deltas during a held repair (no extra reads, no lost text). Independently reversing the retirement barrier or the reconnect resumption fails both the independent probe and the authored test.
With #1414 (08699226) merged in scratch, conflicts resolve by keeping the gated options and the returned Promise used by the repair counter. Combined units and typecheck pass; #1414 does not fix the retirement issue above.
Validation
UI typecheck passes standalone and combined. Focused units pass 380/380 twice standalone and 386/386 twice combined. The delivery browser file passes three runs; fixture wiring, streaming projection, tool images, compaction responsiveness and session rendering (48/48) pass. Merge with current dev is clean. The CI run for this head was still waiting at authorize when inspected.
|
@pascalandr Both remaining items are addressed in c0412d1. Retirement retry: the repair counter's Gate regressions: two authored cases in Receipts exclusion: removed; the strict collection passes the delivery browser file across repeated runs without it. Validation: 253 focused store tests, UI typecheck, delivery browser file twice with strict request/HTTP/console error collection. |
pascalandr
left a comment
There was a problem hiding this comment.
@heunghingwan I re-reviewed c0412d1f. The retirement retry fixes the resident reducer: complete, reject and abort all retire without another event, and the active-session retirement frame flushes. The receipts exclusion is gone (an injected foreign abort is now caught), and reversing the publication gates kills both new gate tests. One interaction of the retry with the frame gates remains.
P2: the retirement retry publishes an inactive session's repair
packages/ui/src/stores/opencode-data.ts:369,986, with opencode-projection-frame.ts:112,178-181
- Hold a delivery repair while an animation frame is pending.
- Settle its execution.
- Switch to another session.
- Resolve the repair.
The repair correctly schedules a gated frame, but the retry then reaches retireDrainedTranscript, whose flushTranscriptProjections(instanceId, sessionId) drains with bypassActiveGate = true. The inactive session's display is rewritten instead of invalidated ([old,idle,reply,user,idle] becomes [old,idle,user,reply,idle]) and it stays marked loaded, so its next activation can skip the authoritative read. Reproduced standalone and with #1414 merged.
Please let the retirement flush respect the active-session gate (invalidating an inactive session as a normal frame does) while keeping the selection-change flush unchanged. A scratch version doing that passes the full 33-probe set and 388 combined units, including active-session retirement flushing.
P3: no authored test covers retirement after the repair
Removing the new retry leaves the five selected authored tests green, while independent complete/reject/abort and held-frame probes all fail. Please assert that the settled reducer retired after the repair completes, not only the displayed order.
Checked
Another outstanding or coalesced repair blocks early retirement; a newer execution keeps its reducer; repeated retirement checks are harmless; rotation and queued settlement release correctly; deleted, removed, evicted and abandoned reconnect scopes stay fenced; different-daemon and unattributed reconnects carry nothing; an ordinary inactive completion invalidates the loaded flag.
Validation
UI typecheck passes standalone and combined with #1414. Focused units pass 382/382 twice standalone and 388/388 twice combined. The delivery browser file passes three runs with the strict collector; fixture wiring, streaming projection, tool images, compaction responsiveness and session rendering (48/48) pass. Merge with current dev is clean. The CI run for this head had just started (no failures yet) when inspected.
|
@pascalandr Both items are addressed in 87c035a. Scoped flush behind the gate: Retirement assertion: the HTTP-ahead regression now also asserts the settled reducer retired once the repair settled — the probe event lands on a fresh reducer holding only its own row. Receipts aborts: the exclusion is now an exact owned-cancellation match: an aborted receipts read is tolerated only when a later read for the same message superseded it (the cache's own join-and-abort); any other abort still fails the test. Validation: 253 focused store tests, UI typecheck, the delivery browser file twice with the strict collector. |
pascalandr
left a comment
There was a problem hiding this comment.
@heunghingwan I re-reviewed 87c035a9. The projection side is done: an inactive session's retirement now invalidates its loaded page instead of rewriting it, and removing the retirement retry now fails your HTTP-ahead regression. I also audited every flushTranscriptProjections caller for #1289's selection-flush contract: selection writes (session-state.ts:708) and the visibility listener stay unscoped, retirement is the only session-scoped caller, and nothing uses the instance-only form; the frame suite's switch-flush test and the hidden/visible probes still pass. One test-reliability issue blocks.
P2: the receipts-cancellation matcher flakes and accepts foreign aborts
packages/ui/tests/browser/inbox-delivery-order.test.ts:41-55,73-75
- In my three runs, run 2 failed "a steer burst delivered while parked keeps the native page order" with
permission-receipts?messageId=msg_b3 net::ERR_ABORTED, while the transcript order was correct. The abort is numbered when it fails (:54), not when its request was issued, so a successor sent between the original request and its failure is not counted as later. - An injected foreign abort was silently accepted when an unrelated later request in another workspace reused the same
messageId. AmessageIdplus any later request does not establish ownership; the receipts cache also cancels when its last subscriber releases, without a successor.
Please correlate the exact request with its owning AbortSignal (the pattern in panel-read-fixture.ts), or stub the receipts read so the fixture never cancels it, keeping foreign and unclassified failures strict. Flaking in CI would mask real failures in this suite.
Validation
UI typecheck passes standalone and combined with #1414. Focused units pass 382/382 twice standalone and 388/388 twice combined; the projection-frame file passes 14/14. The full probe set passes 35/35 with #1414 merged (34/35 standalone, the remaining one being the A/B publication timing #1414 fixes). Independently restoring the scoped bypass fails the inactive-retirement probe; removing the retry fails the authored regression and all independent retirement probes. Fixture wiring, streaming projection, tool images, compaction responsiveness, session rendering (48/48) and history window-switch cases (8/8) pass. Merge with current dev is clean; #1414 still needs the helper/test conflict resolution. The CI run for this head was still waiting at authorize when inspected.
|
@pascalandr Addressed in c612d06: the receipts matcher now correlates the exact request with its own AbortSignal, following the panel-read pattern. The fixture tags each receipts read's fetch with a per-read header and records whether its own signal fired ( Validation: the delivery browser file passes three consecutive runs with the strict collector; session rendering (48/48) and UI typecheck unchanged. |
A client watching a session that another client prompted showed the sent message hanging at the very bottom, below the streaming reply: with two pages open, the prompt arrived through session.inbox.enqueued, the reply's assistant row was appended while the prompt was still parked, and session.inbox.delivered then answered by moving the prompt's row to the reducer's tail — below its own reply. Every later live projection carried that order, so the message stayed sunk until an authoritative read replaced the reducer. Record, at delivered admission, the reducer row that followed the prompt's row; live projections restore each delivered prompt directly above that row, which matches the native page order (verified against the running service's message list). The record lives on the transcript entry and is consumed once both rows hold that order or either is gone; parked prompts and queued deliveries render exactly as before. Validation: a new browser test through the real SessionView and native dispatcher covers both the faithful admission order and admission after the reply started streaming (failed on dev, passes now); 253 focused store tests, UI typecheck and the session-rendering browser suite stay green.
Review of 038e783 (thanks @pascalandr): the recorded follower of an enqueued prompt does not establish its native delivery order — with two steers the restored pair reversed the page order, an authoritative replacement kept projecting an obsolete anchor, and a verified reconnect re-seeded the corrupted order the correction no longer covered. The new browser file also spun its own Vite server, failing the fixture-wiring gate in shard 1. The native message page owns a delivered prompt's position. A delivery that relocates a row which is not the reducer's last (the SDK's tail move) now owes an authoritative read: the message key is invalidated and the read finishes exactly like a settlement read — shared with any in-flight one, published under the same newer-execution fence. No ordering state survives the delivery; the reducer itself is healed, so reconnect seeding and authoritative replacement carry the corrected order. The ordinary idle-session delivery stays at the tail and reads nothing. The browser test now borrows the shared fixture, keeps a persistent fixture event stream, and drives the daemon's real event order: a parked steer burst reconciles to [Q1,Q2,Q3,reply], a mid-stream admission settles after the earlier reply per the page, and an idle prompt renders above its reply. Store regressions cover the burst, the pruning-shaped replacement and a verified reconnect. Validation: 235 focused store tests, UI typecheck, the fixture-wiring gate, the three borrowed-fixture runs and the 48-test session-rendering suite all pass.
…-over of a live read Review of 8af56a7 (thanks @pascalandr): the delivery repair's completion published directly, ignoring the active-session and latest-window gates live projections pass through, so a repair landing on a history window rewrote that window's membership; a drained settlement destroyed the reducer beneath an outstanding repair, leaving the sunk prompt unreconciled; and a verified reconnect abandoned a pending repair behind the quiet timer, which continued streaming kept postponing. The repair now publishes through the instance layer's frame gates (a gate-free context keeps the direct projection), its outstanding read is a retirement barrier beside parked prompts and unsettled rows, and reconnect carries the demand: the capture records it, the seeded page resuming it immediately after it lands. The natural HTTP-ahead crossing — a settlement read returning the delivered prompt above its reply before the delivery's own SSE arrives — now has a regression that fails on the base (the late delivery sinks the prompt below the reply), plus settlement-during-repair and reconnect-during-repair lifetime regressions, and the browser fixture fails on request, HTTP and console errors like its neighbors. Validation: 211 focused store tests, UI typecheck, the fixture-wiring gate, the three borrowed-fixture runs with strict error collection.
…ttles Review of 5cd1a05 (thanks @pascalandr): the repair counter's decrement ran after the read's own publication pass, whose retirement check still saw the barrier — so a reducer whose round had settled stayed resident with its rows after the repair completed, rejected or aborted, and no later event existed to retry the retirement. The counter's finally now retries retireDrainedTranscript right after decrementing; abandoned scopes stay protected by the current-transcript guard. The receipts-abort exclusion in the browser fixture is gone (the strict collection passes without it), and the publication gates gain authored regressions: a repair completing over a history window keeps that window's membership and cursors, and a repair completing for an inactive session leaves its display to the next activation read. Validation: 253 focused store tests, UI typecheck, the delivery browser file twice with strict request/HTTP/console error collection.
…gate Review of c0412d1 (thanks @pascalandr): the retirement retry's scoped flush drained with the active gate bypassed, so a repair settling for an inactive session rewrote its display and left it marked loaded — the next activation could then skip the authoritative read. A scoped flushTranscriptProjections now keeps the gate: an inactive session's pending page is invalidated for its next activation read exactly as a normal frame does, while the unscoped selection-change flush still lands pages admitted under the previous selection. The HTTP-ahead regression now also asserts the settled reducer retired once the repair settled (the next event lands on a fresh one), and the browser fixture correlates receipts aborts to the cache's own supersession — an abort with no successor read for the same message still fails the test. Validation: 253 focused store tests, UI typecheck, the delivery browser file twice with strict error collection.
Review of 87c035a (thanks @pascalandr): the successor-read heuristic both flaked (an abort is numbered when it fails, so a successor issued between request and failure was missed) and accepted a foreign abort whose messageId an unrelated later request reused — and the cache also cancels on last-subscriber release, with no successor at all. The fixture now tags each receipts read's fetch with a per-read header and records whether its own AbortSignal fired (the panel-read pattern); the test tolerates exactly an abort whose tagged request the cache's signal owned, and every foreign or unclassified failure stays an error. Validation: the delivery browser file passes three consecutive runs with the strict collector; session rendering (48) and UI typecheck unchanged.
Rebase onto NeuralNomadsAI#1414 (9f00cff) surfaced an ordering hazard in the merged completeSettlementRead: the SDK read promise settles one microtask hop before the publishing chain (which passes through .catch), so a caller holding obligations on the returned promise — the delivery repair's counter decrement and retirement retry — ran its retirement before the chain published, destroying the reducer and fencing out the repair's publication. completeSettlementRead now records and returns the publishing chain itself; the shared in-flight path returns the recorded chain, and replaceTranscriptEntry releases it with the other read state. Validation: 259 focused store tests on the rebased tree, UI typecheck, the delivery browser file and the fixture-wiring gate.
c612d06 to
b24e23b
Compare
|
@pascalandr Rebased onto #1414 ( The merge surfaced one ordering hazard worth noting: #1414's publishing chain passes through |
…ad publishes A delivery repair settles its counter when the read chain it started ends. When a later settlement (an execution terminal event, or an observed settlement followed by one) invalidates beneath that read, the SDK starts a trailing read that owns the publication; the repair's chain then ends early and its retirement retry destroyed the reducer before the trailing read published. A tool whose terminal event was missed stayed visibly running even though the authoritative page had it completed. Retirement now also waits while a reconciliation read is pending for the current reducer; that read's own completion retries retirement after it publishes. The browser fixture's receipts-cancellation check also handles a verification that cannot complete (page closed or navigated) by keeping the original failure instead of rejecting unhandled. Test: a queued delivery repair superseded by the round's settlement read keeps the reducer until the trailing read publishes the completed tool; removing the retirement guard fails it.
|
@pascalandr Thanks for the direct fixup (32d0308) — fast-forwarded locally and verified: the settlement/reconnect/data suites (59), the delivery browser file with the hardened receipts check, and the HTTP-ahead crossing regression all pass on that head. The trailing-read retirement barrier reads right to me: the superseding read owns the publication, so the reducer owes it residency. |
|
thanks @heunghingwan !! |
Problem
With two clients open on the same session, sending a prompt from one left the other client showing that message stuck at the very bottom of the transcript, below the streaming reply, for the rest of the run.
Root cause
OpenCode V2 has no
message.updated: a prompt sent by another client reaches every client throughsession.inbox.enqueued(which materializes the user row and parks it in the session inbox), andsession.inbox.deliveredclears it. The SDK reducer's delivery handler answers by moving the prompt's row to the tail of its message list.When the reply's assistant row was appended between the prompt's enqueue and its admission — a real window, confirmed by recording a live service's event stream (
enqueued → execution.started → …engine startup… → delivered → step.started) — that tail-move sinks the prompt below its own reply, and every subsequent live projection carries the wrong order until an authoritative read replaces the reducer. The service's own message page orders the pair correctly ([user, assistant]); the demotion is purely client-side.Fix
stores/opencode-data.tsrecords, atsession.inbox.deliveredadmission, the reducer row that followed the prompt's row at that moment (per-transcriptdeliveredPromptAnchors). Every live projection restores each delivered prompt directly above its recorded row — matching the native page order — and consumes the record once both rows hold that order or either is gone. Anchors live on the transcript entry, so an authoritative resync (which replaces the reducer) drops them naturally.Parked prompts and queued-delivery flows are unchanged: for the still-parked case the transcript already re-appends pending prompts for display, so the projected order change is invisible there.
Validation
tests/browser/inbox-delivery-order.test.tsthrough the realSessionViewand native event dispatcher, covering both the faithful admission order and admission landing after the reply started streaming (the repro — fails ondev, passes with the fix), plus fixture helpers reproducing the daemon's real event choreography.origin/dev), UI typecheck, and the 48-test session-rendering browser suite all green.dev-docs/TRANSCRIPT.mdordering convention updated.