Skip to content

(sidebar): show CLI status and age for local sessions too - #254

Merged
devsuitup merged 2 commits into
mainfrom
feat/local-session-status
Sep 10, 2026
Merged

devsuitup merged 2 commits into
mainfrom
feat/local-session-status

Conversation

@devsuitup

Copy link
Copy Markdown
Owner

Closes #245.

Why

A remote session row showed a state word and its age (idle · 3 min); a local one showed neither, although the local CLI writes the same descriptor (~/.claude/sessions/<pid>.json, same status vocabulary and statusUpdatedAt) and cli-session-state.js already parses it.

What

  • cli-session-state.js keeps a sessionId → {status, statusUpdatedAt} map for live pids only and exposes getStatus(sessionId), a pure lookup — no new watcher, the module's rescan invariant is untouched. A descriptor left behind by a crashed CLI never surfaces; a known session observed with a dead pid is dropped.
  • main.js annotateRemoteAttachable annotates local sessions from that lookup and remote ones from the host descriptor, under one pair of fields: status / statusUpdatedAt (remoteStatus* renamed).
  • public/sidebar.js renders the state + age line for any session carrying status, regardless of remoteAlias; formatRemoteAgeformatStatusAge, .session-remote-status.session-status.
  • Not in scope: folding this text into the status icon slot ((session-state): one domain module, one icon slot, enforced single writer across local/remote/subagent sources #246).

Proof

Mutations on the shipped files: drop the local annotation → local test red, remote green; wrap the render back in if (session.remoteAlias) → two local render tests red; drop the liveness gate in seed() → "seeded at startup" test red only; drop both gates → three tests red.

task check: 1230 pass, 0 fail, 8 pre-existing skips.

Local sessions carry the same busy/idle/waiting/shell descriptor as
remote ones (~/.claude/sessions/<pid>.json), but only the remote path
rendered it. Rename remoteStatus/remoteStatusUpdatedAt to status/
statusUpdatedAt, annotate local sessions from cli-session-state.js's
already-parsed cache, and render the line regardless of remoteAlias.
statusBySession was written before the isProcessAlive gate, so a
descriptor left by a crashed or killed CLI (deleted on clean exit
only) would surface as a permanently live status. Gate both seed()
and handleFile() on liveness, and move the two comment blocks over
the ceiling into cli-session-state.md.
@devsuitup
devsuitup merged commit 3f6c6cd into main Sep 10, 2026
10 checks passed
@devsuitup
devsuitup deleted the feat/local-session-status branch September 10, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(sidebar): show CLI status and age for local sessions like remote ones

1 participant