Repository navigation
fix: require declared waits for workers awaiting their own work - #5812
kunchenguid merged 3 commits into
Conversation
Require ship and scout workers to declare owned-work waits with the existing paused verb before ending a turn or waiting on a pipeline or long command. Keep the first-sight alert and existing liveness classification unchanged; subsequent inspection follows the existing long pause cadence. Validation: emitted brief regression failed before the instruction change and passes afterward. Public watcher/drain regressions cover the first alert, repeated wedge suppression, bounded rechecks, and undeclared idle alarms using isolated backend fixtures. Brief suite, pinned lint, Bash syntax, documentation inventory, and whitespace checks pass. No real worker harness was exercised for wait behavior.
…and first-alert throttle while preserving declaration identity. Reproduced the CI failure using stable identity; corrected tests pass with both stable identity and native macOS behavior. Focused ShellCheck and diff checks pass. Production behavior is unchanged; Linux CI was not rerun locally
|
Speaking as Kun's firstmate: waiting-ci (contract-class: restore). Tip vs main: Watcher already bounds wedge escalation for a declared VISION.md (each rule)
CI still running on HEAD |
|
Speaking as Kun's firstmate: CI CLEAN — merging (contract-class: restore). Prior waiting-ci stamp stands for the VISION writeup. Attestation MATCH; NM success. Squash-merging. |
|
Speaking as Kun's firstmate: this is merged. Thank you @mremond — really appreciate you taking the time on this. |
* 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 session can keep them (#5563) * fix(pi): hide queued Firstmate notifications under Calm only when the session can keep them Calm now keeps authenticated Firstmate operational inputs out of Pi's queued-message listing, but only after proving the live session exposes every member needed to keep them across Escape. A session missing any of them keeps stock rows and Escape and shows one generic warning. Escape and the dequeue key return only captain-authored messages to the editor and re-queue hidden notifications in order; after an abort that kept any in Pi's agent queue, the adapter starts the delivery turn itself because Pi 0.87.1 does not continue an aborted run. Compaction-held notifications stay with Pi's compaction flush and never start or announce a turn. Fixes #1588 * docs(calm): record Pi 0.87.1 queued-row retention verification * no-mistakes(review): Deliver kept Calm notifications after tree-navigation aborts too * no-mistakes(review): Defer Calm notification turn until tree navigation finishes * no-mistakes(lint): Silence SC2016 for literal JavaScript in queue-retention e2e test * fix(bin): refuse teardown when a required source disappears (#5548) * fix(bin): refuse teardown when a required source disappears A missing sibling was sourced after cleanup had started, so Bash 3.2 exited 0 from the EXIT trap and Bash 5 continued and reported success. * no-mistakes(review): Remove unused FM_TEST_ONLY hook from teardown tests * no-mistakes(review): Check task backend sources before any teardown cleanup * test(gotmp): give teardown fixtures every tmux adapter sibling Teardown now refuses when a sibling the recorded backend's adapter sources is missing, so the fake bin must carry fm-session-lock-lib.sh, fm-agent-process-lib.sh and fm-gemini-lib.sh. * docs: make supervision-host easier to read (#5605) Restructure the supervision host doc's prose into shorter sections, lists, and tables without changing documented behavior. Every original heading, anchor, identifier, number, quoted string, and link target is preserved. * docs: make the Herdr backend guide easier to read (#5606) * docs: make herdr-backend easier to read Restructure the Herdr backend doc's prose into shorter sections, lists, numbered procedures, and tables without changing documented behavior. Every original heading, anchor, fenced code block, link target, and documented fact is kept. * no-mistakes(document): Restore composer-proof reason and complete Herdr topic table * docs: make pi-supervision-branch easier to read (#5607)
Intent
Fix the false stuck-worker alarms on a healthy worker that is waiting on its own long-running work, as one fix covering two filed defects.
(1) A worker ends its turn deliberately while a harness-tracked background shell or monitor keeps running (a test suite, a validation run, a dev server) to be re-invoked when it completes; its busy record reads idle, it has no live run step and declared no wait, so the watcher raises a first-sight stale alarm and escalates to "possible wedge". Measured on 2026-09-21 in the main home and this home (pane footers such as "1 shell, 1 monitor" and "2 shells still running", processes verifiably alive, escalation up to "idle 288s, possible wedge") and again on 2026-09-26 on the PR 4138 worker while its validation ran in the background.
(2) An agent blocked on its own long foreground command, or a long reasoning turn, shows an unchanged pane, and the watcher escalates after 240 seconds and again every four to five minutes. On 2026-09-09 five consecutive alarms on one worker were all false: the agent was alive and reasoning, its validation run was RUNNING.
Two leads were recorded, to measure before designing: the harness knows when an agent is running a foreground command or tracking background work; and our own worker instructions never ask a worker waiting on the pipeline to declare that wait, which the watcher already handles on a long cadence.
Constraint from the main firstmate: reading harness-owned background state is a new liveness source; it must work across every supported harness and must not couple supervision to one worker runtime. If that cannot be done, say so rather than reaching for it, and stop and report if it needs a liveness-classification change that has not been approved.
Ship the narrow fix now: workers declare their background or pipeline waits so the repeated every-4-minutes wedge alarms stop; one first-sight alarm per wait remains; no new wait classification or state.
What Changed
Validation scope
Watcher behaviour was proven by isolated execution of the public watcher and wake-drain scripts with backend/current-state fixtures. Real worker compliance with the new wait instructions was NOT exercised (only reasoned). No harness completed a live wait workflow: the pipeline launched Claude in a private tmux lab, but it stopped at workspace trust; no trust was accepted and no user-level configuration was changed.
One first-sight alert per wait is retained by design. No new wait classification, state, or liveness source was added. The Test gate continued with explicit approval of the inconclusive live-worker validation limitation.
Risk Assessment
✅ Low: The change implements the authorized narrow containment through existing wait declarations without adding liveness sources, classifications, or state.
Testing
Generated all affected brief variants and passed five focused checks, including mocked watcher cadence and adversarial controls. The initial socket-path setup issue was corrected; Claude then stopped at workspace trust. Saved generated briefs and a terminal transcript. No screenshot was captured; the changed surface is generated text. No lint, broad suite, or pipeline phase ran.
Evidence: Claude lab blocked at workspace trust
Source: Claude lab blocked at workspace trust
Evidence: Generated pipeline worker brief
Source: Generated pipeline worker brief
Evidence: Generated scout brief
Source: Generated scout brief
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
git diff e9a6675ed188f3d77639cfe753451e07d68ab6a6 da2ea01c45576ba27ff2d9de0fe4549f70fb3b39bin/fm-brief.shin a disposable home: no-mistakes, direct-PR, local-only, and scoutSelected existing tests through temporary drivers:test_ship_and_scout_teach_validation_round_pause,test_pause_verb_override_renders_all_brief_scaffolds,test_own_work_wait_keeps_first_alert_then_long_cadence,test_busy_declared_pause_is_rechecked_not_wedge_escalated,test_nonterminal_stale_pause_transitions_reclassify_unchanged_hashLaunched realclaudeon a private lab tmux socket with a 120×40 terminal; captured workspace-trust blocker and stopped the serverRemoved disposable homes and temporary test drivers;git status --shortwas clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.