fix(sessions): stop counting session startup as work in progress

Startup progress rides the per-session activity channel with an "active"
phase, because a startup phase really is in progress. But isSessionActive()
treated any active activity as work, so a session that was merely *opening*
enabled "Stop Active Work", disabled "Reload from disk" with the misleading
"Stop current session activity before reloading" tooltip, showed the row's
active-work indicator, and — for any caller that hands a startup activity to
WorkspaceActivityService — reported the whole workspace as busy. Selecting an
archived, read-only session reported active work while it opened.

Starting is not working. publishStartupProgress now marks its reports with a
new optional SessionActivity.startup field, and isSessionActive() does not
count a marked activity. Every affected consumer — the session list, the core
actions, the app's activity-transition handling, and the server's workspace
aggregation — reads that one helper, so the correction lands in all of them at
once.

The marker is a new field rather than a new phase on purpose: six readers test
phase === "active" directly, including the pending row's "creating · " prefix,
the chat dock's active styling, and the daemon's own heartbeat re-publication.
It can only ever remove the activity-phase reason for being active, so
streaming, bash, compaction, and queued prompts still report as active through
the status even while a startup report is the latest activity. The chat dock
still shows the startup text; this changes what counts as work, not what is
shown.

The browser's own pending-create row keeps its previous appearance: it borrows
only the daemon's phase text and drops the marker, since that row stands for a
create the user is waiting on rather than a session the daemon is opening.
This commit is contained in:
Federico Jaramillo Martinez
2026-07-26 22:54:27 +02:00
parent cd1326a8ca
commit 4940eda352
13 changed files with 214 additions and 4 deletions
+8
View File
@@ -426,6 +426,14 @@ export interface SessionActivity {
label: string;
detail?: string;
at: string;
/**
* Set only on the startup window's own reports. A startup phase is genuinely
* in progress, so it is published as `active` and rendered like any other
* activity, but *starting* a session is not *working* in it: there is nothing
* to stop, nothing that blocks reloading from disk, and no workspace-level
* work to report. `isSessionActive()` reads this to keep the two apart.
*/
startup?: boolean;
}
export interface QueuedSessionMessage {