Repository navigation
Description
What happened
A task row in the sidebar can flip Responding → just now → Responding within ~170 ms right after a send. Seen in the real app on a first send in a new task: the row showed the running indicator, dropped to the idle timestamp, then showed the running indicator again.
The catalog orders rows only by the persisted revision, but runningTurnIds is unversioned live state layered onto the row at read time. Starting or ending a Turn does not change revision, so two reads of the same row can carry different live state with nothing to order them:
- Real app, three first sends reading
sessions.geton everysessions:changed: the samerev=1came back withrunningTurnIds=[]in one run andrunningTurnIds=["0f3e…"]in the others. isStaleSummary(apps/desktop/src/renderer/application/contracts/session-catalog/session-catalog-state.ts) rejects onlyprior.revision > next.revision; on equal revisions the later commit wins.- A first send fires a full
refreshSessions()right after submit (app-shell-chat-actions.ts) whilesessions:changedpatches are draining. A list read taken before the Turn started that lands after a patch that carried the running Turn puts the row back to idle until the next status patch (rev=3) restores it.
The same shape applies at the other end (a refresh read before completion landing after it) and to any concurrent reader: other windows, bot channels, the complete/abort/error refreshes.
Main already works around one direction of this: toDesktopHostSessionListSummary (runtime-host-session-catalog-ipc-main.ts) unions the observer's running Turn into every list and get result (#3189).
How to reproduce
Timing dependent. Send a first message in a new task and watch the new sidebar row; logging the row's signal every painted frame alongside sessions.get results shows the equal-revision / different-live-state pair on most runs, and the visible flip on some.
Proposed fix
Give live run state an order at its authority:
- Runtime Host: the session manager keeps a per-Session counter bumped when a Turn starts and when it ends, projected in
SessionCatalogLiveRunState(which already carriesschemaVersion). - Renderer catalog: on equal
revision, compare that counter and drop the older row. - Main: remove the observer union from
toDesktopHostSessionListSummaryif the ordered projection makes it redundant.
A Host that does not send the counter keeps today's behaviour.
Not chosen: removing the post-send refreshSessions() (removes one trigger, not the race); preferring the renderer's execution projection in the sidebar (covers only observed sessions and adds a precedence rule).
Activity
ggbdpq commentedon Sep 26, 2026
take
github-actions commentedon Sep 26, 2026
Issue #5713 is already assigned to Astro-Han, so it was not reassigned.
feat(runtime,desktop): order same-revision catalog reads by a run epoch
feat(runtime,desktop): order same-revision catalog reads by a run epoch
fix(runtime,desktop): order catalog reads across a Host restart by ho…
fix(runtime,desktop): order same-revision catalog reads by a run epoch (