Skip to content

fix: require declared waits for workers awaiting their own work - #5812

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
mremond:fm/fm-background-shell-turn-reads-as-stale
Sep 26, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
mremond:fm/fm-background-shell-turn-reads-as-stale

Conversation

@mremond

@mremond mremond commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Require workers to declare background-shell, monitor, pipeline, and long foreground-command waits using the existing paused status, preserving one first-sight alert and the long recheck cadence.
  • Centralize wait instructions and clarify documentation without adding a liveness source, classification, or state; active implementation and reasoning remain outside declared waits.
  • Add regression coverage for brief instructions, bounded wait rechecks without repeated wedge alarms, and continued alerts for undeclared idle workers.

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.

  • Live validation: ⚠️ inconclusive - 1 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Generate ship and scout briefs containing wait declarations, resolution instructions, and the active-reasoning exclusion ✅ pass live Generated brief artifacts; test_ship_and_scout_teach_validation_round_pause; test_pause_verb_override_renders_all_brief_scaffolds
Declare an own-work wait: retain the first alert, suppress repeated wedges, and eventually recheck ⏸️ untested no The prior payload records only a mocked watcher test, not a live result. A running worker and watcher must exercise the wait and recheck behavior to establish live validation.
Clear a wait and restore ordinary stale-worker escalation, including an unchanged pane ⏸️ untested no The prior payload records only automated tests with live=false, not a live result. A running worker and watcher must exercise wait clearing and subsequent stale-worker escalation.
Leave an idle worker undeclared and confirm it still raises an alarm ⏸️ untested no The prior payload records only an undeclared-worker test control with live=false, not a live result. A running watcher must observe an undeclared idle worker and raise the alarm.
A real worker declares a background-shell or foreground-command wait, then resolves it on completion ⏸️ untested no Claude requires workspace trust registration outside the permitted write boundary. Provide a trusted workspace or authorize registration before rerunning.
A real worker declares its pipeline wait before awaiting a backgrounded drive call ⏸️ untested no This phase cannot invoke or control a pipeline; the outer executor owns that lifecycle. Validate this during an authorized outer worker run.
Evidence: Claude lab blocked at workspace trust

Source: Claude lab blocked at workspace trust


────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 Accessing workspace:

 ~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y

 Quick safety check: Is this a project you created or one you trust? (Like your own code, a well-known open source
 project, or work from your team). If not, take a moment to review what's in this folder first.

 Claude Code'll be able to read, edit, and execute files here.

 Security guide

 ❯ No, exit
   Yes, I trust this folder

 Enter to confirm · Esc to cancel
Evidence: Generated pipeline worker brief

Source: Generated pipeline worker brief

You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
## Captain's intent
{TASK}

## Firstmate spec
{FIRSTMATE_SPEC}

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text filled in above.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of firstmate, at a detached HEAD on a clean default branch.

**Verify isolation before anything else.** Run `pwd -P` and `git rev-parse --show-toplevel`; both must resolve to the disposable task worktree you were launched in, such as a treehouse pool path or an Orca-managed worktree, not the primary checkout firstmate operates from.
The path check is authoritative: `git rev-parse --git-dir` and `git rev-parse --git-common-dir` can help inspect the repo, but they do not prove you are outside the primary checkout.
If the top-level path is the primary checkout or not the worktree you were launched in, STOP - do not branch or commit here - append `blocked [at=<epoch>]: launched in primary checkout, not an isolated worktree` to the status file and stop.

1. First action: create your branch: `git checkout -b fm/wait-no-mistakes --`
2. Run `no-mistakes doctor`; if it reports the repo is not initialized here, run `no-mistakes init`.

