mirror of
https://github.com/stablyai/orca.git
synced 2026-10-02 08:02:02 +00:00
fix(runtime): report only live structured sessions in worktree ps
The status feed's `published` map is a broadcast cache, not a roster. It deliberately never retracts — an evicted idle session is still idle, and a reloading renderer must not lose every settled row — so enumerating it lists every session the host has ever opened, and eviction's `forget-session` step deletes the session from the live map while touching nothing else. Reading it as a roster made `worktree ps` report a closed chat forever. The sharp edge is a chat closed while an approval was pending: a deliberate close does not settle a pending prompt, so the retained summary stays `attention`, maps to a `blocked` row, and merges the worktree to `permission` for the whole 30-minute freshness window — on the CLI and on the mobile sidebar it backs. The poller now answers from the sessions the host still holds, intersecting the live map with the retained projections. `subscribe()` and its snapshot are untouched: retention there is the point. Gating on the live session set rather than the visible tabs keeps a headless orchestration worker listed, which is what the agent-facing surface is for. Also folds out two things the enumerator left behind: the working/attention/idle to working/blocked/done mapping now lives once in the shared projection module instead of once per process, which is what actually enforces "the CLI and the GUI cannot disagree"; and the structured row source no longer builds a write-only `payload` behind an `as` cast that compensated for nothing. The structured source construction moves to its own module to keep runtime-worktree-agent-rows.ts clear of the 300-line cap.
This commit is contained in:
@@ -93,13 +93,13 @@ describe('terminal listing is deliberately left alone', () => {
|
||||
)
|
||||
// Guard the guard: an empty read would make every assertion below vacuously true.
|
||||
expect(listing).toContain('async listTerminals(')
|
||||
expect(listing).not.toContain('publishedStatusSummaries')
|
||||
expect(listing).not.toContain('liveSessionStatusSummaries')
|
||||
expect(listing).not.toContain('structuredSummaries')
|
||||
|
||||
const worktreePs = await readFile(
|
||||
new URL('./orca-runtime-get-worktree-ps.ts', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
expect(worktreePs).toContain('publishedStatusSummaries')
|
||||
expect(worktreePs).toContain('liveSessionStatusSummaries')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user