You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Astro-Han (via GitHub)" <gi...@apache.org> on 2026/09/25 05:24:23 UTC

[I] bug(desktop): sidebar running state flips back to idle when two catalog reads race [maka]

Astro-Han opened a new issue, #5713:
URL: https://github.com/apache/maka/issues/5713

   ### 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.get` on every `sessions:changed`: the same `rev=1` came back with `runningTurnIds=[]` in one run and `runningTurnIds=["0f3e…"]` in the others.
   - `isStaleSummary` (`apps/desktop/src/renderer/application/contracts/session-catalog/session-catalog-state.ts`) rejects only `prior.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`) while `sessions:changed` patches 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:
   
   1. Runtime Host: the session manager keeps a per-Session counter bumped when a Turn starts and when it ends, projected in `SessionCatalogLiveRunState` (which already carries `schemaVersion`).
   2. Renderer catalog: on equal `revision`, compare that counter and drop the older row.
   3. Main: remove the observer union from `toDesktopHostSessionListSummary` if 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).
   
   ### Environment
   
   Desktop dev build on `main` at 99cfeb7e9 and on #5710; macOS.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] bug(desktop): sidebar running state flips back to idle when two catalog reads race [maka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #5713:
URL: https://github.com/apache/maka/issues/5713#issuecomment-5847106671

   Issue #5713 is already assigned to Astro-Han, so it was not reassigned.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] bug(desktop): sidebar running state flips back to idle when two catalog reads race [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han closed issue #5713: bug(desktop): sidebar running state flips back to idle when two catalog reads race
URL: https://github.com/apache/maka/issues/5713


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] bug(desktop): sidebar running state flips back to idle when two catalog reads race [maka]

Posted by "ggbdpq (via GitHub)" <gi...@apache.org>.
ggbdpq commented on issue #5713:
URL: https://github.com/apache/maka/issues/5713#issuecomment-5847105605

   take


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org