# Rules
1. Never push to the default branch. Never merge a PR.
2. Stay inside this worktree; modify nothing outside it.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state} [at=<epoch>]: {one short line}" >> '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-no-mistakes.status' && { [ ! -e '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/config/fleet-ledger' ] || '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/bin/fm-fleet-ledger.sh' appended '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/config' '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-no-mistakes.status' >/dev/null 2>&1 || true; }`
   States: working, needs-decision, blocked, paused, done, failed.
   Substitute `<epoch>` with the current Unix time in seconds - run `date +%s` and write the number it printed; a stamp that is not plain digits records no time at all.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on (setup done, bug reproduced, fix implemented, validation passed) and the
   needs-decision/blocked/paused/done/failed states. No step-by-step FYI progress lines;
   firstmate reads your pane for that.
   Whenever you mention a PR anywhere - a status line, your terminal, a summary - write its full
   https:// URL exactly as the forge printed it, never a bare number such as "PR 108"; firstmate
   copies that URL from your line rather than assembling one.
   A mid-task `working:` line (including setup complete) is nonterminal: do not end the
   turn after it; continue the same stage until a defined `done:` gate under Definition of done.
   Use `paused: {why}` - distinct from `blocked:` - when deliberately waiting for work or an external condition expected to clear on its own, including your own validation round.
   Before ending your turn with your own background shell or monitor still running, or before waiting on your own pipeline run or a long foreground command, append `paused [at=<epoch>]: {job and completion condition}` to the status file.
   Name what you are waiting for and what will let you resume; do not repeat the declaration on every poll.
   Do not declare active implementation or reasoning as a wait.
   Firstmate may still raise one first-sight alert; the declared wait then uses the existing long recheck cadence instead of repeated possible-wedge alarms.
   When you know when the wait clears, include `until <YYYY-MM-DDTHH:MMZ>` (UTC) for a recheck at that time.
   Follow the resolution rule below when the wait clears, then resume the task.
   Use `blocked:` when you are stuck and need help.

5. If you hit the same obstacle twice, append `blocked [at=<epoch>]: {why}` and stop; firstmate will help.
6. If a decision belongs above the implementation worker (product choices, destructive actions),
   append `needs-decision [at=<epoch>]: {summary of options}` and stop. Firstmate will reply with the decision.
   For a no-mistakes ask-user gate specifically, escalate all ask-user findings as one event plus one snapshot file, using that same shape even when the gate holds only a single ask-user finding: write only the ask-user findings, verbatim and unparaphrased (id, severity, file, line, description, authority), to `~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/data/wait-no-mistakes/nm-<run>-findings.txt`, then report the gate with
   `needs-decision [at=<epoch>] [key=nm-<run>-<step>]: ask-user findings=<id1>,<id2>,... file=~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/data/wait-no-mistakes/nm-<run>-findings.txt`
   naming every ask-user finding id from that gate. The status line only points at the file; it never restates or summarizes a finding's content.
   A decision or blocker you opened stays open until a `resolved` line carrying its exact key lands; a later `done:` or `working:` line never closes it, even when the answer is what started that work.
   Firstmate's reply normally writes that closing line at answer time; when a blocker or wait clears WITHOUT a firstmate reply, append `resolved [at=<epoch>]: {how it cleared}` yourself (same `[key=<slug>]` if you opened it with one) as you resume.
7. Never administer infrastructure that every lane shares. Two things are shared:
   - The `no-mistakes` daemon - one instance serving every lane/home, so stopping, restarting, or
     updating it kills other lanes' in-flight pipeline runs; only firstmate manages the daemon.
     Before you append `blocked:` about the pipeline, run `no-mistakes daemon status` and
     `no-mistakes axi status`. If the daemon socket refuses connections or is missing, append
     `blocked [at=<epoch>]: {the daemon error}` and stop even when the local run record still says running or
     fixing, because that record can be stale after the daemon exits. A run record failed with a
     daemon error is also a real block.
     Only after ruling out socket refusal, if the run is still running or fixing, reattach and keep
     going. A drive-call error, timeout, slow read, or generic unreachability is NOT a daemon error:
     the daemon accepts `respond` immediately and runs the round in the background, so a killed or
     timed-out call was only waiting for a read while the run kept working.
   - The worktree pool your own worktree came from, and the repository every lane's worktree
     shares. Never create, remove, return, prune, move, or reassign a worktree or pool slot, and
     never write into a sibling slot's directory. Rule 2 does not cover this: removing a worktree
     is administration rather than an edit outside your directory, and it lands on lanes that are
     running right now. The act is the rule and commands are only examples of it - `treehouse`
     get/return/remove/prune, the equivalent operations on any other worktree provider or runtime
     backend, and `git worktree add|remove|move|prune`. A slot that looks unused is not evidence
     that it is free, and returning your own worktree is firstmate's job at cleanup, not yours.
   If you genuinely need a second checkout, another slot, or the daemon touched, append
   `blocked [at=<epoch>]: {what you need}` and stop; firstmate arranges it.

