Skip to content

fix(bin): route ask-user gates back to firstmate as needs-decision - #5

Merged
twilwa merged 3 commits into
mainfrom
fm/fm-brief-forbid-yes
Sep 22, 2026
Merged

twilwa merged 3 commits into
mainfrom
fm/fm-brief-forbid-yes

Conversation

@twilwa

@twilwa twilwa commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Intent

Backlog item fm-brief-forbid-yes (queued in the fleet backlog; dispatched by Firstmate on 2026-09-22 under standing authority). Item body:
Observed 2026-09-21: the fv-linear-maintenance worker (Codex, no-mistakes mode) ran 'no-mistakes axi run --yes --wait 8m', auto-answering two review findings that should have reached Firstmate as ask-user gates. AGENTS.md forbids --yes on validation runs but the generated ship brief's definition of done does not say so. Add one explicit line to bin/fm-brief.sh's no-mistakes DoD and to the harness-adapters skill invocation guidance: never pass --yes; gates return needs-decision to Firstmate. Low stakes; firstmate repo (validation path per the captain's TES-97 decision).

What Changed

  • bin/fm-dod-lib.sh: the generated no-mistakes definition of done now adds a line under the existing fleet-wide --yes ban stating that ask-user gates must return to firstmate as needs-decision and the worker never answers its own finding.
  • .agents/skills/harness-adapters/references/common/control-and-recovery.md: adds the same prohibition to the harness invocation guidance — never pass --yes/-y to no-mistakes axi run or no-mistakes axi respond, with ask-user gates returning as needs-decision.
  • tests/fm-brief.test.sh and tests/fm-ask-user-authority.test.sh: assert the new needs-decision sentence in the generated brief, and tighten the existing --yes assertion to match the full "It is banned fleet-wide." wording.

Risk Assessment

✅ Low: Instruction-only prose added to one generated-brief owner and one skill reference, verified against the rendered DoD output and every affected assertion, with no parsing consumer, no new behavioral branch, and no conflict with the existing needs-decision key contract.

Testing

I drove the real brief and promotion generators in an isolated FM_HOME: a no-mistakes ship brief now renders both the restored fleet-wide --yes ban and the new ask-user routing sentence, and a promoted scout receives the identical clause in the literal payload that fm-promote.sh's own fm-send command delivers. A normalized diff of every scaffold kind (ship no-mistakes/direct-PR/local-only, scout, secondmate charter) generated at base 0ec2f6c versus target 99a0187 shows exactly one added line in exactly one scaffold, so nothing leaked into the non-pipeline contracts and the pre-review wording regression the round-1 decision addressed is genuinely gone - tests/fm-task-delivery.test.sh fails at d9ac397 and passes at the target. The new assertion is load-bearing: the target test file fails against base product code and passes against target. The harness-adapters half was driven through the real routing contract, resolving operation=skill to its reference bundle and confirming the prohibition is present at target and absent at base, reaching eight operations. Five targeted suites pass with no failures. This change has no rendered UI surface, so the reviewer-visible artifacts are the generated worker-facing markdown and the captured delivery payload rather than screenshots. One scenario is untested: whether a model actually obeys the sentence needs a local Ollama evaluator this repo deliberately keeps development-only.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
An end user scaffolds a no-mistakes ship brief and the rendered Definition of done tells the worker to route ask-user gates back to firstmate ✅ pass live Ran FM_HOME=<lab> FM_ROOT_OVERRIDE=<worktree> bin/fm-brief.sh fm-brief-forbid-yes-live demo-project --mode no-mistakes in a throwaway home. The rendered Definition of done carries both `NEVER pass -…
A promoted scout worker receives the same clause through the real fm-promote delivery path ✅ pass live Scaffolded a scout brief, filled its subsections, ran bin/fm-promote.sh promote-live-nm --mode no-mistakes --yolo off, then executed the fm-send.sh command promotion printed against a stub that writ…
The change is purely additive to every generated scaffold kind, adding one line and rewriting nothing ✅ pass live Generated ship no-mistakes, direct-PR, local-only, scout, and secondmate scaffolds at base 0ec2f6c (extracted with git archive into a temp tree) and at target, normalized FM_ROOT/FM_HOME paths out,…
Adversarial: the routing clause must not leak into the direct-PR, local-only, scout, or secondmate contracts ✅ pass live Grepped the live-generated direct-PR brief, local-only brief, scout brief, and secondmate charter for the new sentence - absent from all four, consistent with the all-scaffolds diff showing those file…
Adversarial: the round-1 decision to restore the fleet-wide framing actually reaches generated worker output ✅ pass live Generated the no-mistakes DoD at the pre-review commit d9ac397 and diffed against target: d9ac397 had replaced It is banned fleet-wide. with the routing text, and the target restores that sentence a…
Adversarial: the brief must not overclaim mechanical enforcement or soften the ban into a preference ✅ pass live Grepped the live-generated brief for no-mistakes refuses, Avoid --yes, and prefer not to pass - all absent. Confirmed no mechanical guard for axi run --yes exists in bin/fm-arm-command-policy.…
The harness-adapters skill-invocation guidance an agent loads carries the --yes prohibition ✅ pass live Resolved the real harness-adapter-routing-v1 contract with jq -r '.operations.skill.default[], .harnesses.claude', then inspected the resolved bundle: the prohibition is present at target and abse…
Regression: the new brief assertion fails before the fix and passes after it ✅ pass live Copied the target tests/fm-ask-user-authority.test.sh into the base 0ec2f6c tree and ran it: not ok - generated implementation brief does not route ask-user gates back to firstmate, exit=1. The sa…
A live agent performing a skill invocation obeys the --yes prohibition it just loaded ⏸️ untested no Model compliance with a guidance sentence is deliberately development-only in this repo: tests/fm-harness-adapter-instructions-live-e2e.test.sh is gated behind FM_HARNESS_ADAPTER_INSTRUCTION_EVAL plus…
Evidence: Rendered no-mistakes Definition of done a worker receives

Source: Rendered no-mistakes Definition of done a worker receives

# Rendered no-mistakes Definition of done a worker actually receives
# produced by: FM_HOME=<lab> bin/fm-brief.sh fm-brief-forbid-yes-live demo-project --mode no-mistakes

# Definition of done
Delivery contract: mode=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.

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 and poll `no-mistakes axi status` from a separate call instead of sitting in one blocking hold your harness will kill.
Where a harness's own command limit is not established, assume it bounds commands and use that same background-and-poll shape.
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.
  Ask-user gates must return to firstmate as `needs-decision`; the worker never answers its own finding.

After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), append `done [at=<epoch>]: PR {url} checks green` and stop. You are finished.
Evidence: Generated-brief diff, base 0ec2f6c to target, all scaffold kinds

Source: Generated-brief diff, base 0ec2f6c to target, all scaffold kinds

# Normalized diff of EVERY generated scaffold kind (ship no-mistakes / direct-PR / local-only, scout, secondmate charter)
# base 0ec2f6c -> target 99a0187. FM_ROOT and FM_HOME paths normalized so only wording differences remain.
# Result: exactly one added line, only in the no-mistakes ship brief.

diff -ru /tmp/fm-live-brief.7hStU8/norm-0ec2f6c/ship-no-mistakes.md /tmp/fm-live-brief.7hStU8/norm-target/ship-no-mistakes.md
--- /tmp/fm-live-brief.7hStU8/norm-0ec2f6c/ship-no-mistakes.md	2026-09-22 06:04:00.456496886 +0200
+++ /tmp/fm-live-brief.7hStU8/norm-target/ship-no-mistakes.md	2026-09-22 06:04:00.371496082 +0200
@@ -106,5 +106,6 @@
   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.
+  Ask-user gates must return to firstmate as `needs-decision`; the worker never answers its own finding.

 After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), append `done [at=<epoch>]: PR {url} checks green` and stop. You are finished.
Evidence: Literal payload delivered to a promoted scout worker

Source: Literal payload delivered to a promoted scout worker

# Delivered worker payload from the real scout->ship promotion path
# bin/fm-promote.sh promote-live-nm --mode no-mistakes --yolo off, then the fm-send.sh delivery command it printed,
# captured by a stub fm-send.sh so this is the exact message the promoted worker receives.

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.
  Ask-user gates must return to firstmate as `needs-decision`; the worker never answers its own finding.

After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), append `done [at=<epoch>]: PR {url} checks green` and stop. You are finished.
Evidence: Regression proof: new assertion red at base, green at target

Source: Regression proof: new assertion red at base, green at target

# Regression proof: the new routing assertion is load-bearing, and the pre-review wording break was real.

## 1. Target test file run against BASE 0ec2f6c product code -- expected to FAIL
$ (in base tree) bin/fm-test-run.sh tests/fm-ask-user-authority.test.sh
not ok - generated implementation brief does not route ask-user gates back to firstmate
FM_TEST_END 2026-09-22T04:09:22Z tests/fm-ask-user-authority.test.sh exit=1 duration_ms=237 gate_skip=false

## 2. Same test at TARGET 99a0187 -- expected to PASS
$ bin/fm-test-run.sh tests/fm-ask-user-authority.test.sh
ok - primary workers and secondmates receive the authority rule through generated instructions
FM_TEST_END 2026-09-22T04:09:22Z tests/fm-ask-user-authority.test.sh exit=0 duration_ms=298 gate_skip=false
Evidence: harness-adapters skill-operation guidance resolved through the routing contract

Source: harness-adapters skill-operation guidance resolved through the routing contract

# harness-adapters skill-invocation guidance, resolved through the real routing contract

## Reference bundle the router selects for operation=skill, scenario=default, harness=claude
$ jq -r '.operations.skill.default[], .harnesses.claude' <harness-adapter-routing-v1>
references/common/control-and-recovery.md
references/harness/claude.md

## The --yes guidance present in that resolved bundle at TARGET 99a0187
.agents/skills/harness-adapters/references/common/control-and-recovery.md:28:NEVER pass `--yes` (or `-y`) to `no-mistakes axi run` or `no-mistakes axi respond`; ask-user gates must return to firstmate as `needs-decision`.

## Same grep over the BASE 0ec2f6c bundle -- no guidance existed
(no match in references/common/control-and-recovery.md)
(no match in references/harness/claude.md)

## Every operation whose bundle now carries it
start
trust
skill
interrupt
exit
resume
recovery
verify
Evidence: Targeted test run covering both changed surfaces

Source: Targeted test run covering both changed surfaces

FM_TEST_BEGIN 2026-09-22T04:09:43Z tests/fm-brief.test.sh family=pure-contract-unit expected_gate_skip=none
ok - fm-brief: scaffolds leave the worker role scope to the launch boundary and keep the secondmate contract
ok - fm-brief.sh: bash -n succeeds
/tmp/fm-test-run.eUxpzc/w1/tmp/fm-brief.CkDo0W/heredoc-in-substitution.sh:2
ok - fm-brief.sh: no heredoc is nested inside a command substitution (Bash 3.2 parse-safe)
ok - fm-brief.sh: --help renders the complete header
ok - fm-brief.sh: no-mistakes/direct-PR/local-only briefs generate cleanly
ok - fm-brief.sh: ship --mode is required and closed-set validated
ok - fm-brief.sh: the explicit ship mode wins over the registered posture
ok - fm-brief.sh: --yolo and scout/secondmate --mode are refused, never silently dropped
ok - fm-brief.sh: faster paths use configured authority without stacked review
ok - fm-brief.sh: no-mistakes DOD keeps its apostrophe prose and bans --yes outright
ok - fm-brief.sh: no-mistakes ask-user findings use one event plus a verbatim snapshot
ok - fm-brief.sh: ship project-memory wording carries the AGENTS.md authoring bar
ok - fm-brief.sh: --herdr-lab emits the complete hard safety contract
ok - fm-brief.sh: --herdr-lab uses its quoted Firstmate-owned helper path
ok - fm-brief.sh: ship and scout scaffolds make omitted Herdr intent fail-visible
ok - fm-brief.sh: the documented {TASK} and {FIRSTMATE_SPEC} fills cannot corrupt the Herdr safety gate
ok - fm-brief.sh: Herdr lab contract covers scouts and rejects secondmate misuse
ok - fm-brief.sh: --no-projects scaffolds a project-less charter and guards misuse
ok - fm-brief.sh: marked requests avoid generic acknowledgements and preserve material reporting
ok - fm-brief.sh: relative directory inputs ignore CDPATH, render stable absolute charter paths, or fail loudly
ok - fm-brief.sh: custom pause verb renders in every scaffold
ok - fm-brief.sh: ship and scout scaffolds teach validation-round pauses
ok - fm-brief.sh: investigation and visual-review completions load the shared decision policy
ok - fm-brief: scout and secondmate code paths still scaffold well-formed briefs
ok - fm-brief.sh: scout Lavish hosting follows the bootstrap lavish-axi floor
FM_TEST_END 2026-09-22T04:10:02Z tests/fm-brief.test.sh exit=0 duration_ms=19175 gate_skip=false
FM_TEST_BEGIN 2026-09-22T04:10:02Z tests/fm-task-delivery.test.sh family=pure-contract-unit expected_gate_skip=none
FM_TEST_BEGIN 2026-09-22T04:10:02Z tests/fm-documentation-audiences.test.sh family=pure-contract-unit expected_gate_skip=none
FM_TEST_BEGIN 2026-09-22T04:10:02Z tests/fm-ask-user-authority.test.sh family=pure-contract-unit expected_gate_skip=none
FM_TEST_BEGIN 2026-09-22T04:10:02Z tests/fm-harness-adapter-references.test.sh family=pure-contract-unit expected_gate_skip=none
ok - harness adapter routing artifact is normalized and every target is readable
FM_TEST_END 2026-09-22T04:10:02Z tests/fm-harness-adapter-references.test.sh exit=0 duration_ms=217 gate_skip=false
ok - primary workers and secondmates receive the authority rule through generated instructions
FM_TEST_END 2026-09-22T04:10:03Z tests/fm-ask-user-authority.test.sh exit=0 duration_ms=456 gate_skip=false
ok - documentation inventory classifies every maintained prose surface exactly once
ok - classification, setup routing, and maintained-prose scope fail safely
ok - required documentation owner pointers cannot silently disappear
ok - local links resolve while dates, versions, commands, and incident prose remain semantically reviewed
FM_TEST_END 2026-09-22T04:10:04Z tests/fm-documentation-audiences.test.sh exit=0 duration_ms=2103 gate_skip=false
ok - fm-spawn/fm-promote: authorized intent preserves exact words and refuses operator-address lines
ok - fm-spawn: every legacy worker receives scoped role instructions without changing project or primary instructions
ok - fm-spawn: a ship spawn requires a valid explicit mode and yolo before anything is created
ok - fm-spawn: scout and secondmate spawns refuse ship delivery flags
ok - fm-spawn: the brief's recorded mode and the spawn's explicit mode must agree
ok - fm-spawn: a rigor downgrade against the registered posture is announced, never blocked
ok - fm-spawn: a scout spawn resolves no delivery posture from the registry
ok - fm-promote: promotion requires the delivery contract and records it exactly once
ok - fm-promote: a symlinked task record is refused and its target is left untouched
ok - fm-promote: a promoted worker receives the same mode-specific delivery contract a briefed one does
ok - fm-project-mode: the conditional policy is accepted, mapped for mechanical callers, and readable raw
ok - fm-spawn/fm-promote: leftover Task placeholders are refused until both subsections are filled
# all fm-task-delivery tests passed
FM_TEST_END 2026-09-22T04:11:23Z tests/fm-task-delivery.test.sh exit=0 duration_ms=80749 gate_skip=false
FM_TEST_SUMMARY total=5 failed=0 skipped_gate=0 duration_ms=100639
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=5 duration_ms=102700 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-task-delivery.test.sh duration_ms=80749
FM_TEST_SLOWEST rank=2 script=tests/fm-brief.test.sh duration_ms=19175
FM_TEST_SLOWEST rank=3 script=tests/fm-documentation-audiences.test.sh duration_ms=2103
FM_TEST_SLOWEST rank=4 script=tests/fm-ask-user-authority.test.sh duration_ms=456
FM_TEST_SLOWEST rank=5 script=tests/fm-harness-adapter-references.test.sh duration_ms=217
Evidence: The three worker-facing lines as they render in a live-generated brief
$ FM_HOME=<lab> bin/fm-brief.sh fm-brief-forbid-yes-live demo-project --mode no-mistakes
scaffolded: <lab>/data/fm-brief-forbid-yes-live/brief.md (ship, mode=no-mistakes; replace {TASK} and {FIRSTMATE_SPEC})
...
- 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.
Ask-user gates must return to firstmate as `needs-decision`; the worker never answers its own finding.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed ✅
  • 🚨 tests/fm-task-delivery.test.sh:382 - Stale assertion on wording this change deleted, so the suite now fails deterministically. test_promotion_delivers_the_real_definition_of_done runs the real bin/fm-promote.sh --mode no-mistakes path, captures the delivered worker payload, and asserts assert_grep &#34;It is banned fleet-wide&#34; &#34;$payload&#34;. That payload's DoD is rendered by fm_dod_block in bin/fm-dod-lib.sh, and this change replaced It is banned fleet-wide. at bin/fm-dod-lib.sh:297 with ; ask-user gates must return to firstmate as \needs-decision`.. assert_grepis a fixed-stringgrep -F(tests/lib.sh:581), and the phrase now appears nowhere in generated output, so the grep can never match. CI runs the complete tests/*.test.sh inventory through bin/fm-test-run.sh shards (.github/workflows/ci.yml:70), so this reaches CI. The sibling assertions in tests/fm-brief.test.sh:368 and tests/fm-ask-user-authority.test.sh:24 were updated; this third one was missed. Remedy: update line 382 to the shipped clause, or drop it as redundant with tests/fm-brief.test.sh:368. If the deletion flagged in theunrequested-wording-deletion` finding is reverted instead, this break resolves itself, so settle that one first.
  • ⚠️ bin/fm-dod-lib.sh:297 - The change deletes generated-brief wording the intent did not ask to remove. The intent states: "Add one explicit line to bin/fm-brief.sh's no-mistakes DoD and to the harness-adapters skill invocation guidance: never pass --yes; gates return needs-decision to Firstmate." The DoD already carried the ban at base commit 0ec2f6c. Instead of adding, the diff rewrites the existing sentence: - NEVER pass \--yes` (or `-y`) to `no-mistakes axi run` or `no-mistakes axi respond`. It is banned fleet-wide.becomes- NEVER pass `--yes` (or `-y`) to `no-mistakes axi run` or `no-mistakes axi respond`; ask-user gates must return to firstmate as `needs-decision`., dropping It is banned fleet-wide.` from every brief generated by fm-brief.sh, fm-promote.sh, and fm-spawn.sh, which all source this single owner. The rationale comment at tests/fm-brief.test.sh:366 still reads "The --yes ban is a fleet-wide prohibition, not a preference" while the text it asserts no longer says fleet-wide. The required routing clause can be added as its own sentence with the original retained. Whether to drop the fleet-wide framing from worker-facing output is the author's deliberate call, not a defect I should resolve.
  • ℹ️ .agents/skills/harness-adapters/references/common/control-and-recovery.md:28 - Simplification pass found no unrequired component. The change introduces exactly two things: the routing clause in the DoD line and the equivalent sentence in control-and-recovery.md:28. The intent explicitly requires both locations, and control-and-recovery.md is the file the harness-adapters routing object maps to the skill operation (SKILL.md &#34;skill&#34;: {&#34;default&#34;: [&#34;references/common/control-and-recovery.md&#34;]}), so the placement matches "skill invocation guidance". Neither component adds a branch, flag, alias, mode, or fallback. The changed tests grep generated brief output (the emitted worker prompt, an intentional generated interface), not implementation source, so the test-quality rule is not violated.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
An end user scaffolds a no-mistakes ship brief and the rendered Definition of done tells the worker to route ask-user gates back to firstmate ✅ pass live Ran FM_HOME=&lt;lab&gt; FM_ROOT_OVERRIDE=&lt;worktree&gt; bin/fm-brief.sh fm-brief-forbid-yes-live demo-project --mode no-mistakes in a throwaway home. The rendered Definition of done carries both `NEVER pass -…
A promoted scout worker receives the same clause through the real fm-promote delivery path ✅ pass live Scaffolded a scout brief, filled its subsections, ran bin/fm-promote.sh promote-live-nm --mode no-mistakes --yolo off, then executed the fm-send.sh command promotion printed against a stub that writ…
The change is purely additive to every generated scaffold kind, adding one line and rewriting nothing ✅ pass live Generated ship no-mistakes, direct-PR, local-only, scout, and secondmate scaffolds at base 0ec2f6c (extracted with git archive into a temp tree) and at target, normalized FM_ROOT/FM_HOME paths out,…
Adversarial: the routing clause must not leak into the direct-PR, local-only, scout, or secondmate contracts ✅ pass live Grepped the live-generated direct-PR brief, local-only brief, scout brief, and secondmate charter for the new sentence - absent from all four, consistent with the all-scaffolds diff showing those file…
Adversarial: the round-1 decision to restore the fleet-wide framing actually reaches generated worker output ✅ pass live Generated the no-mistakes DoD at the pre-review commit d9ac397 and diffed against target: d9ac397 had replaced It is banned fleet-wide. with the routing text, and the target restores that sentence a…
Adversarial: the brief must not overclaim mechanical enforcement or soften the ban into a preference ✅ pass live Grepped the live-generated brief for no-mistakes refuses, Avoid --yes, and prefer not to pass - all absent. Confirmed no mechanical guard for axi run --yes exists in bin/fm-arm-command-policy.…
The harness-adapters skill-invocation guidance an agent loads carries the --yes prohibition ✅ pass live Resolved the real harness-adapter-routing-v1 contract with jq -r &#39;.operations.skill.default[], .harnesses.claude&#39;, then inspected the resolved bundle: the prohibition is present at target and abse…
Regression: the new brief assertion fails before the fix and passes after it ✅ pass live Copied the target tests/fm-ask-user-authority.test.sh into the base 0ec2f6c tree and ran it: not ok - generated implementation brief does not route ask-user gates back to firstmate, exit=1. The sa…
A live agent performing a skill invocation obeys the --yes prohibition it just loaded ⏸️ untested no Model compliance with a guidance sentence is deliberately development-only in this repo: tests/fm-harness-adapter-instructions-live-e2e.test.sh is gated behind FM_HARNESS_ADAPTER_INSTRUCTION_EVAL plus…
  • FM_HOME=&lt;lab&gt; FM_ROOT_OVERRIDE=&lt;worktree&gt; bin/fm-brief.sh fm-brief-forbid-yes-live demo-project --mode no-mistakes in a throwaway home, then inspection of the rendered Definition of done
  • Generated all five scaffold kinds (--mode no-mistakes, --mode direct-PR, --mode local-only, --scout, --secondmate --no-projects) at target and at base via git archive 0ec2f6c, then diff -ru of the path-normalized outputs
  • bin/fm-promote.sh promote-live-nm --mode no-mistakes --yolo off followed by the fm-send.sh delivery command it printed, run against a capturing stub to snapshot the literal worker payload
  • bin/fm-test-run.sh tests/fm-ask-user-authority.test.sh tests/fm-brief.test.sh tests/fm-task-delivery.test.sh tests/fm-harness-adapter-references.test.sh tests/fm-documentation-audiences.test.sh (5 scripts, 43 assertions, 0 failures)
  • bin/fm-test-run.sh tests/fm-ask-user-authority.test.sh inside a git archive 0ec2f6c tree carrying the target test file, proving the new assertion fails before the fix
  • bin/fm-test-run.sh tests/fm-task-delivery.test.sh inside a git archive d9ac397 tree, proving the wording break the round-1 decision fixed was real and is resolved at target
  • jq -r &#39;.operations.skill.default[], .harnesses.claude&#39; over the extracted harness-adapter-routing-v1 object, then inspection of the resolved reference bundle at target and at base
  • Adversarial greps over the live-generated briefs for leakage into non-pipeline modes and for enforcement overclaims (no-mistakes refuses, Avoid --yes, prefer not to pass)
  • grep -rn -- &#39;axi run&#39; bin/fm-arm-command-policy.mjs bin/fm-cd-command-policy.mjs bin/fm-arm-pretool-check.sh to confirm no mechanical --yes guard exists that the instruction could be overclaiming
⚠️ **Document** - 1 info
  • ℹ️ .agents/skills/harness-adapters/references/common/control-and-recovery.md:28 - Follow-up worth considering, deliberately not acted on here. The --yes ban prose now lives in four surfaces: bin/fm-dod-lib.sh:297-299 (worker-facing generated brief), this skill reference, AGENTS.md:385 (firstmate relay contract), and CONTRIBUTING.md:92 (contributor mechanics). All four are consistent today and each serves a distinct audience, so none is stale and none needed an edit. The maintenance cost is that the DoD copy is pinned by tests/fm-brief.test.sh:368-371 and tests/fm-ask-user-authority.test.sh:24-28 while this skill-reference copy is pinned by nothing, so a future rewording can silently drift here. Removing or reducing this line to a pointer is out of scope: the user intent explicitly required an explicit line in the harness-adapters skill invocation guidance. A follow-up could instead pin this line with a regression assertion, keeping both copies verbatim-equal by test rather than by convention.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Summary by Sourcery

Ensure no-mistakes workers escalate ask-user findings to Firstmate and never auto-resolve validation gates.

Bug Fixes:

  • Route ask-user gates from no-mistakes validation back to Firstmate as needs-decision instead of allowing workers to answer them.

Enhancements:

  • Strengthen no-mistakes worker and harness-adapter guidance by explicitly prohibiting --yes and -y invocation flags.
  • Stabilize the branch-extension regression test around the wake prompt rather than session creation.

Tests:

  • Update brief and authority tests to verify the fleet-wide --yes prohibition and required ask-user routing guidance.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @twilwa, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 22 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T04:20:17.706044Z 99a0187 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai

sourcery-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This instruction-only change prevents Firstmate-dispatched no-mistakes workers from silently resolving ask-user findings: generated briefs and harness-adapter guidance now prohibit --yes and require escalation as needs-decision, with targeted and live generation/promotion tests confirming the wording reaches the intended worker-facing surfaces without leaking into other scaffold contracts.

Sequence diagram for routing ask-user gates to Firstmate

sequenceDiagram
    participant Worker
    participant NoMistakes
    participant Firstmate

    Worker->>NoMistakes: no-mistakes axi run
    NoMistakes-->>Worker: ask-user gate
    Worker-->>Firstmate: needs-decision
    Firstmate->>Firstmate: Apply ask-user-authority
    Firstmate-->>Worker: Decision
    Worker->>NoMistakes: no-mistakes axi respond
Loading

File-Level Changes

Change Details Files
Clarify the no-mistakes worker contract for ask-user gate escalation.
  • Add an explicit generated DoD instruction that ask-user gates return to Firstmate as needs-decision and are never answered by the worker.
  • Preserve the existing fleet-wide --yes prohibition and explain that --yes auto-resolves gates without escalation.
bin/fm-dod-lib.sh
Align harness-adapter invocation guidance with the Firstmate gate-routing contract.
  • Prohibit --yes/-y for both no-mistakes axi run and no-mistakes axi respond.
  • Require ask-user gates to be returned to Firstmate as needs-decision.
.agents/skills/harness-adapters/references/common/control-and-recovery.md
Add regression coverage for the generated routing and prohibition wording.
  • Assert the complete fleet-wide --yes ban wording.
  • Assert the new needs-decision routing sentence in generated no-mistakes briefs.
tests/fm-brief.test.sh
tests/fm-ask-user-authority.test.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

…e serial 4" shard. Failure: tests/fm-pi-branch-extension.test.sh -> test_captain_outcome_processing_turn_is_sequence_keyed_and_re_presented, with "Error: supervision branch prompt settled but produced no durable outcome for its claimed wake rows" (thrown at .pi/extensions/fm-branch-supervision.ts:1548). Nothing in this PR's diff (the --yes DoD line, the harness-adapters sentence, three brief assertions) touches that extension or test; the other two check runs on the same head commit (99a0187) passed. It is a pre-existing race that surfaces on a slow/loaded runner. Root cause: in fm-branch-supervision.ts a wake builds the branch session (ensureBranch), then runs several awaited subprocesses (flushMirror, actingAsOwner, scopeForUnreadWake, writeEligibleRowsSnapshot, away-posture read-back) and only then snapshots reportRevisionBeforePrompt immediately before session.prompt(...); after the prompt settles it requires that revision to have advanced. The test synchronized on the wrong point: `settle(() => __fmSessions.length === 2, "replacement branch session")`. Session creation precedes that snapshot, so when the extension's pre-prompt work is slower than the test's report append, report2's durable append lands before the snapshot and the wake rejects its own settled prompt as outcome-less. The routine wake earlier in the same test already waits on __fmPrompts.length === 1 and is unaffected. Fix (tests/fm-pi-branch-extension.test.sh:1377, 9 insertions / 1 deletion): wait for the wake prompt as well as the replacement session, matching the routine wake's own idiom, with a comment naming why the built session is not the synchronization point. No production code changed; no new machinery. Verification: reproduced the exact CI error deterministically by temporarily injecting a delay ahead of reportRevisionBeforePrompt (delays 100/200/300/400/500/700 ms all failed with the identical message); that injection was reverted (git status shows only the test file modified). With the fix the test passes under injected delays of 100, 400 and 1500 ms. Full file run: exit 0, 45 tests passing. 24 parallel runs of the target test: 24/24 pass. shellcheck -x on the changed file is clean, and this PR's own tests (tests/fm-brief.test.sh, tests/fm-ask-user-authority.test.sh) still pass. The change is left uncommitted in the worktree, since prior rounds' commits on this branch were made by the executor rather than this phase
@twilwa
twilwa merged commit c8e0ea6 into main Sep 22, 2026
21 checks passed
twilwa added a commit that referenced this pull request Sep 25, 2026
* fix(brief): forbid validation auto-accept

* no-mistakes(review): restore fleet-wide --yes ban, add ask-user routing sentence

* no-mistakes(ci): Fixed a flaky test that failed the "Behavior portable serial 4" shard. Failure: tests/fm-pi-branch-extension.test.sh -> test_captain_outcome_processing_turn_is_sequence_keyed_and_re_presented, with "Error: supervision branch prompt settled but produced no durable outcome for its claimed wake rows" (thrown at .pi/extensions/fm-branch-supervision.ts:1548). Nothing in this PR's diff (the --yes DoD line, the harness-adapters sentence, three brief assertions) touches that extension or test; the other two check runs on the same head commit (99a0187) passed. It is a pre-existing race that surfaces on a slow/loaded runner. Root cause: in fm-branch-supervision.ts a wake builds the branch session (ensureBranch), then runs several awaited subprocesses (flushMirror, actingAsOwner, scopeForUnreadWake, writeEligibleRowsSnapshot, away-posture read-back) and only then snapshots reportRevisionBeforePrompt immediately before session.prompt(...); after the prompt settles it requires that revision to have advanced. The test synchronized on the wrong point: `settle(() => __fmSessions.length === 2, "replacement branch session")`. Session creation precedes that snapshot, so when the extension's pre-prompt work is slower than the test's report append, report2's durable append lands before the snapshot and the wake rejects its own settled prompt as outcome-less. The routine wake earlier in the same test already waits on __fmPrompts.length === 1 and is unaffected. Fix (tests/fm-pi-branch-extension.test.sh:1377, 9 insertions / 1 deletion): wait for the wake prompt as well as the replacement session, matching the routine wake's own idiom, with a comment naming why the built session is not the synchronization point. No production code changed; no new machinery. Verification: reproduced the exact CI error deterministically by temporarily injecting a delay ahead of reportRevisionBeforePrompt (delays 100/200/300/400/500/700 ms all failed with the identical message); that injection was reverted (git status shows only the test file modified). With the fix the test passes under injected delays of 100, 400 and 1500 ms. Full file run: exit 0, 45 tests passing. 24 parallel runs of the target test: 24/24 pass. shellcheck -x on the changed file is clean, and this PR's own tests (tests/fm-brief.test.sh, tests/fm-ask-user-authority.test.sh) still pass. The change is left uncommitted in the worktree, since prior rounds' commits on this branch were made by the executor rather than this phase
twilwa added a commit that referenced this pull request Sep 25, 2026
…merge handoff (#16)

* feat(bin): pin resolver model and persist dispatch decision receipts (#1)

* Fix dispatch resolver model and receipts

* no-mistakes(review): Drop model-drift branch, harden receipt lock and brief join

* no-mistakes(review): Scope receipt recording to clear, report failed joins, measure latency

* no-mistakes(review): Narrow dispatch clause and concurrency test, shrink lock budget

* no-mistakes(review): Accept --project on the join, assert drop-or-append concurrency

* no-mistakes(review): Split lock budgets by path, drop receipt size bound

* no-mistakes(review): Record brief_path as spelled, drop abs_path normalization

* no-mistakes(review): Pin model in contract, bound receipt latency, record reason

* no-mistakes(review): Report dropped resolution receipts, project profile agreement, drop dispatch_id

* no-mistakes(review): Enforce append-only cmp, complete join example, govern latency bound

* no-mistakes(review): Keep no-rules exit 0 without jq, dedupe error default

* no-mistakes(review): Refuse symlinked receipts path, drop dead no_rules jq argument

* no-mistakes(document): Document receipt identity, symlink refusal, jq exit narrowing

* fix(bin): refuse unknown flags and stray --key arguments in fm-send (#3)

* fix(bin): refuse an unrecognised fm-send flag instead of sending it as text

fm-send's option loop ended in an unconditional `*) break ;;`, so any token
it did not recognise - including one obviously shaped as a flag - fell out of
the loop and became the positional message body. A steer invoked with a flag
that does not exist was durably written into a live worker's steering inbox as
the literal flag string while fm-send exited 0, so the worker was mis-steered
and the caller got a success code and no diagnostic.

The accepted set is now an allowlist rather than a pattern. --key is a real,
supported flag parsed after this loop and must keep falling through it
untouched, so a blanket "starts with -- and matched no case arm, therefore
refuse" rule would have broken it.

A bare -- ends flag parsing, which is how a message whose text starts with --
is sent. That separator is threaded to the two --key dispatch points so text
after it is text everywhere rather than being re-parsed as a flag. A
single-dash word was never a flag here and still needs no separator.

The refusal exits before anything is marked, recorded, rung, or typed, the
same discipline the header already applies to an empty message.

* no-mistakes(review): drop -- end-of-flags separator, keep pure flag allowlist

* no-mistakes(document): document fm-send's flag allowlist and leading-`--` message limit

* docs(bin): drop the flag-allowlist commentary from fm-send's source

The header block in bin/fm-send.sh is that script's documented contract.
Recording the no-end-of-flags-separator limitation there amends that
contract and turns a deliberate, narrow behaviour change into a
documented guarantee the project would then owe. The rationale comment
above the option loop goes for the same reason: the limitation describes
a decision, which belongs in the pull request, not in the source, where
it reads as a promise.

Removes only those thirteen comment lines. The refusal itself is
unchanged: the option loop remains a pure allowlist, --key still falls
through to its own plane untouched, there is no end-of-flags handling,
the usage line is unmodified, and the tests are untouched.

* fix(bin): refuse trailing arguments after fm-send's --key

The option loop breaks at --key without consuming what follows it, and
the key path reads only the key itself, so every remaining argument was
discarded in silence while the key was still delivered and the command
still exited 0. `fm-send.sh lane --key Enter --not-a-real-flag` sent
Enter and reported success. That is the same silent-delivery shape the
unknown-flag refusal in this change exists to remove, so the key path
contradicted the contract on that one path.

The same ordering bypassed the --fire-and-forget incompatibility:
FIRE_AND_FORGET_ID is only set when the flag precedes --key, so
`--key Enter --fire-and-forget x` passed both existing guards.

The key path now refuses any trailing argument before delivering the
key, naming the offending token in the wording already used for an
unknown flag in flag position, and names --fire-and-forget specifically
so that incompatibility holds on either ordering. Adds regression
coverage for both orderings and for a trailing plain word; both new
tests fail before this commit and pass after it.

* Add head-keyed PR review and post-merge QA gates (#4)

* Add head-keyed PR review policy ledger

* Add post-merge browser QA gate

* Fix PR review and post-merge gates

* Close remaining PR review gate gaps

* Harden migration risk and QA evidence parsing

* Close PR review guard bypasses

* Tighten review evidence boundaries

* Bind final review authorization

* Invalidate stale review dispositions

* Harden review evidence validation

* feat(bin): record captain decision deferrals as dated answers (#2)

* Add keyed decision defer mode

* no-mistakes(review): Fix defer date identity, hold age, parent channel, reporting

* no-mistakes(review): Derive board defer from the option's until alone

* no-mistakes(review): Show the defer date on the board card

* Fix deferred decision lifecycle edges

* no-mistakes(review): Drop fabricated defer hold reason fallback

* no-mistakes(document): Correct stale captain-defer docs for the recorded answer path

* Fix defer intake failure edges

* Require future dates for decision defers

* no-mistakes(review): Narrow UTC day parsing; fix elapsed-defer recovery guidance

* no-mistakes(review): Refuse duplicate board option values; fix defer recovery wording

* Stabilize chat defer hold assertion

* Keep chat defer date stable across midnight

* Refactor defer validation for bounded lint

* fix(bin): route ask-user gates back to firstmate as needs-decision (#5)

* fix(brief): forbid validation auto-accept

* no-mistakes(review): restore fleet-wide --yes ban, add ask-user routing sentence

* no-mistakes(ci): Fixed a flaky test that failed the "Behavior portable serial 4" shard. Failure: tests/fm-pi-branch-extension.test.sh -> test_captain_outcome_processing_turn_is_sequence_keyed_and_re_presented, with "Error: supervision branch prompt settled but produced no durable outcome for its claimed wake rows" (thrown at .pi/extensions/fm-branch-supervision.ts:1548). Nothing in this PR's diff (the --yes DoD line, the harness-adapters sentence, three brief assertions) touches that extension or test; the other two check runs on the same head commit (99a0187) passed. It is a pre-existing race that surfaces on a slow/loaded runner. Root cause: in fm-branch-supervision.ts a wake builds the branch session (ensureBranch), then runs several awaited subprocesses (flushMirror, actingAsOwner, scopeForUnreadWake, writeEligibleRowsSnapshot, away-posture read-back) and only then snapshots reportRevisionBeforePrompt immediately before session.prompt(...); after the prompt settles it requires that revision to have advanced. The test synchronized on the wrong point: `settle(() => __fmSessions.length === 2, "replacement branch session")`. Session creation precedes that snapshot, so when the extension's pre-prompt work is slower than the test's report append, report2's durable append lands before the snapshot and the wake rejects its own settled prompt as outcome-less. The routine wake earlier in the same test already waits on __fmPrompts.length === 1 and is unaffected. Fix (tests/fm-pi-branch-extension.test.sh:1377, 9 insertions / 1 deletion): wait for the wake prompt as well as the replacement session, matching the routine wake's own idiom, with a comment naming why the built session is not the synchronization point. No production code changed; no new machinery. Verification: reproduced the exact CI error deterministically by temporarily injecting a delay ahead of reportRevisionBeforePrompt (delays 100/200/300/400/500/700 ms all failed with the identical message); that injection was reverted (git status shows only the test file modified). With the fix the test passes under injected delays of 100, 400 and 1500 ms. Full file run: exit 0, 45 tests passing. 24 parallel runs of the target test: 24/24 pass. shellcheck -x on the changed file is clean, and this PR's own tests (tests/fm-brief.test.sh, tests/fm-ask-user-authority.test.sh) still pass. The change is left uncommitted in the worktree, since prior rounds' commits on this branch were made by the executor rather than this phase

* refactor(agents): move conditional workflows into skills (#6)

* docs: audit AGENTS.md size and ownership

* docs: slim always-loaded Firstmate contract

* no-mistakes(review): drop audit doc, dedupe skill triggers, fix stale pointers

* no-mistakes(review): fix yolo brief split, state guard, and stale pointers

* no-mistakes(review): restore backstop wake duty, dedupe trigger, repoint pointers

* no-mistakes(document): Repoint stale brief guidance comment

* docs: cover omitted conditional skill load triggers

* fix: bind resolver requests to immutable brief snapshots

* fix(bin): bound session-start cleanup, defer summary publication, and avoid jq argv overflow (#10)

* fix: bound startup reconciliation and large fleet input

* no-mistakes(review): Drop redundant contribution-input EXIT trap in fleet snapshot

* no-mistakes(test): Widen cleanup deadline test budget to avoid load flakes

* no-mistakes(document): Document startup summary deferral and herdr cleanup deadline

* no-mistakes(ci): Lint 1 failed because ShellCheck SC2329 ("function never invoked") fired at tests/fm-herdr-session-cleanup.test.sh:356. That line is a subshell copy of fixture_workspaces that replaces the file's main version. The fake herdr command calls fixture_workspaces indirectly when it answers `workspace list` and `api snapshot`, and ShellCheck can't see that call. The fix is one comment line above the replacement: `# shellcheck disable=SC2329 # invoked indirectly by the fake herdr workspace list.` The same file already does this for its other indirectly-called replacements (lines 43 and 49), as do tests/fm-daemon.test.sh and tests/fm-bootstrap.test.sh. No behavior changed. Checked locally: `bin/fm-lint.sh tests/fm-herdr-session-cleanup.test.sh` passes with pinned ShellCheck 0.11.0 and full extended analysis, and `bash tests/fm-herdr-session-cleanup.test.sh` passes every test, including the journal-read-count, deadline, lock and identity tests. The change is not committed

* fix: reclaim cleanup locks after hard timeout

* no-mistakes(review): Use shared fm_lock receipts lock; synthesize ledger fixtures

(cherry picked from commit 5118fbce1f5ba294d74ec0862913a5c4bce7129d)

* no-mistakes(document): Document cleanup lock reclaim and receipt state path

(cherry picked from commit 53740853205c45ae4c8b835656224a60708998d6)

* no-mistakes(review): Skip torn receipt lines, clear lock record, list --defer-until

* no-mistakes(review): Start each receipt append on its own line

* no-mistakes(document): Document torn receipt-line handling in dispatch receipts

* no-mistakes(document): Mark dispatch receipt cost figures historical, pending remeasurement

* no-mistakes(ci): ci-2 (Lint 2), caused by this PR, fixed. Invariant: a function only ever called by a trap must carry `# shellcheck disable=SC2329`, or the full-analysis lint fails. This PR added `reap_zombie_owner` in tests/fm-herdr-session-cleanup.test.sh, called only by `trap reap_zombie_owner EXIT`, without that directive. A local run of `bin/fm-lint.sh --partition 2of2` with the pinned ShellCheck 0.11.0 exited 1 with that single SC2329 finding (line 454). In CI the job was stopped (exit 143) at about 10.5 minutes, before it printed the finding; main's partition 2 took 441 s. Fix: added the directive, worded like the file's existing ones (lines 43, 49, 365). No other sites: that was the only partition-2 finding, and partition 1 passed in CI. Verified: `shellcheck --norc --external-sources -- tests/fm-herdr-session-cleanup.test.sh` exits 0. Not rerun: the full 24-minute partition after the fix, and the test itself (Test stays skipped). The fix is uncommitted in the worktree. ci-1 (Behavior portable serial 3), not caused by this PR, flaky, no change. The only failure is tests/fm-watch-checkpoint.test.sh, "watch lock pid survived quiet checkpoint timeout". bin/fm-watch.sh takes its singleton lock at line 2327 but only sets up its cleanup-on-exit trap at 2456; a timeout in between leaves .watch.lock/pid behind. Reproduced locally: `timeout 0.6`–`1.0` leaves the pid file, 0.2/0.4/1.5/2 s do not. fm-watch.sh, fm-watch-checkpoint.sh and the test are unchanged from base 040b337. The only changed file the watcher uses (fm-captain-hold.sh) runs at wake time, not during startup. The same code passed on main. Closing the gap means changing upstream watcher code, beyond this carry-forward; worth fixing separately. ci-3 (PR must be raised via no-mistakes), not caused by the code, no change. It fails with "Required no-mistakes pipeline steps are not completed: test (status=skipped)", which is expected because the user intent keeps Test skipped. ci-4 (Review changed files (advisory)), external, no change. It fails with "No OpenRouter API key configured": a missing repository secret, not a code defect

* fix: make reviewed-head merge handoff opt-in

* no-mistakes(review): Keep collector inline feedback; refuse held direct merges

* no-mistakes(review): Attribute ledger merge checks; name configured high-stakes model
twilwa added a commit that referenced this pull request Sep 26, 2026
…'s Git common directory (#8)

* feat(bin): pin resolver model and persist dispatch decision receipts (#1)

* Fix dispatch resolver model and receipts

* no-mistakes(review): Drop model-drift branch, harden receipt lock and brief join

* no-mistakes(review): Scope receipt recording to clear, report failed joins, measure latency

* no-mistakes(review): Narrow dispatch clause and concurrency test, shrink lock budget

* no-mistakes(review): Accept --project on the join, assert drop-or-append concurrency

* no-mistakes(review): Split lock budgets by path, drop receipt size bound

* no-mistakes(review): Record brief_path as spelled, drop abs_path normalization

* no-mistakes(review): Pin model in contract, bound receipt latency, record reason

* no-mistakes(review): Report dropped resolution receipts, project profile agreement, drop dispatch_id

* no-mistakes(review): Enforce append-only cmp, complete join example, govern latency bound

* no-mistakes(review): Keep no-rules exit 0 without jq, dedupe error default

* no-mistakes(review): Refuse symlinked receipts path, drop dead no_rules jq argument

* no-mistakes(document): Document receipt identity, symlink refusal, jq exit narrowing

* fix(bin): refuse unknown flags and stray --key arguments in fm-send (#3)

* fix(bin): refuse an unrecognised fm-send flag instead of sending it as text

fm-send's option loop ended in an unconditional `*) break ;;`, so any token
it did not recognise - including one obviously shaped as a flag - fell out of
the loop and became the positional message body. A steer invoked with a flag
that does not exist was durably written into a live worker's steering inbox as
the literal flag string while fm-send exited 0, so the worker was mis-steered
and the caller got a success code and no diagnostic.

The accepted set is now an allowlist rather than a pattern. --key is a real,
supported flag parsed after this loop and must keep falling through it
untouched, so a blanket "starts with -- and matched no case arm, therefore
refuse" rule would have broken it.

A bare -- ends flag parsing, which is how a message whose text starts with --
is sent. That separator is threaded to the two --key dispatch points so text
after it is text everywhere rather than being re-parsed as a flag. A
single-dash word was never a flag here and still needs no separator.

The refusal exits before anything is marked, recorded, rung, or typed, the
same discipline the header already applies to an empty message.

* no-mistakes(review): drop -- end-of-flags separator, keep pure flag allowlist

* no-mistakes(document): document fm-send's flag allowlist and leading-`--` message limit

* docs(bin): drop the flag-allowlist commentary from fm-send's source

The header block in bin/fm-send.sh is that script's documented contract.
Recording the no-end-of-flags-separator limitation there amends that
contract and turns a deliberate, narrow behaviour change into a
documented guarantee the project would then owe. The rationale comment
above the option loop goes for the same reason: the limitation describes
a decision, which belongs in the pull request, not in the source, where
it reads as a promise.

Removes only those thirteen comment lines. The refusal itself is
unchanged: the option loop remains a pure allowlist, --key still falls
through to its own plane untouched, there is no end-of-flags handling,
the usage line is unmodified, and the tests are untouched.

* fix(bin): refuse trailing arguments after fm-send's --key

The option loop breaks at --key without consuming what follows it, and
the key path reads only the key itself, so every remaining argument was
discarded in silence while the key was still delivered and the command
still exited 0. `fm-send.sh lane --key Enter --not-a-real-flag` sent
Enter and reported success. That is the same silent-delivery shape the
unknown-flag refusal in this change exists to remove, so the key path
contradicted the contract on that one path.

The same ordering bypassed the --fire-and-forget incompatibility:
FIRE_AND_FORGET_ID is only set when the flag precedes --key, so
`--key Enter --fire-and-forget x` passed both existing guards.

The key path now refuses any trailing argument before delivering the
key, naming the offending token in the wording already used for an
unknown flag in flag position, and names --fire-and-forget specifically
so that incompatibility holds on either ordering. Adds regression
coverage for both orderings and for a trailing plain word; both new
tests fail before this commit and pass after it.

* Add head-keyed PR review and post-merge QA gates (#4)

* Add head-keyed PR review policy ledger

* Add post-merge browser QA gate

* Fix PR review and post-merge gates

* Close remaining PR review gate gaps

* Harden migration risk and QA evidence parsing

* Close PR review guard bypasses

* Tighten review evidence boundaries

* Bind final review authorization

* Invalidate stale review dispositions

* Harden review evidence validation

* feat(bin): record captain decision deferrals as dated answers (#2)

* Add keyed decision defer mode

* no-mistakes(review): Fix defer date identity, hold age, parent channel, reporting

* no-mistakes(review): Derive board defer from the option's until alone

* no-mistakes(review): Show the defer date on the board card

* Fix deferred decision lifecycle edges

* no-mistakes(review): Drop fabricated defer hold reason fallback

* no-mistakes(document): Correct stale captain-defer docs for the recorded answer path

* Fix defer intake failure edges

* Require future dates for decision defers

* no-mistakes(review): Narrow UTC day parsing; fix elapsed-defer recovery guidance

* no-mistakes(review): Refuse duplicate board option values; fix defer recovery wording

* Stabilize chat defer hold assertion

* Keep chat defer date stable across midnight

* Refactor defer validation for bounded lint

* fix(bin): route ask-user gates back to firstmate as needs-decision (#5)

* fix(brief): forbid validation auto-accept

* no-mistakes(review): restore fleet-wide --yes ban, add ask-user routing sentence

* no-mistakes(ci): Fixed a flaky test that failed the "Behavior portable serial 4" shard. Failure: tests/fm-pi-branch-extension.test.sh -> test_captain_outcome_processing_turn_is_sequence_keyed_and_re_presented, with "Error: supervision branch prompt settled but produced no durable outcome for its claimed wake rows" (thrown at .pi/extensions/fm-branch-supervision.ts:1548). Nothing in this PR's diff (the --yes DoD line, the harness-adapters sentence, three brief assertions) touches that extension or test; the other two check runs on the same head commit (99a0187) passed. It is a pre-existing race that surfaces on a slow/loaded runner. Root cause: in fm-branch-supervision.ts a wake builds the branch session (ensureBranch), then runs several awaited subprocesses (flushMirror, actingAsOwner, scopeForUnreadWake, writeEligibleRowsSnapshot, away-posture read-back) and only then snapshots reportRevisionBeforePrompt immediately before session.prompt(...); after the prompt settles it requires that revision to have advanced. The test synchronized on the wrong point: `settle(() => __fmSessions.length === 2, "replacement branch session")`. Session creation precedes that snapshot, so when the extension's pre-prompt work is slower than the test's report append, report2's durable append lands before the snapshot and the wake rejects its own settled prompt as outcome-less. The routine wake earlier in the same test already waits on __fmPrompts.length === 1 and is unaffected. Fix (tests/fm-pi-branch-extension.test.sh:1377, 9 insertions / 1 deletion): wait for the wake prompt as well as the replacement session, matching the routine wake's own idiom, with a comment naming why the built session is not the synchronization point. No production code changed; no new machinery. Verification: reproduced the exact CI error deterministically by temporarily injecting a delay ahead of reportRevisionBeforePrompt (delays 100/200/300/400/500/700 ms all failed with the identical message); that injection was reverted (git status shows only the test file modified). With the fix the test passes under injected delays of 100, 400 and 1500 ms. Full file run: exit 0, 45 tests passing. 24 parallel runs of the target test: 24/24 pass. shellcheck -x on the changed file is clean, and this PR's own tests (tests/fm-brief.test.sh, tests/fm-ask-user-authority.test.sh) still pass. The change is left uncommitted in the worktree, since prior rounds' commits on this branch were made by the executor rather than this phase

* fix(spawn): bind worker pool allocations to clone custody

* no-mistakes(ci): Updated the verified CI Treehouse pin from v2.0.1 to v2.3.0 with official platform checksums. The Herdr failures were caused by v2.0.1 lacking the required `--root` capability. Verified installer download/checksum/version, `--root` support, lint, clone-custody regression, and dispatch-resolve regression. The portable failure was an unrelated transient broken-pipe race in unchanged code and passed locally

* no-mistakes(ci): Fixed the flaky broken-pipe failure in bin/fm-quota-axi-lib.sh by replacing the private process-substitution lookup with a direct case mapping. This preserves all provider mappings while preventing an early consumer exit from closing the producer pipe and leaking `printf: write error: Broken pipe` to stderr. Verified with tests/fm-dispatch-resolve.test.sh, bin/fm-lint.sh, and git diff --check; all passed

* no-mistakes(review): Move pool root outside homes; drop fork fixtures

* no-mistakes(document): Point architecture doc at real Treehouse custody regression

* no-mistakes(ci): ci-1 (Behavior portable serial 8): tests/fm-tangle-guard.test.sh still expected the old `treehouse get --root '<root>'` command, but this PR sends `treehouse --root '<root>' get` (bin/fm-spawn.sh:4049; `--root` is a global Treehouse flag, so both orders are valid). Updated the test to expect the new order; no production code changed. The failure reproduced locally before the fix and the script exits 0 after it. No other test, doc or script uses the old order. ci-2 (PR must be raised via no-mistakes): attestation failure because the pipeline's required `test` step is skipped (the Test agent timed out and the re-run was declined). Not caused by the code; the outer pipeline must re-run and complete the test step

---------

Co-authored-by: Firstmate Crew <[email protected]>
twilwa added a commit that referenced this pull request Sep 26, 2026
…mary landing (#26)

* feat(bin): pin resolver model and persist dispatch decision receipts (#1)

* Fix dispatch resolver model and receipts

* no-mistakes(review): Drop model-drift branch, harden receipt lock and brief join

* no-mistakes(review): Scope receipt recording to clear, report failed joins, measure latency

* no-mistakes(review): Narrow dispatch clause and concurrency test, shrink lock budget

* no-mistakes(review): Accept --project on the join, assert drop-or-append concurrency

* no-mistakes(review): Split lock budgets by path, drop receipt size bound

* no-mistakes(review): Record brief_path as spelled, drop abs_path normalization

* no-mistakes(review): Pin model in contract, bound receipt latency, record reason

* no-mistakes(review): Report dropped resolution receipts, project profile agreement, drop dispatch_id

* no-mistakes(review): Enforce append-only cmp, complete join example, govern latency bound

* no-mistakes(review): Keep no-rules exit 0 without jq, dedupe error default

* no-mistakes(review): Refuse symlinked receipts path, drop dead no_rules jq argument

* no-mistakes(document): Document receipt identity, symlink refusal, jq exit narrowing

* fix(bin): refuse unknown flags and stray --key arguments in fm-send (#3)

* fix(bin): refuse an unrecognised fm-send flag instead of sending it as text

fm-send's option loop ended in an unconditional `*) break ;;`, so any token
it did not recognise - including one obviously shaped as a flag - fell out of
the loop and became the positional message body. A steer invoked with a flag
that does not exist was durably written into a live worker's steering inbox as
the literal flag string while fm-send exited 0, so the worker was mis-steered
and the caller got a success code and no diagnostic.

The accepted set is now an allowlist rather than a pattern. --key is a real,
supported flag parsed after this loop and must keep falling through it
untouched, so a blanket "starts with -- and matched no case arm, therefore
refuse" rule would have broken it.

A bare -- ends flag parsing, which is how a message whose text starts with --
is sent. That separator is threaded to the two --key dispatch points so text
after it is text everywhere rather than being re-parsed as a flag. A
single-dash word was never a flag here and still needs no separator.

The refusal exits before anything is marked, recorded, rung, or typed, the
same discipline the header already applies to an empty message.

* no-mistakes(review): drop -- end-of-flags separator, keep pure flag allowlist

* no-mistakes(document): document fm-send's flag allowlist and leading-`--` message limit

* docs(bin): drop the flag-allowlist commentary from fm-send's source

The header block in bin/fm-send.sh is that script's documented contract.
Recording the no-end-of-flags-separator limitation there amends that
contract and turns a deliberate, narrow behaviour change into a
documented guarantee the project would then owe. The rationale comment
above the option loop goes for the same reason: the limitation describes
a decision, which belongs in the pull request, not in the source, where
it reads as a promise.

Removes only those thirteen comment lines. The refusal itself is
unchanged: the option loop remains a pure allowlist, --key still falls
through to its own plane untouched, there is no end-of-flags handling,
the usage line is unmodified, and the tests are untouched.

* fix(bin): refuse trailing arguments after fm-send's --key

The option loop breaks at --key without consuming what follows it, and
the key path reads only the key itself, so every remaining argument was
discarded in silence while the key was still delivered and the command
still exited 0. `fm-send.sh lane --key Enter --not-a-real-flag` sent
Enter and reported success. That is the same silent-delivery shape the
unknown-flag refusal in this change exists to remove, so the key path
contradicted the contract on that one path.

The same ordering bypassed the --fire-and-forget incompatibility:
FIRE_AND_FORGET_ID is only set when the flag precedes --key, so
`--key Enter --fire-and-forget x` passed both existing guards.

The key path now refuses any trailing argument before delivering the
key, naming the offending token in the wording already used for an
unknown flag in flag position, and names --fire-and-forget specifically
so that incompatibility holds on either ordering. Adds regression
coverage for both orderings and for a trailing plain word; both new
tests fail before this commit and pass after it.

* Add head-keyed PR review and post-merge QA gates (#4)

* Add head-keyed PR review policy ledger

* Add post-merge browser QA gate

* Fix PR review and post-merge gates

* Close remaining PR review gate gaps

* Harden migration risk and QA evidence parsing

* Close PR review guard bypasses

* Tighten review evidence boundaries

* Bind final review authorization

* Invalidate stale review dispositions

* Harden review evidence validation

* feat(bin): record captain decision deferrals as dated answers (#2)

* Add keyed decision defer mode

* no-mistakes(review): Fix defer date identity, hold age, parent channel, reporting

* no-mistakes(review): Derive board defer from the option's until alone

* no-mistakes(review): Show the defer date on the board card

* Fix deferred decision lifecycle edges

* no-mistakes(review): Drop fabricated defer hold reason fallback

* no-mistakes(document): Correct stale captain-defer docs for the recorded answer path

* Fix defer intake failure edges

* Require future dates for decision defers

* no-mistakes(review): Narrow UTC day parsing; fix elapsed-defer recovery guidance

* no-mistakes(review): Refuse duplicate board option values; fix defer recovery wording

* Stabilize chat defer hold assertion

* Keep chat defer date stable across midnight

* Refactor defer validation for bounded lint

* fix(bin): route ask-user gates back to firstmate as needs-decision (#5)

* fix(brief): forbid validation auto-accept

* no-mistakes(review): restore fleet-wide --yes ban, add ask-user routing sentence

* no-mistakes(ci): Fixed a flaky test that failed the "Behavior portable serial 4" shard. Failure: tests/fm-pi-branch-extension.test.sh -> test_captain_outcome_processing_turn_is_sequence_keyed_and_re_presented, with "Error: supervision branch prompt settled but produced no durable outcome for its claimed wake rows" (thrown at .pi/extensions/fm-branch-supervision.ts:1548). Nothing in this PR's diff (the --yes DoD line, the harness-adapters sentence, three brief assertions) touches that extension or test; the other two check runs on the same head commit (99a0187) passed. It is a pre-existing race that surfaces on a slow/loaded runner. Root cause: in fm-branch-supervision.ts a wake builds the branch session (ensureBranch), then runs several awaited subprocesses (flushMirror, actingAsOwner, scopeForUnreadWake, writeEligibleRowsSnapshot, away-posture read-back) and only then snapshots reportRevisionBeforePrompt immediately before session.prompt(...); after the prompt settles it requires that revision to have advanced. The test synchronized on the wrong point: `settle(() => __fmSessions.length === 2, "replacement branch session")`. Session creation precedes that snapshot, so when the extension's pre-prompt work is slower than the test's report append, report2's durable append lands before the snapshot and the wake rejects its own settled prompt as outcome-less. The routine wake earlier in the same test already waits on __fmPrompts.length === 1 and is unaffected. Fix (tests/fm-pi-branch-extension.test.sh:1377, 9 insertions / 1 deletion): wait for the wake prompt as well as the replacement session, matching the routine wake's own idiom, with a comment naming why the built session is not the synchronization point. No production code changed; no new machinery. Verification: reproduced the exact CI error deterministically by temporarily injecting a delay ahead of reportRevisionBeforePrompt (delays 100/200/300/400/500/700 ms all failed with the identical message); that injection was reverted (git status shows only the test file modified). With the fix the test passes under injected delays of 100, 400 and 1500 ms. Full file run: exit 0, 45 tests passing. 24 parallel runs of the target test: 24/24 pass. shellcheck -x on the changed file is clean, and this PR's own tests (tests/fm-brief.test.sh, tests/fm-ask-user-authority.test.sh) still pass. The change is left uncommitted in the worktree, since prior rounds' commits on this branch were made by the executor rather than this phase

* fix(spawn): bind worker pool allocations to clone custody

* no-mistakes(ci): Updated the verified CI Treehouse pin from v2.0.1 to v2.3.0 with official platform checksums. The Herdr failures were caused by v2.0.1 lacking the required `--root` capability. Verified installer download/checksum/version, `--root` support, lint, clone-custody regression, and dispatch-resolve regression. The portable failure was an unrelated transient broken-pipe race in unchanged code and passed locally

* no-mistakes(ci): Fixed the flaky broken-pipe failure in bin/fm-quota-axi-lib.sh by replacing the private process-substitution lookup with a direct case mapping. This preserves all provider mappings while preventing an early consumer exit from closing the producer pipe and leaking `printf: write error: Broken pipe` to stderr. Verified with tests/fm-dispatch-resolve.test.sh, bin/fm-lint.sh, and git diff --check; all passed

* feat(secondmate): seed local-only projects as bound child clones with primary-owned landing

A local-only project has no forge, so a secondmate home could not hold one at
all: bin/fm-home-seed.sh refused it and the routing prose sent that work back to
the primary. Seed it instead as an independent local clone of the primary's own
clone, pinned to its current default-branch commit, with no origin, no
publication remote, no borrowed object storage and no no-mistakes
initialization, recorded by a durable versioned binding inside the existing seed
transaction. Fleet sync keeps skipping it and the whole-home remote route still
refuses it.

Custody splits along the same line the design drew. The child keeps its task,
branch, worktree and endpoint; the landing stays with the primary that seeded
the copy. bin/fm-local-handoff.sh offer publishes an immutable head-pinned offer
carrying the commit as a git bundle, and the existing guarded entrypoint
bin/fm-merge-local.sh consumes it as a pinned delegated input under its own
per-task control lock, incarnation recheck and captain-hold check, rather than
gaining a second acceptance system. No worker record is read, written or
invented for the child. The primary alone fast-forwards its local default
branch, then publishes a landing receipt into the child home.

Only that receipt opens ordinary teardown, and bin/fm-teardown.sh re-proves the
receipt's commit is still contained in the primary's default branch before
accepting it; a child-local merge or a branch pushed anywhere is not that proof.
Receipt recovery after a landing whose acknowledgement failed is idempotent and
never merges. Missing or stale identities, dirty or diverged work, a changed
head, a changed route, a damaged record and an interrupted transaction all
refuse and preserve the work.

tests/fm-local-handoff.test.sh drives the real scripts against isolated
temporary homes over ten cases covering the bound seed, the two seed refusals
that remain, the child's inability to land its own clone, offer pinning and
republication, the guarded delegated landing and its receipt, the unpinned and
stale approval refusals, idempotent receipt recovery, the teardown gate and the
fail-closed record parsing, plus a held landing row blocking the landing. The
obsolete refusal case in tests/fm-secondmate-safety.test.sh is removed with the
behavior it asserted; the unchanged whole-home remote refusal stays covered by
tests/fm-remote-secondmate-lifecycle-e2e.test.sh. Test inventory entries are
additive only.

* fix(secondmate): pin local-only landings to a parent-owned approval record

The review found that an approval released by the captain could be inherited
by any later child head, that a receipt could be satisfied by a substituted
clone, that a refused landing left an imported ref behind, and that an absent
worktree skipped the receipt gate entirely.

Add one durable record, fm-local-landing.v1, written only by the new
bin/fm-local-handoff.sh request subcommand while the captain's row is still
held, and require the delegated landing to match that record's pinned offer,
head, and identity. The landing guard now also refuses an unreadable hold
status, a record already marked landed, and a project that has left local-only
custody, and deletes its private import ref on every refusal path.

The receipt proof derives the containment repository from the child's own
parent route and project binding and additionally requires the parent's own
landed record, so a receipt naming another clone proves nothing. Cleanup of a
bound local-only task now faces that gate even when its worktree is already
gone.

* fix(secondmate): make a published local-only landing pin immutable

A request could publish its landing record after the captain's row had
already been released, so an answer given for one head was inherited by
another. The pin is now published create-only, and the whole check,
publication, and re-read of the row runs under the landing's existing
per-landing control lock, which bin/fm-merge-local.sh and
bin/fm-captain-hold.sh already take. A record that exists is reported
rather than replaced: the identical identity repeats it, a different head
refuses, and a landed record refuses outright. A row released outside
that lock withdraws this call's own record byte for byte.

Each approval therefore owns its own landing row; a moved head needs a
new row rather than a re-pin.

* test(secondmate): prove the answer waits on the pin's own lock

The case that covered a captain's answer overlapping a landing pin in
flight asserted only that the answer had not completed after a fixed
three-second window. That assertion passes whenever the answer has
simply not finished yet, so on a host where an uncontended release
already costs more than three seconds it would have passed with the
serialization removed entirely.

Replace it with positive evidence. The fixture wrapper that freezes a
publication now records the publishing process's pid, and the case
asserts that the landing's own control lock is held by that process, or
an ancestor of it, while the answer is running. The absence window
stays as independent corroboration but is now scaled to a baseline the
case measures on this host with the same command on its own row, and
the boundary at the release instant plus the row's state after the
answer completes are checked too. The frozen wrapper also ends with the
case that installed it, so a case that fails inside its own window no
longer leaves a publication spinning behind it.

With the request's lock acquisition removed from bin/fm-local-handoff.sh
the case now fails at that assertion rather than at a timer.

* no-mistakes(review): Close landing rows after receipts; align routing and receipt checks

* no-mistakes(review): Keep receipt recovery idempotent after landing row archival

* no-mistakes(review): Refuse receipt recovery before writing when landing row missing

* no-mistakes(review): Gate every recovery write on a present, unheld landing row

* no-mistakes(review): Drop import refs on every exit; fail broken landing fixtures

* no-mistakes(document): Align seeding docs with bound local-only secondmate clones

* no-mistakes(ci): ci-2 (Behavior portable serial 8), fixed. tests/fm-gotmp.test.sh failed with "teardown exited non-zero with a valid tasktmp". Invariant: a test that runs the real bin/fm-teardown.sh from a fake bin folder must provide every library teardown loads. This PR made teardown load bin/fm-local-handoff-lib.sh, but the test's two fake bin folders (make_fake_root and the inline copy near line 170; the third case reuses make_fake_root) never got it, so teardown exited at startup. I reproduced this locally. No other test in tests/ links teardown into a fake folder, and the library's own dependencies (fm-secondmate-parent-lib.sh, fm-secondmate-registry-lib.sh) were already linked. Fix: link fm-local-handoff-lib.sh in both folders, with a comment matching the file's style. No production code changed. Verified: bash tests/fm-gotmp.test.sh passes all 3 cases and shellcheck is clean. ci-1 (Behavior portable serial 2), not caused by this PR. tests/fm-remote-secondmate-lifecycle-e2e.test.sh printed ALL TESTS PASSED, then exited 1 only because its cleanup rm -rf hit "Directory not empty" while a leftover background process was still writing. This PR doesn't touch that test or the watcher/remote code it runs. The same cleanup failure hit unrelated branch fm/fm-opencode-2-adapter (run 36213627355), so the test was already flaky. A local run on this loaded host (load average about 8.5) also failed: it hit the watcher's 30-second relaunch time limit, then the same cleanup failure. Making it reliable means finding which leftover process keeps writing, which is separate work outside this change. ci-3 (PR must be raised via no-mistakes), not caused by the code. The attestation check failed because the pipeline's test step had status=skipped, which depends on the pipeline run's state

* Guard bound local-only landing by offered head and call identity

* no-mistakes(review): Accept defer-then-release pins and tolerate deleted task branches

* no-mistakes(review): Accept legacy date-only answered stamps for pinned landings

* no-mistakes(document): Sync hold-stamp and teardown branch docs with fixes
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