Repository navigation
feat: add attended supervision for Claude and Cursor hosts - #5748
Conversation
On a home opted into config/supervision-host with a Claude or Cursor primary, the supervision host now takes the attended wakes the Pi branch would take: routine outcomes stay off main, and a captain outcome wakes main once with a branch-outcome line and waits in the drain's new BRANCH OUTCOMES section until main acknowledges it with mark-processed. - The offer rule moves into branchOfferForWake, shared by the Pi watcher and the host through bin/fm-branch-dispatch.mjs offer. - The host feeds the dialog mirror at the head of each attended wake and passes a close through unchanged when it is main-only, the engine or a tool is missing, the primary has no verified mirror, the main session cannot be identified, or the session is cooling down. - The drain presents captain outcomes first, one line per task, never behind older routine outcomes, and collapses routine overflow into a count that is marked read. - The return advances the store's read cursor through the away window once the brief has rendered, so the first drain does not replay it. - The branch prompt's mirror wording is host-neutral, and the rule to report what main must act on as captain, once per unchanged situation, applies only to the attended posture on the host.
…t outcome budgets
fcbe352 to
9174aa6
Compare
Validation notesThe pipeline's own live runs could not start a Claude primary (their lab socket path was too long), so the Test step shows most live scenarios as untested. The live checks were driven outside the pipeline, in isolated lab homes with a real Claude Code 2.1.283 primary and
Pi homes stay unchanged. The shared offer rule in Not driven live (covered by deterministic tests): a failed outcome projection or missing |
* docs: make configuration settings easier to find and understand (#5589) * docs: make configuration settings easier to find and understand * no-mistakes(review): Restore dropped qualifiers and fix misplaced config doc labels * no-mistakes(review): Restore three dropped qualifiers in configuration reference * fix: limit project memory edits to factual corrections (#5636) * fix: bound worker edits of project AGENTS.md/CLAUDE.md to factual corrections These files are loaded into every agent session of a project, so additions should be a deliberate human choice rather than automated task output. The ship brief's project-memory section and AGENTS.md section 6 previously invited workers to record durable knowledge, which let project AGENTS.md files accrete detail the codebase or README already carries. Workers now edit only to fix factually wrong content - including content their own change made wrong - and fm-ensure-agents-md.sh runs only alongside such a correction. Stow no longer routes project-memory additions through ship tasks, and the generated skeleton no longer invites discovery-driven additions. * no-mistakes(review): Stop running fm-ensure-agents-md.sh on memory-file corrections * no-mistakes(document): Clarify manual project-memory initialization and remove duplicate guidance * feat: permit gate lifecycle calls against disposable lab homes (#5635) * fix(bin): let gate agents drive lifecycle against marked lab homes Part 2 of the #5615 split. A no-mistakes gate agent runs inside a checkout carrying the fleet-captain identity, so fm-gate-refuse-lib refuses fleet mutation on the gate signal. That refusal was absolute, which kept gate validation from ever exercising the real lifecycle. Stamp a disposable lab FM_HOME with a .fm-lab-home marker file that only bin/fm-lab-home.sh writes, and only onto a fresh empty dir, so no call path can mark a populated real home. fm_refuse_if_gate_agent then permits lifecycle only when FM_HOME carries the marker and is driven through its stock layout - any FM_*_OVERRIDE relocation stays refused so part of the "lab" cannot be split back onto the real fleet. The threat model is a confused agent touching the real fleet, not deliberate forgery, so the marker is a plain token file rather than a bound record. FM_GATE_REFUSE_BYPASS is unchanged: it still serves the test harness, which cannot mark hundreds of temp homes. Teardown's slot-ownership scan compared state-dir paths textually while fm_firstmate_root_home canonicalizes, so a lab home under a symlinked TMPDIR scanned its own record twice and self-collided; compare file identity (-ef) instead. * no-mistakes(review): Refuse unlistable lab homes and hardlinked slot records * no-mistakes(review): Mint lab markers only on verified-empty fresh dirs * no-mistakes(document): Clarify lab-home gate documentation and comment contracts * no-mistakes(document): Clarify lab-home gate documentation and remove stale claims * no-mistakes(document): Clarify gate lab-home documentation and boundary wording * fix(bin): evict a watcher whose beacon stalls past a hard bound instead of refusing every re-arm (#5594) * fix(bin): replace a watcher whose beacon stalls past a hard bound instead of refusing every re-arm A fleet watcher that is alive but whose liveness beacon has gone stale could never be replaced: every re-arm was refused because the lock holder was a live pid, and the holder was never evicted because it was not dead. Add FM_WATCHER_STALL_BOUND (default 3x the stale grace): below it the refusal is unchanged; at or past it the arm re-verifies the holder against the lock's recorded identity, sends TERM, waits boundedly, and takes the lock the normal way, ledgering a stalled-holder-replaced row. A holder that survives TERM keeps the old refusal. Fixes #4400 * no-mistakes(test): poll for replacement message to fix watcher-lock test flake * no-mistakes(document): document FM_WATCHER_STALL_BOUND in config inventory * fix(pi): hide queued Firstmate inputs under Calm only when the s
Intent
yes do A.
Context: that chose option A for PR #5631 (AFK revamp rung 3c, attended posture and /quiet on the supervision host): land the approved repeated-escalation fix first, then re-cut 5631 from the branch's final validated tree into four PRs in dependency order - 3c-1 broken-session latch; 3c-2 dialog mirror for Claude and Cursor; 3c-3 attended posture core with the two drain fixes and the reconciled prompt rule, keeping every Pi home unchanged; 3c-4 the /quiet statement - and move Codex attended support to rung 3d. Each PR ships through no-mistakes and the captain merges. 3c-1 (#5701) and 3c-2 (#5707) have landed; this is 3c-3.
The AFK revamp's standing words also apply: "2 should be done by opus crewmates" and "this is a major architectural revamp so i want it to do very careful live validation including regression in isolated live environments with some real complex sessions before calling it done. it's ok to use my real llm tokens here".
Substance of the referenced assessment for 3c-3: the attended posture core is the offer-rule single owner (branchOfferForWake shared with the host through fm-branch-dispatch.mjs), the host's attended acceptor and exits, the dialog mirror feed into the wake, the drain's
presentsubcommand and BRANCH OUTCOMES section with the mark-processed acknowledgement, the report CLI attended path, and the prompt's host-neutral mirror wording - roughly 560 production, 620 test, and 110 doc lines, behind the config/supervision-host opt-in. Two drain defects must be fixed. D1: a new captain outcome can be hidden behind older routine outcomes, because print_branch_outcomes_section caps the routine list at 2,000 bytes and then lists only captain rows up to the last printed routine row, so with about a dozen waiting routine rows the captain outcome that woke main is omitted; fix by presenting captain rows independently of the routine cap (captain first) and collapsing routine overflow into a count that is marked read. D2: after a return, the first attended drain replays the whole away window (measured: a window shaped like the real one needs 96 drains and about 580 KB of repeated text), because nothing at the return advances the store's read cursor or processed marker; fix by advancing the read cursor through the window's rows once the return brief has rendered, and collapsing repeated captain rows per task. D3: the PR's ungated shared prompt rule (bin/fm-branch-prompt.sh) told the branch to report captain "even when an earlier outcome already told MAIN", which changes every Pi home and contradicts one report per unchanged situation; it becomes a reconciled rule - captain once per unchanged situation, including after an earlier routine outcome mentioned it - applying only to the attended posture on the supervision host, so every Pi home stays unchanged. The one live re-check is on Claude: routine stays off main, a captain outcome reaches main, a large routine backlog plus a fresh captain outcome, and a return after a long away window.Chosen design for the return: the drain is the only presenter and cursor owner; the return brief stops listing branch outcomes and points at them; the drain collapses repeated captain rows per task and counts routine overflow, so a long away window costs one short drain; no new state. The resulting return experience: away outcomes appear once, grouped per task, repeats collapsed to one line, routine items as a single count, and nothing from the window is re-shown afterward.
What Changed
Risk Assessment
Testing
Targeted host checks passed through the attended and drain cases before a 480-second timeout; the return, branch, mirror, and instruction checks passed separately. The live outcome-store CLI showed captain acknowledgement and fail-closed cursor behavior. The host scenarios were supported only by tests, not a running primary; no real-Claude primary was driven.
Evidence: Outcome-store CLI presentation, acknowledgement, and corrupt-cursor refusal
Source: Outcome-store CLI presentation, acknowledgement, and corrupt-cursor refusal
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
Step was skipped.
✅ No issues found.
tests/fm-supervision-host.test.sh(attended, drain, and failure-path cases passed before the command timed out at 480 seconds)tests/fm-afk-return.test.shbash tests/fm-branch-supervision.test.shbash tests/fm-host-mirror.test.shbash tests/fm-supervision-instructions.test.shManually drovebin/fm-branch-outcome.shappend, present, mark-read, mark-processed, and malformed-cursor refusal in an isolated worktree home⏭️ **Document** - skipped
Step was skipped.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.