Skip to content

feat(cli): daemon status --verbose names each seat's instance and restart count (TASK-072) - #1777

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/daemon-status-verbose
Sep 19, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/daemon-status-verbose

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

What

commonly daemon status --verbose is the only surface where a local seat's supervised state can be read, and it printed neither of the two fields that say whether the seat is healthy:

  • restarts — the supervisor's flap counter. It is written by daemon-supervisor.js, persisted into state.json (daemon-state.js seatState) and served; no CLI command showed it, so a seat that had been crash-looping printed exactly like a healthy one.
  • instanceId — the identity the platform routes by. A seat attached to the wrong instance was indistinguishable from a correctly attached seat.

Both were already in loadDaemonState()'s output; only the print line dropped them.

-  quill: running adapter=pi model=gpt-5.6-luna/xhigh pid=12814 lastTurn=2026-09-08T10:32:02.392Z
+  quill: running instance=quill-seo-writer adapter=pi model=gpt-5.6-luna/xhigh pid=12814 restarts=0 lastTurn=2026-09-08T10:32:02.392Z

A healthy restarts=0 is printed rather than omitted, and a state file written before the field existed prints restarts=-. A counter shown only when non-zero cannot be told apart from one that was never recorded — which is the complaint behind this task, so the formatter keeps 0 and absent distinct on purpose (restarts === undefined || null ? '-' : restarts).

The line moved into an exported formatSeatLine, next to formatTokenStatus in commands/login.js as the existing precedent, so it has a witness without a running daemon.

Evidence

  • At the consumer, against the live daemon state (node cli/src/index.js daemon status --verbose, read-only, this box):
Sams-MacBook: online (last heartbeat: 9/19/2026, 12:07:45 PM)
Local supervised seats:
  quill: running instance=quill-seo-writer adapter=pi model=gpt-5.6-luna/xhigh pid=12814 restarts=0 lastTurn=2026-09-08T10:32:02.392Z
  c4-smoke: running instance=default adapter=claude model=claude-sonnet-5/high pid=12825 restarts=0 lastTurn=2026-09-18T12:12:23.355Z
  • Full cli suite green: 40 suites / 633 tests (623 passed, 10 skipped, 0 failed), 3 of them new. eslint src clean.
  • Three mutations, each reddening its own witness: drop instance= → the instance assertions; hide a healthy zero (restarts === 0 ? '-') → the restarts=0 test; claim zero for an absent field (?? 0) → the "unknown, not zero" test.
  • cli/package.json 0.1.58, and the diff is the version line alone (main is 0.1.57 from fix(cli): the pi bridge takes its MCP server list over fd 3, never the environment (TASK-070) #1774; no other open PR claims 0.1.58).

Scope

cli/src/commands/daemon.js (print path only — no supervisor, state-file or API change), one test file, the version line.

@samxu01
samxu01 force-pushed the kai/daemon-status-verbose branch from 7a8ace8 to 75928ba Compare September 19, 2026 19:13
…tart count (TASK-072)

`restarts` is written by the supervisor, persisted into the state file and served,
and no CLI surface showed it — so a seat that had been crash-looping printed
exactly like a healthy one. `instanceId` is the identity the platform routes by,
so a seat attached to the wrong instance was indistinguishable from a correct one.

The line now reads:

  quill: running instance=quill-seo-writer adapter=pi model=gpt-5.6-luna/xhigh pid=12814 restarts=0 lastTurn=...

A healthy `restarts=0` is printed rather than omitted, and a state file written
before the field existed prints `restarts=-`: a counter shown only when non-zero
cannot be told apart from one that was never recorded, which is the task.

The line moved into an exported `formatSeatLine` so it has a witness without a
running daemon; three tests, three mutations. cli 0.1.58.
@lilyshen0722
lilyshen0722 force-pushed the kai/daemon-status-verbose branch from 75928ba to 7956345 Compare September 19, 2026 19:18
@lilyshen0722
lilyshen0722 merged commit bd80188 into main Sep 19, 2026
13 checks passed
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.

1 participant