# Firstmate instruction inbox
Firstmate steers you through durable message files in '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-no-mistakes.inbox'.
When a terminal message says an instruction is waiting there - and at any natural checkpoint when you are unsure - list '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-no-mistakes.inbox'/*.msg, read and act on each message in numeric order, then acknowledge each handled message by moving it: `mv '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-no-mistakes.inbox'/NNN.msg '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-no-mistakes.inbox'/handled/`.
The move IS the acknowledgement: without it firstmate rings again and eventually treats you as stuck. An empty or absent inbox needs no action.

# Project memory
A project's `AGENTS.md` or `CLAUDE.md` is loaded into every agent session in that project, so edit it only to correct information that is factually wrong - including information your own change made wrong - and never to add knowledge because it is missing.
A correction edits only the wrong text: do not run `~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/bin/fm-ensure-agents-md.sh`, create either file, or add sections, headings, or pointers alongside it.

# Definition of done
Delivery contract: mode=no-mistakes
Ship branch: fm/wait-no-mistakes
The task is complete only when committed on your branch.
When you believe it is complete, append `done [at=<epoch>]: {summary}` to the status file and stop.
Firstmate will then instruct you to run /no-mistakes to validate and ship a PR.
That first `done:` is the handoff that starts the pipeline, which owns the push; it is not a request to push from this copy.

You drive no-mistakes by responding to its gates, not by implementing fixes.
Follow the guidance no-mistakes itself provides for the mechanics: it loads when you invoke /no-mistakes, and `no-mistakes axi run --help` plus the `help` lines in each `axi` response are authoritative and version-matched to the installed binary.
When starting no-mistakes, pass `--intent` as only this brief's `## Captain's intent` subsection body, not its heading, plus any later words the captain actually said.
Preserve the actual words without adding speaker labels or direct address; the subsection heading supplies provenance outside the pipeline input.
For a legacy brief with no such subsection, include only words on lines marked `[captain] `, excluding that metadata prefix; never copy its mixed `# Task` wholesale.
If it has no provenance-marked captain words, stop and ask firstmate instead of starting no-mistakes.
Do not include `## Firstmate spec`, later Firstmate build constraints, or your own decisions and tradeoffs.
The `--intent` string you pass must be self-sufficient: that string plus the codebase must let a reader reconstruct roughly the same specification, without depending on a separate report, a PR, or context that lives only in this conversation.
When the captain's intent refers to a report, decision, or PR ("do items 1, 2, 3, and 7 of the report"), write the substance of the referenced items into `--intent` in the captain's terms, not only the pointer; that substance is the captain's ask by reference, while Firstmate's build instructions and your own decisions still stay out.
This replaces the no-mistakes skill's advice to enrich `--intent` with decisions and tradeoffs; that advice does not apply to Firstmate-dispatched work.
Do not hand-edit, commit, or fix findings yourself while a run is active - the pipeline applies every fix.

One drive call blocks until the next gate or outcome, which routinely outlives what your harness lets a single command run: Claude Code kills a command at ten minutes maximum, while one fix round is capped around thirty minutes and up to three rounds chain.
So background the drive call instead of sitting in one blocking hold your harness will kill, and read its return when it finishes.
Declare that wait using the brief's status-reporting rule before waiting on the backgrounded drive call.
Where a harness's own command limit is not established, assume it bounds commands and use that same backgrounded shape.
Only a drive call's return reports the green PR: `no-mistakes axi status` shows progress but never reports `checks-passed` while the ci step is still monitoring the PR for merge, so never wait on a status poll for the next gate or outcome.
Whenever a drive call returns without a gate or an outcome - its own wait elapsed, or it was killed or timed out - reattach at once by re-running `no-mistakes axi run` without flags, backgrounded the same way; once checks are green it returns `checks-passed` immediately, and if it refuses because no run is active, read the finished outcome from `no-mistakes axi status`.
A killed or timed-out call is never evidence the daemon died: the daemon accepts your response immediately and runs the round in the background, so the call was only ever waiting for a read while the run kept working.
Reattach and keep going rather than reporting the pipeline blocked; rule 7 owns the checks that decide when a pipeline block is real.

Two firstmate-specific rules layer on top of that guidance:
- ask-user findings are never yours to answer: escalate to firstmate using rule 6's ask-user format and stop.
  Firstmate applies `ask-user-authority` and obtains any required captain decision.
  When the decision comes back, feed it to the gate with `no-mistakes axi respond` and let the pipeline apply it - do not route the question to "the user" or implement the fix yourself.
- NEVER pass `--yes` (or `-y`) to `no-mistakes axi run` or `no-mistakes axi respond`. It is banned fleet-wide.
  It auto-resolves every gate including ask-user findings with no escalation, and answering your own ask-user finding is a hard rule violation.

After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), read the PR back from the forge and confirm it is not a draft (`gh-axi pr view <number>` must print `draft: no`, where <number> is the PR number from your PR URL); if it is a draft, mark it ready with `gh-axi pr ready <number>`.
A draft cannot be merged, so a done report on one leaves the merge unasked.
Then append `done [at=<epoch>]: PR {url} checks green` and stop. You are finished.
That CI-ready `done:` is accepted only when this copy's HEAD - your latest commit - is one the /no-mistakes run pushed, so commit nothing after the run; the check tests that commit, not merely that a branch moved.
If you deliberately keep the PR a draft, append `paused [at=<epoch>]: {why the draft is held}` instead of done.
Evidence: Generated scout brief

Source: Generated scout brief

You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
## Captain's intent
{TASK}

## Firstmate spec
{FIRSTMATE_SPEC}

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text filled in above.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of firstmate, at a detached HEAD on a clean default branch.
This is a SCOUT task: the deliverable is a written report, not a PR.
The worktree is your laboratory - install, run, edit, and make scratch commits freely; all of it is discarded at teardown.
The report is the only thing that survives, so anything worth keeping must be in it.

# Rules
1. Never push to any remote and never open a PR.
2. Stay inside this worktree; the only files you may write outside it are the report and the status file below.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state} [at=<epoch>]: {one short line}" >> '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-scout.status' && { [ ! -e '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/config/fleet-ledger' ] || '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/bin/fm-fleet-ledger.sh' appended '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/config' '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-scout.status' >/dev/null 2>&1 || true; }`
   States: working, needs-decision, blocked, paused, done, failed.
   Substitute `<epoch>` with the current Unix time in seconds - run `date +%s` and write the number it printed; a stamp that is not plain digits records no time at all.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on and the needs-decision/blocked/paused/done/failed states. No step-by-step
   FYI progress lines; firstmate reads your pane for that.
   Whenever you mention a PR anywhere - a status line, your terminal, a summary - write its full
   https:// URL exactly as the forge printed it, never a bare number such as "PR 108"; firstmate
   copies that URL from your line rather than assembling one.
   Use `paused: {why}` - distinct from `blocked:` - when deliberately waiting for work or an external condition expected to clear on its own, including your own validation round.
   Before ending your turn with your own background shell or monitor still running, or before waiting on your own pipeline run or a long foreground command, append `paused [at=<epoch>]: {job and completion condition}` to the status file.
   Name what you are waiting for and what will let you resume; do not repeat the declaration on every poll.
   Do not declare active implementation or reasoning as a wait.
   Firstmate may still raise one first-sight alert; the declared wait then uses the existing long recheck cadence instead of repeated possible-wedge alarms.
   When you know when the wait clears, include `until <YYYY-MM-DDTHH:MMZ>` (UTC) for a recheck at that time.
   Follow the resolution rule below when the wait clears, then resume the task.
   Use `blocked:` when you are stuck and need help.

5. If you hit the same obstacle twice, append `blocked [at=<epoch>]: {why}` and stop; firstmate will help.
6. If a decision belongs to a human (product choices, destructive actions),
   append `needs-decision [at=<epoch>]: {summary of options}` and stop. Firstmate will reply with the decision.
   A decision or blocker you opened stays open until a `resolved` line carrying its exact key lands; a later `done:` or `working:` line never closes it, even when the answer is what started that work.
   Firstmate's reply normally writes that closing line at answer time; when a blocker or wait clears WITHOUT a firstmate reply, append `resolved [at=<epoch>]: {how it cleared}` yourself (same `[key=<slug>]` if you opened it with one) as you resume.
7. Never administer infrastructure that every lane shares. Two things are shared:
   - The `no-mistakes` daemon - one instance serving every lane/home, so stopping, restarting, or
     updating it kills other lanes' in-flight pipeline runs; only firstmate manages the daemon.
     Before you append `blocked:` about the pipeline, run `no-mistakes daemon status` and
     `no-mistakes axi status`. If the daemon socket refuses connections or is missing, append
     `blocked [at=<epoch>]: {the daemon error}` and stop even when the local run record still says running or
     fixing, because that record can be stale after the daemon exits. A run record failed with a
     daemon error is also a real block.
     Only after ruling out socket refusal, if the run is still running or fixing, reattach and keep
     going. A drive-call error, timeout, slow read, or generic unreachability is NOT a daemon error:
     the daemon accepts `respond` immediately and runs the round in the background, so a killed or
     timed-out call was only waiting for a read while the run kept working.
   - The worktree pool your own worktree came from, and the repository every lane's worktree
     shares. Never create, remove, return, prune, move, or reassign a worktree or pool slot, and
     never write into a sibling slot's directory. Rule 2 does not cover this: removing a worktree
     is administration rather than an edit outside your directory, and it lands on lanes that are
     running right now. The act is the rule and commands are only examples of it - `treehouse`
     get/return/remove/prune, the equivalent operations on any other worktree provider or runtime
     backend, and `git worktree add|remove|move|prune`. A slot that looks unused is not evidence
     that it is free, and returning your own worktree is firstmate's job at cleanup, not yours.
   If you genuinely need a second checkout, another slot, or the daemon touched, append
   `blocked [at=<epoch>]: {what you need}` and stop; firstmate arranges it.

# Firstmate instruction inbox
Firstmate steers you through durable message files in '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-scout.inbox'.
When a terminal message says an instruction is waiting there - and at any natural checkpoint when you are unsure - list '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-scout.inbox'/*.msg, read and act on each message in numeric order, then acknowledge each handled message by moving it: `mv '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-scout.inbox'/NNN.msg '~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/state/wait-scout.inbox'/handled/`.
The move IS the acknowledgement: without it firstmate rings again and eventually treats you as stuck. An empty or absent inbox needs no action.

# Definition of done
Write your findings to `~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.fm-brief-live.UacQaG/data/wait-scout/report.md`.
The report must stand alone: what you did, what you found, the evidence (commands run, output, file:line references), and what you recommend.
If your deliverable is a visual artifact the captain will review and iterate on, use the lavish-axi rule: arm your board with bin/fm-procevent-lavish.sh arm <artifact.html> --for <task-id>; never run lavish-axi poll yourself. Re-arm with the reply after each nonterminal round to acknowledge it, route the board feedback through your steering inbox, write needs-decision [key=board-review] with the live board URL when the captain owes a decision, and stop at session_ended or an empty End without re-arming - acknowledge that final round with bin/fm-procevent.sh handled <source-id> <sequence> to conclude and retire your board.
Before reporting done, read and follow `~/.no-mistakes/worktrees/acf4a767348a/01M3FCECGX6FVCPVF1028BJS4Y/.agents/skills/captain-hold-lifecycle/SKILL.md` and pass its shared completion gate for the report and any visual review.
When the report is complete, append `done [at=<epoch>]: {one-line conclusion}` to the status file and stop.
If your findings reveal work that should ship (e.g. you reproduced a bug and the fix is clear), say so in the report; firstmate may promote this task in place, and you would then receive mode-specific ship instructions as a follow-up message.
- Outcome: ⚠️ 2 warnings across 1 run (4m3s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 2 warnings
  • ⚠️ Worker compliance with the new instructions remains unverified: the real Claude session stopped at workspace trust. Accepting it changes user-level configuration outside the authorized boundary. Provide an already trusted gate workspace or authorize its trust registration, then rerun live worker validation.
  • ⚠️ live validation verdict: inconclusive (1 of 6 scenarios were driven live against the product); untested: Declare an own-work wait: retain the first alert, suppress repeated wedges, and eventually recheck, Clear a wait and restore ordinary stale-worker escalation, including an unchanged pane, Leave an idle worker undeclared and confirm it still raises an alarm, A real worker declares a background-shell or foreground-command wait, then resolves it on completion, A real worker declares its pipeline wait before awaiting a backgrounded drive call
  • Live validation: ⚠️ inconclusive - 1 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Generate ship and scout briefs containing wait declarations, resolution instructions, and the active-reasoning exclusion ✅ pass live Generated brief artifacts; test_ship_and_scout_teach_validation_round_pause; test_pause_verb_override_renders_all_brief_scaffolds
Declare an own-work wait: retain the first alert, suppress repeated wedges, and eventually recheck ⏸️ untested no The prior payload records only a mocked watcher test, not a live result. A running worker and watcher must exercise the wait and recheck behavior to establish live validation.
Clear a wait and restore ordinary stale-worker escalation, including an unchanged pane ⏸️ untested no The prior payload records only automated tests with live=false, not a live result. A running worker and watcher must exercise wait clearing and subsequent stale-worker escalation.
Leave an idle worker undeclared and confirm it still raises an alarm ⏸️ untested no The prior payload records only an undeclared-worker test control with live=false, not a live result. A running watcher must observe an undeclared idle worker and raise the alarm.
A real worker declares a background-shell or foreground-command wait, then resolves it on completion ⏸️ untested no Claude requires workspace trust registration outside the permitted write boundary. Provide a trusted workspace or authorize registration before rerunning.
A real worker declares its pipeline wait before awaiting a backgrounded drive call ⏸️ untested no This phase cannot invoke or control a pipeline; the outer executor owns that lifecycle. Validate this during an authorized outer worker run.
  • git diff e9a6675ed188f3d77639cfe753451e07d68ab6a6 da2ea01c45576ba27ff2d9de0fe4549f70fb3b39
  • bin/fm-brief.sh in a disposable home: no-mistakes, direct-PR, local-only, and scout
  • Selected 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_hash
  • Launched real claude on a private lab tmux socket with a 120×40 terminal; captured workspace-trust blocker and stopped the server
  • Removed disposable homes and temporary test drivers; git status --short was clean
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

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
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: waiting-ci (contract-class: restore).

Tip vs main: Watcher already bounds wedge escalation for a declared paused: wait. Tip does not add a harness liveness source or new wait classification; it requires workers (via bin/fm-brief.sh) to declare background-shell / monitor / pipeline / long-foreground waits with the existing paused verb, keeping one first-sight alert and the long recheck cadence. Restores the existing declared-wait contract for own-work waits that were producing false wedge alarms. No Closes issue in body.

VISION.md (each rule)

  • One captain, one interface / peace of mind: aligns — cuts false stuck-worker noise without hiding real wedges (undeclared idle still alarms).
  • Authority is explicit and never inferred: aligns — no new autonomy; worker-declared wait only.
  • Scripts own the mechanics, agents own the judgment: aligns — watcher cadence stays scripted; declaration is worker judgment via existing status verbs.
  • A restart is a non-event: aligns — status-log durability unchanged.
  • Delegation with a spine: aligns — no new task shape.
  • The fleet outlives any vendor: aligns — deliberately avoids harness-owned background-state coupling.
  • Scope: aligns — supervision instructions, not workshop.

CI still running on HEAD 03b37b20818b. Attestation MATCH; NM body-compliance success. No security tip. Will squash-merge when CLEAN if still restore-ready.

@kunchenguid

Copy link
Copy Markdown
Owner

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.

@kunchenguid
kunchenguid merged commit bb69be6 into kunchenguid:main Sep 26, 2026
19 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @mremond — really appreciate you taking the time on this.

wpartin added a commit to wpartin/firstmate that referenced this pull request Sep 27, 2026
* 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)