Skip to content

docs(agents): which surface carries which daemon seat field (TASK-066) - #1762

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/daemon-seat-state-surfaces
Sep 19, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/daemon-seat-state-surfaces

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

What

A durable doc for a field map that until now existed only in my session memory:
which surface actually carries each field of the daemon's per-seat report.

agentStates() (cli/src/lib/daemon-supervisor.js:73-85) reports ten fields.
It feeds two consumers, and they do not keep the same fields:

  • POST /api/machines/<id>/heartbeat → normalizeAgentStates
    (backend/services/machineService.ts:28-47) rebuilds each entry as a
    4-field whitelist (agentName, instanceId, state, restarts).
    pid, adapter, model, effort, lastTurnAt, lastError are dropped
    before they reach Machine.agentStates (backend/models/Machine.ts:41-50)
    or serializeMachine (:65-74).
  • persistState → the local state file (cli/src/lib/daemon-state.js:26-37,
    mode 0600), whose only reader is commonly daemon status --verbose
    (cli/src/commands/daemon.js:393, printed :401-404).

So adapter / model / effort are operator-visible but API-invisible. The
doc records the two consequences that cost time:

  1. A test that asserts on /api/machines cannot witness a change to those three
    fields — it is testing the whitelist, not the change. #1761 was first
    characterised as "not an operator-visible fix" on a frontend-only trace; the
    CLI's own status line prints them.
  2. lastTurnAt is spawn time on the heartbeat payload (:91) and a real last
    turn in the local file (daemon.js:351 corrects it at the boundary).

Why it is a repo doc and not a memory entry

Per CLAUDE.md's knowledge-base discipline: memory is private to one operator's
sessions and the fleet cannot read it. A trap another agent will hit belongs in
docs/. The earning incident is #1761 / TASK-065 (TASK-066 is the row).

Verification

Every anchor is a read of the tree at ac544d5c (cli 0.1.50); the doc's Verify
section gives the four commands to re-derive it. The spawn/report disagreement in
Trap 3 was the one thing measured by RUNNING the supervisor (throwaway probe,
deleted) — it is labelled as such in the doc, as is the fact that the Trap 3 fix
is in an unmerged PR at time of writing.

Scope

docs/ only — no source change, so no version bump
(the guard watches $pkg/src for cli and commonly-mcp only).

@lilyshen0722
lilyshen0722 force-pushed the kai/daemon-seat-state-surfaces branch from 0eb2713 to c569a19 Compare September 19, 2026 16:09
@lilyshen0722
lilyshen0722 merged commit cbc3fe3 into main Sep 19, 2026
13 checks passed
lilyshen0722 added a commit that referenced this pull request Sep 19, 2026
#1761 merged as c9eb7eb, and on cbc3fe3 the range Trap 3 cited when it was
written (daemon-supervisor.js:357-359) now falls inside the adopt loop. The
record-first trio is :408-410, so the citation moves with the code and the
corollary's "once #1761 lands" hedge becomes a plain statement. The header gains
a dated re-anchor note that names what was re-measured and what was not.

TASK-066 follow-up; #1762 merged as cbc3fe3.
lilyshen0722 added a commit that referenced this pull request Sep 19, 2026
#1761 merged as c9eb7eb, and on cbc3fe3 the range Trap 3 cited when it was
written (daemon-supervisor.js:357-359) now falls inside the adopt loop. The
record-first trio is :408-410, so the citation moves with the code and the
corollary's "once #1761 lands" hedge becomes a plain statement. The header gains
a dated re-anchor note that names what was re-measured and what was not.

TASK-066 follow-up; #1762 merged as cbc3fe3.
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