Skip to content

feat(bin): replay fork workflow gates onto upstream with snapshot-bound resolver receipts - #11

Closed
twilwa wants to merge 11 commits into
mainfrom
fm/fm-upstream-sync
Closed

twilwa wants to merge 11 commits into
mainfrom
fm/fm-upstream-sync

Conversation

@twilwa

@twilwa twilwa commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Intent

Sync the fork changes onto upstream base 9284978f, replay the six dropped PRs in order (#1, #3, #4, #2, #5, #6), apply the PR #9 follow-up, preserve upstream behavior, and ensure the resolver receipt hash identifies the exact brief content used in the request. Keep local-only commits 930a653a and f9e0f137 off this branch. Do not push to main, close PR #9, alter the shared ~/.no-mistakes/config.yaml, or merge any PR. The task is already committed on fm/fm-upstream-sync at 27c941f14705c4cb249293b994a79dcfda833e2a.

The PR description must state that adoption requires host tasks-axi 0.2.6 or later, include the 231-test/10-failure/39-skip accounting and each failure's clean-base versus branch disposition, note that tsc was unavailable, and include a section titled Dispatch resolver conflict resolution. That section must explain that upstream brief-heading parsing and the branch's newer branch-prefix/harness behavior were preserved; BRIEF_SNAPSHOT is now the sole source for brief_kind, task_sections, whole-brief fallback, request construction, and brief_sha256; and the mutation regression test proves the request and receipt identify the same captured bytes. Specifically scrutinize this conflict resolution and its regression test during review.

Test evidence: fm-watch-triage timed out at 1,800 seconds on both base and branch; fm-backend-herdr-presentation-e2e failed its concurrent-recovery assertion on both; fm-test-run, fm-nm-test-contract, and fm-ci-workflow failed on both because Ruby is unavailable; fm-supervision-host, fm-turnend-guard, and fm-watcher-lock failed the same fixture/assertion on both; fm-afk-launch failed the same pinned-Herdr lifecycle assertions on both. fm-bearings-board-render passed on base, failed once in the branch shard, and passed its immediate isolated branch rerun. The Pi extension typecheck was skipped because tsc is unavailable. Separate live Pi/Herdr agent-exit and stale-registration comparisons also failed on both base and branch; the bearings snapshot test passed on both.

The test-only tasks-axi 0.2.6 installation must stay in its temporary prefix. Run the isolated Opus 5.5 validation from a separate ordinary clone with a private NM_HOME; never initialize no-mistakes from the existing worktree or alter the shared no-mistakes configuration. Do not pass --yes. Stop at any ask-user finding and report it for a decision without approving, fixing, or skipping it. Do not merge. Report the PR only when checks are green.

What Changed

Adoption requirement

Adopting this branch requires host tasks-axi 0.2.6 or later.

Dispatch resolver conflict resolution

  • The replay kept upstream's brief-heading parsing through fm-brief-heading-lib.sh (fm_brief_task_heading_present / fm_brief_task_heading_body). It also kept the branch's newer branch-prefix and harness behavior.

  • BRIEF_SNAPSHOT is now the only source for brief_kind, task_sections, the whole-brief fallback, request construction, and brief_sha256. After the snapshot is taken, the resolver never reads the original brief path again.

  • The mutation regression test in tests/fm-dispatch-resolve.test.sh changes the original brief after the snapshot is taken. It covers two cases:

    • a scout brief with ## Captain's intent / ## Firstmate spec sections
    • a brief with no sections, which takes the whole-brief fallback

    In both cases it checks that the request sent to the model holds the original snapshot content, not the edited file. It also checks that the receipt's brief_sha256 matches an independent hash of that content. This proves the request and the receipt identify the same captured bytes.

  • Reviewers: please check this conflict resolution and its regression test closely.

Validation notes

Full-suite accounting: 231 tests, 10 failures, 39 skips. Each failure compared against the clean base:

Test Clean base Branch Disposition
fm-watch-triage timed out at 1,800 s timed out at 1,800 s same on both
fm-backend-herdr-presentation-e2e failed concurrent-recovery assertion same failure same on both
fm-test-run failed (Ruby unavailable) same failure environmental, same on both
fm-nm-test-contract failed (Ruby unavailable) same failure environmental, same on both
fm-ci-workflow failed (Ruby unavailable) same failure environmental, same on both
fm-supervision-host failed fixture/assertion same failure same on both
fm-turnend-guard failed fixture/assertion same failure same on both
fm-watcher-lock failed fixture/assertion same failure same on both
fm-afk-launch failed pinned-Herdr lifecycle assertions same failures same on both
fm-bearings-board-render passed failed once in the branch shard, passed its immediate isolated rerun intermittent on the branch; the lavish-state isolation above targets it
  • The Pi extension typecheck was skipped because tsc is not available.
  • Separate live Pi/Herdr agent-exit and stale-registration comparisons failed on both base and branch.
  • The Bearings snapshot test passed on both.

Risk Assessment

⚠️ Medium: The resolver snapshot fix is correct and its mutation test proves the request and receipt come from the same captured bytes, but the branch replays about 4.4k lines across six PRs, including a new GitHub merge gate that refuses direct fm-pr-merge.sh GitHub calls, so its breadth warrants follow-up attention even though no defect was found.

Testing

I ran the real CLIs in private FM_HOMEs. Four resolver scenarios passed live: section request, whole-brief fallback, dispatch join with edit refusal, and an adversarial mid-resolve brief swap. The swap shows the target keeps the request and the receipt hash on the same captured bytes while the pre-fix parent lets them disagree. The resolver used real curl and real quota-axi, with the third-party Typesafe endpoint routed to a local stand-in because no key is available. The captain deferral path passed live with the temp-prefix tasks-axi 0.2.6. The bearings board's dated defer option was built, rendered in headless Chromium, screenshotted, submitted and checked against invalid payloads. A no-mistakes brief was scaffolded and carries the ask-user routing line. fm-send and PR review stayed untested: the gate guard blocks fm-send, and PR review needs forge authority. The targeted tests pass on the target except one fm-pr-merge case, which fails identically on the base. The worktree is clean and the temp labs were removed.

  • Live validation: ✅ go - 7 of 10 scenarios driven live against the product
Scenario Result Live Evidence
Resolving a scout brief sends only its task sections and the receipt hashes that same snapshot ✅ pass live s1-section-brief-resolve.txt: the request carried 'Brief kind: scout (report only)' plus only the Captain's intent and Firstmate spec sections. The receipt's brief_sha256 (9a0d2403…) equals sha256 of…
A brief with no task sections is sent whole, byte for byte, and the receipt hash matches those bytes ✅ pass live s2-s3-whole-brief-and-dispatch-join.txt: the sha256 of the request's state.task.brief (read with jq -j) is 04e35597…, which equals the brief file hash and the receipt's brief_sha256.
Recording a dispatch joins the resolution for the same brief bytes and refuses a brief edited after the resolve ✅ pass live s2-s3-whole-brief-and-dispatch-join.txt: --record-dispatch appended a dispatch receipt with the same brief_sha256 and request_id. After the brief was edited, a second call printed 'no resolution recei…
Adversarial: a brief swapped during the resolve cannot make the request and the receipt disagree ✅ pass live s4-adversarial-brief-swap-head-vs-prefix.txt: the brief path was a FIFO whose first open returned the ORIGINAL bytes and every later open returned SWAPPED bytes. On target 5e8c2af the request carried…
A captain's dated deferral is recorded once and re-dates the hold; past, same-day and invalid dates are refused ✅ pass live s6-captain-deferral.txt (tasks-axi 0.2.6 from the temp prefix, added to PATH only): defer dates 2026-09-25, 2026-01-01 and 2026-13-40 were each skipped with 'nothing was recorded'. 2026-11-02 printed…
The bearings Captain's Call board shows 'deferred until <date>' and queues a dated defer answer ✅ pass live s8-board-deferred-option-selected.png, s8-board-after-queue.png, s8-board-queued-answer-context.json, s8-board-payload-guards.txt: a real fm-bearings-board.sh build, rendered in headless Chromium. Sub…
A scaffolded no-mistakes brief tells the worker to return ask-user gates to firstmate as needs-decision ✅ pass live s7-brief-ask-user-routing.txt and s7-generated-no-mistakes-brief.md: the brief generated by fm-brief.sh live-nm-task sample --mode no-mistakes carries the --yes ban and 'Ask-user gates must return t…
fm-send refuses unknown flags and stray --key-style arguments before sending anything ⏸️ untested no bin/fm-gate-refuse-lib.sh deliberately blocks gate agents from fm-send, and I did not bypass that guard. To drive this live, run fm-send outside a no-mistakes gate against a fm-lab-* Herdr lab from bi…
Head-keyed PR review and post-merge QA gates run against a real pull request ⏸️ untested no fm-pr-review.sh needs a live GitHub PR through gh/gh-axi and would publish review state to it; this gate step has no authority to do that. It needs a throwaway GitHub repo or PR with gh auth, approved…
Conditional workflows moved from AGENTS.md into skills (#6) load in the right situations ⏸️ untested no Skill and instruction documents have no runtime surface no-mistakes can drive. Whether an agent follows them is a model-interpretation question for development evaluation.
Evidence: Resolver: section brief request and receipt

Source: Resolver: section brief request and receipt

$ sha256sum scout-brief.md
9a0d24033fc65fe89daa48a127fff7f8deb2891dfd0e018c1a234aeabcbf368f  /tmp/fm-resolve-live/scout-brief.md
$ FM_HOME=<private> TYPESAFE_API_KEY=<test> bin/fm-dispatch-resolve.sh scout-brief.md --project pager   (real quota-axi --json, api.typesafe.ai routed to local stand-in)
dispatch-resolve:
  status: clear
  model: jev-1.13.0   latency_ms: 22   tokens: 400/20
  rule: rule_2 (Research that produces a written report only.)   confidence: 0.85
  probabilities: rule_1=0.05 rule_2=0.9 default=0.05
  note: rule matched
  candidate: claude:opus  provider=claude  scope=all_models  remaining=76%  spendPriority=-0.2269  runway=projected_exhaustion  -> eligible
  profile: --harness 'claude' --model 'opus' --effort 'high'
exit=0

--- request body state.task.brief received by the API endpoint ---
Brief kind: scout (report only)

## Captain's intent
Survey how the pager handles page boundaries and report findings.

## Firstmate spec
Read pager.sh and the tests; no code changes.

--- Authorization header seen by endpoint: Bearer <test key>

--- last resolution receipt ---
{
  "brief_path": "/tmp/fm-resolve-live/scout-brief.md",
  "brief_sha256": "9a0d24033fc65fe89daa48a127fff7f8deb2891dfd0e018c1a234aeabcbf368f",
  "request_id": "local-req-1",
  "requested_model": "jev-1.13.0",
  "status": "clear",
  "chosen_profile": {
    "harness": "claude",
    "model": "opus",
    "effort": "high"
  }
}
Evidence: Resolver: whole-brief byte hash and dispatch join/refusal

Source: Resolver: whole-brief byte hash and dispatch join/refusal

=== S2 whole-brief fallback ===
$ sha256sum whole-brief.md
04e355978dac54bfa111ab6a5200535f45346ff4668f70d6ee93e7fc134c1a39
dispatch-resolve:
  status: clear
  model: jev-1.13.0   latency_ms: 25   tokens: 400/20
--- request brief equals file bytes? ---
cmp: EOF on /tmp/fm-resolve-live/whole-brief.md after byte 122, line 3
receipt brief_sha256: 04e355978dac54bfa111ab6a5200535f45346ff4668f70d6ee93e7fc134c1a39

=== S3 dispatch receipt joins only the exact resolved bytes ===
$ bin/fm-dispatch-resolve.sh --record-dispatch whole-brief.md --harness claude --model sonnet --effort high
exit=0
{"brief_sha256":"04e355978dac54bfa111ab6a5200535f45346ff4668f70d6ee93e7fc134c1a39","request_id":"local-req-2","chosen_profile":{"harness":"claude","model":"sonnet","effort":"high"},"dispatched_profile":{"harness":"claude","model":"sonnet","effort":"high"}}
$ echo 'edited after resolve' >> whole-brief.md; bin/fm-dispatch-resolve.sh --record-dispatch whole-brief.md --harness claude
dispatch-resolve: no dispatch receipt (no resolution receipt carries this brief's current content hash; it may have been edited after the resolve)
exit=0
dispatch receipts before=1 after=1

--- S2 byte check (jq -j, no added newline): sha256 of request state.task.brief ---
04e355978dac54bfa111ab6a5200535f45346ff4668f70d6ee93e7fc134c1a39
(receipt brief_sha256 above: 04e355978dac54bfa111ab6a5200535f45346ff4668f70d6ee93e7fc134c1a39)
Evidence: Resolver: adversarial brief swap, target vs pre-fix

Source: Resolver: adversarial brief swap, target vs pre-fix

sha256(v1 ORIGINAL)=cb9100fdc54ccad232b2bd5f8efa1df95a29afa7dce74302d2a03f875d53fadb
sha256(v2 SWAPPED)=eea18f3032fed443b6ab54ba46f340b3211f9478414cc592231166c4cfcf6019
Brief path is a FIFO: the first open returns v1 bytes, every later open returns v2 bytes.
=== target 5e8c2af (BRIEF_SNAPSHOT is sole source) ===
  status: clear
  rule: rule_1 (A simple bug fix with a stated root cause.)   confidence: 0.85
request state.task.brief:
  | ## Captain's intent
  | ORIGINAL intent: fix the pager off-by-one.
  | 
  | ## Firstmate spec
  | ORIGINAL spec: change <= to < on line 40.
  | 
receipt brief_sha256 = sha256(v1 ORIGINAL)
=== pre-fix 2a50958^ (re-reads the live brief path) ===
  status: clear
  rule: rule_2 (Research that produces a written report only.)   confidence: 0.85
request state.task.brief:
  | # Task
  | ## Captain's intent
  | SWAPPED intent: rewrite the whole pager.
  | 
  | ## Firstmate spec
  | SWAPPED spec: new architecture.
  | 
  | # Definition of done
  | This is a SCOUT task: the deliverable is a written report, not a PR.
  | 
receipt brief_sha256 = sha256(v1 ORIGINAL)

Interpretation: on the target, the request body and the receipt brief_sha256 both come from the ORIGINAL bytes (the first and only read of the brief path). On the pre-fix parent 2a50958^, the request carried the SWAPPED brief (and a different rule, rule_2) while the receipt still hashed the ORIGINAL bytes: receipt and request disagreed.
Evidence: fm-send refused by the gate guard

Source: fm-send refused by the gate guard

Private tmux server (TMUX_TMPDIR=/tmp/fm-send-live/tmux), private FM_HOME, task lane-live in window labsess:fm-lane-live

$ bin/fm-send.sh lane-live --resolve-keys k1 hello
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
exit=3
inbox records: 0

$ bin/fm-send.sh lane-live --bogus hello
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
exit=3
inbox records: 0

$ bin/fm-send.sh lane-live --resolve-key=k1 --fire-and-forgot id1 hi
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
exit=3
inbox records: 0

$ bin/fm-send.sh lane-live 'please rebase onto main'
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
exit=3
inbox records: 0
--- tmux pane received (doorbell) ---

$ bin/fm-send.sh lane-live --key Enter
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
exit=3
Evidence: Captain dated deferral transcript

Source: Captain dated deferral transcript

tasks-axi (temp prefix, PATH-only): 0.2.6; UTC today: 2026-09-25
$ fm-captain-hold.sh hold sample-route --reason 'captain must pick a route' --title 'Decide the sample route' --repo sample
sample-route
exit=0

--- adversarial: same-day and past defer dates ---
$ printf 'sample-route\tlater\tRevisit\tdefer\t2026-09-25\n' | fm-captain-hold.sh answers --source live-test
skipped: sample-route (defer date 2026-09-25 must be later than UTC today 2026-09-25; nothing was recorded)
answers: closed=0 deferred=0 skipped=1
exit=1
$ ... defer 2026-01-01
skipped: sample-route (defer date 2026-01-01 must be later than UTC today 2026-09-25; nothing was recorded)
answers: closed=0 deferred=0 skipped=1
exit=1
$ ... defer 2026-13-40 (not a calendar day)
skipped: sample-route (invalid defer date 2026-13-40)
answers: closed=0 deferred=0 skipped=1
exit=1
resolution blocks recorded so far: 0

--- happy path: future defer date ---
$ printf 'sample-route\tlater\tRevisit in November\tdefer\t2026-11-02\n' | fm-captain-hold.sh answers --source live-test
deferred: sample-route until 2026-11-02
answers: closed=0 deferred=1 skipped=0
exit=0

$ tasks-axi show sample-route
task:
  id: sample-route
  title: Decide the sample route
  state: queued
  blocked: no
  blocked_by: none
  held: yes
  hold_reason: captain must pick a route
  hold_kind: captain
  hold_until: 2026-11-02
  kind: captain
  repo: sample
  priority: "-"
  created: 2026-09-25
  closed: "-"
  deps: none
  links: none
  body: "Captain hold set: 2026-09-25T00:52:07Z\n\nResolution recorded by fm-captain-hold.\nDecision digest: 2a56ae6dce78de02171df6bdd0216932b6a21b5eb6cd227a2df91efa8aef47a7\nResolution mode: deferred\nDeferred until: 2026-11-02\n\nCaptain decision:\nCaptain answered this call through live-test.\nTask: sample-route\nAnswer: later\nAnswer as shown to the captain: Revisit in November"

$ fm-captain-hold.sh open sample-route
exit=0

--- redelivery of the exact same deferral (idempotent) ---
deferred: sample-route until 2026-11-02
answers: closed=0 deferred=1 skipped=0
exit=0
resolution blocks after redelivery: 1
Evidence: Ask-user routing lines in the generated brief

Source: Ask-user routing lines in the generated brief

$ FM_HOME=<private> bin/fm-brief.sh live-nm-task sample --mode no-mistakes
scaffolded: data/live-nm-task/brief.md

--- generated brief: no-mistakes gate rules (excerpt around --yes ban) ---
28-3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
29-4. Report status by appending one line:
30-   `echo "{state} [at=<epoch>]: {one short line}" >> '/tmp/fm-brief-live/home/state/live-nm-task.status' && { [ ! -e '/tmp/fm-brief-live/home/config/fleet-ledger' ] || '~/firstmate/data/fm-upstream-sync/isolated-opus-gate-20260924/worktrees/4b3a4933e99a/01M3AXS1P9DYJMV9W08H5Q01AY/bin/fm-fleet-ledger.sh' appended '/tmp/fm-brief-live/home/config' '/tmp/fm-brief-live/home/state/live-nm-task.status' >/dev/null 2>&1 || true; }`
31:   States: working, needs-decision, blocked, paused, done, failed.
32-   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.
33-   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
34-   would act on (setup done, bug reproduced, fix implemented, validation passed) and the
35:   needs-decision/blocked/paused/done/failed states. No step-by-step FYI progress lines;
36-   firstmate reads your pane for that.
37-   Whenever you mention a PR anywhere - a status line, your terminal, a summary - write its full
38-   https:// URL exactly as the forge printed it, never a bare number such as "PR 108"; firstmate
--
45-   cadence instead of treating it as a possible wedge. Use `blocked:` when you are stuck and need help.
46-5. If you hit the same obstacle twice, append `blocked [at=<epoch>]: {why}` and stop; firstmate will help.
47-6. If a decision belongs above the implementation worker (product choices, destructive actions),
48:   append `needs-decision [at=<epoch>]: {summary of options}` and stop. Firstmate will reply with the decision.
49-   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 `/tmp/fm-brief-live/home/data/live-nm-task/nm-<run>-findings.txt`, then report the gate with
50:   `needs-decision [at=<epoch>] [key=nm-<run>-<step>]: ask-user findings=<id1>,<id2>,... file=/tmp/fm-brief-live/home/data/live-nm-task/nm-<run>-findings.txt`
51-   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.
52-   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.
53-   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.
--
108-- ask-user findings are never yours to answer: escalate to firstmate using rule 6's ask-user format and stop.
109-  Firstmate applies `ask-user-authority` and obtains any required captain decision.
110-  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.
111:- NEVER pass `--yes` (or `-y`) to `no-mistakes axi run` or `no-mistakes axi respond`. It is banned fleet-wide.
112-  It auto-resolves every gate including ask-user findings with no escalation, and answering your own ask-user finding is a hard rule violation.
113:  Ask-user gates must return to firstmate as `needs-decision`; the worker never answers its own finding.
114-
115-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 pr view <url> --json isDraft` must print false); if it is a draft, mark it ready with `gh-axi pr ready`.
116-A draft cannot be merged, so a done report on one leaves the merge unasked.
Evidence: Generated no-mistakes brief

Source: Generated no-mistakes 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 sample, 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/live-nm-task --`
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}" >> '/tmp/fm-brief-live/home/state/live-nm-task.status' && { [ ! -e '/tmp/fm-brief-live/home/config/fleet-ledger' ] || '~/firstmate/data/fm-upstream-sync/isolated-opus-gate-20260924/worktrees/4b3a4933e99a/01M3AXS1P9DYJMV9W08H5Q01AY/bin/fm-fleet-ledger.sh' appended '/tmp/fm-brief-live/home/config' '/tmp/fm-brief-live/home/state/live-nm-task.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:` - ONLY when you are deliberately idling on a
   known external wait you expect to clear on its own (an upstream release, a rate-limit reset, a scheduled window, or your own validation round):
   firstmate then leaves your idle pane alone and rechecks it on a long
   cadence instead of treating it as a possible wedge. 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 `/tmp/fm-brief-live/home/data/live-nm-task/nm-<run>-findings.txt`, then report the gate with
   `needs-decision [at=<epoch>] [key=nm-<run>-<step>]: ask-user findings=<id1>,<id2>,... file=/tmp/fm-brief-live/home/data/live-nm-task/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 stop, restart, or update the shared `no-mistakes` daemon - it is one instance serving
   every lane/home, so restarting 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.

# Firstmate instruction inbox
Firstmate steers you through durable message files in '/tmp/fm-brief-live/home/state/live-nm-task.inbox'.
When a terminal message says an instruction is waiting there - and at any natural checkpoint when you are unsure - list '/tmp/fm-brief-live/home/state/live-nm-task.inbox'/*.msg, read and act on each message in numeric order, then acknowledge each handled message by moving it: `mv '/tmp/fm-brief-live/home/state/live-nm-task.inbox'/NNN.msg '/tmp/fm-brief-live/home/state/live-nm-task.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
If `AGENTS.md` or `CLAUDE.md` already exists, or if this task produced durable project-intrinsic knowledge, run `~/firstmate/data/fm-upstream-sync/isolated-opus-gate-20260924/worktrees/4b3a4933e99a/01M3AXS1P9DYJMV9W08H5Q01AY/bin/fm-ensure-agents-md.sh .` in the worktree.
Record only project knowledge useful to almost every future session.
For anything the codebase already shows, prefer a pointer to the authoritative file, command, or doc over copying the detail.
If you touch a project `AGENTS.md`, follow `~/firstmate/data/fm-upstream-sync/isolated-opus-gate-20260924/worktrees/4b3a4933e99a/01M3AXS1P9DYJMV9W08H5Q01AY/bin/fm-ensure-agents-md.sh`'s self-governance contract in the same pass.
Keep it proportionate: skip `AGENTS.md` edits for trivial tasks that produced no durable project knowledge.

# Definition of done
Delivery contract: mode=no-mistakes
Ship branch: fm/live-nm-task
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.
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.
  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), read the PR back from the forge and confirm it is not a draft (`gh pr view <url> --json isDraft` must print false); if it is a draft, mark it ready with `gh-axi pr ready`.
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.
![Bearings board with deferred option selected](https://github.com/user-attachments/assets/0e8a2ca8-9cfa-4fe2-9282-3f8c98232070) - Evidence: [Bearings board with deferred option selected](https://github.com/twilwa/firstmate/blob/e51c025143bb11a1d59264ab8bc27dfe4f1b89b2/.no-mistakes/evidence/fm/fm-upstream-sync/s8-board-deferred-option-selected.png) ![Bearings board after queueing the answer](https://github.com/user-attachments/assets/63d31fc3-1d8f-4c0a-999f-66452b546012) - Evidence: [Bearings board after queueing the answer](https://github.com/twilwa/firstmate/blob/e51c025143bb11a1d59264ab8bc27dfe4f1b89b2/.no-mistakes/evidence/fm/fm-upstream-sync/s8-board-after-queue.png)
Evidence: Queued dated defer answer context

Source: Queued dated defer answer context

[{"text":"Captain's Call answer - Pick the pager rewrite scope: later - after the launch (deferred until 2026-11-02)",
  "data":{"schema":"fm-bearings-answer.v1","question":"sample-open-call","selection":"later","note":"after the launch","close":"defer","until":"2026-11-02"}}]
Evidence: Board payload guard refusals

Source: Board payload guard refusals

--- adversarial: duplicate option value within one card ---
fm-bearings-board: board data repeats the option value later (card sample-open-call); each option value must be unique within its card: /tmp/fm-board-live/home/dup.json
exit=1
--- adversarial: option until is not a real calendar day ---
fm-bearings-board: board data does not satisfy fm-bearings-board.v1: /tmp/fm-board-live/home/baddate.json
exit=1
board file still carries the previously built valid deck: 1 match(es)
Evidence: Targeted test results, including the fm-pr-merge base comparison

Source: Targeted test results, including the fm-pr-merge base comparison

Targeted existing tests (target 5e8c2af unless noted):
  tests/fm-dispatch-resolve.test.sh: exit=0
  tests/fm-send-strict.test.sh: exit=0
  tests/fm-send-resolve-key.test.sh: exit=0
  tests/fm-pr-review.test.sh: exit=0
  tests/fm-bearings-board-render.test.sh: exit=0
  tests/fm-pr-merge.test.sh: exit=1
  fm-dispatch-resolve snapshot case: ok - receipt hashes bind to the immutable brief bytes used by section and whole-brief requests
  fm-pr-merge on base 3377aa61: not ok - github-zero-exit-queue-required: refusal did not name the concrete observed state ; exit=1
  fm-pr-merge on target, isolated rerun: not ok - github-zero-exit-queue-required: refusal did not name the concrete observed state ; exit=1
- Outcome: ⚠️ 2 warnings across 2 runs (17m16s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - medium risk

✅ No issues found.

✅ No issues found.

⚠️ **Test** - 2 warnings

✅ No issues found.

  • Live validation: ✅ go - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Section/scout brief edited mid-resolve: request and receipt both reflect the original captured bytes ✅ pass live resolver-snapshot-branch-27c941f.txt: exit 0, status clear. state.task.brief = scout tag + original Captain's intent/Firstmate spec, with no MUTATED text. Receipt brief_sha256 2e1ffbee… equals sha256…
Whole-brief fallback edited mid-resolve: the verbatim original brief is sent and hashed ✅ pass live resolver-snapshot-branch-27c941f.txt: the sent brief is exactly the original. Receipt brief_sha256 20bdd604… equals sha256 of the original bytes, while the on-disk hash is 92832ef4…
Adversarial: --record-dispatch against a brief edited after resolve refuses to join, and joins once the bytes match ✅ pass live resolver-snapshot-branch-27c941f.txt: 'no resolution receipt carries this brief's current content hash…' for the edited brief. After restoring it, a dispatch receipt was appended with the same brief_s…
Regression: the pre-fix resolver (2671085) sends mutated bytes while its receipt hashes the original ✅ pass live resolver-snapshot-prefix-2671085.txt: 'CHECK request free of mutated bytes: FAIL' for both cases. fm-dispatch-resolve.test.prefix-2671085.txt: 'not ok - the request uses snapshot sections and scout cl…
Upstream opt-in gate preserved: no TYPESAFE_API_KEY means resolver off with no network call ✅ pass live resolver-snapshot-branch-27c941f.txt: 'dispatch-resolve: off …', exit=0, network_call=no
Upstream brief-heading parsing and receipt behavior unchanged across the resolver suite ⏸️ untested no The earlier payload backed this only with the automated fm-dispatch-resolve and fm-arm-pretool-check suites, which run the CLI with shims. It said itself that this was not a live run, so it did not sh…
Real typesafe.ai round-trip with a production key ⏸️ untested no This needs a real TYPESAFE_API_KEY, and the runbook forbids using production credentials, so the hardcoded TS_BASE endpoint was replaced by a recording curl shim. To cover it, run with an operator-app…
  • drive-resolver-snapshot.sh bin (evidence dir): real resolver CLI on branch 27c941f, brief rewritten mid-run through a rules FIFO, section/scout and whole-brief fallback, request body vs receipt brief_sha256, --record-dispatch join/refuse, key-absent gate

  • drive-resolver-snapshot.sh &lt;git archive 2671085&gt;/bin: same driver on the pre-fix parent, to confirm the scenario detects the bug

  • bash tests/fm-dispatch-resolve.test.sh on the branch

  • bash tests/fm-dispatch-resolve.test.sh copied into a git archive 2671085 tree, to confirm the regression test fails before the fix

  • bash tests/fm-arm-pretool-check.test.sh

  • ⚠️ tests/fm-pr-merge.test.sh:1172 - The case github-zero-exit-queue-required fails ('refusal did not name the concrete observed state') on the target, in an isolated rerun, with NO_MISTAKES_GATE unset, and on the base 3377aa6 tree, so this branch did not introduce it. It is missing from the PR description's 231-test/10-failure accounting, which lists a clean-base vs. branch outcome for each failure. The author should add it as a failure present on both base and branch, or confirm what makes it pass in their environment.

  • ⚠️ Test-agent mistake to check: while cleaning up a private tmux server (TMUX_TMPDIR=/tmp/fm-send-live/tmux), I ran a bare tmux kill-server in a new shell that no longer had that setting. It targeted the default socket /tmp/tmux-1001/default, which exists (last modified 2026-09-25 00:37 +0200); tmux ls now reports 'no server running'. I could not tell whether a default tmux server was running before, so one may have been killed. Named -L tmux servers and the Herdr fleet were not touched. Please check whether anything depended on the default tmux server and restart it if needed.

  • Live validation: ✅ go - 7 of 10 scenarios driven live against the product

Scenario Result Live Evidence
Resolving a scout brief sends only its task sections and the receipt hashes that same snapshot ✅ pass live s1-section-brief-resolve.txt: the request carried 'Brief kind: scout (report only)' plus only the Captain's intent and Firstmate spec sections. The receipt's brief_sha256 (9a0d2403…) equals sha256 of…
A brief with no task sections is sent whole, byte for byte, and the receipt hash matches those bytes ✅ pass live s2-s3-whole-brief-and-dispatch-join.txt: the sha256 of the request's state.task.brief (read with jq -j) is 04e35597…, which equals the brief file hash and the receipt's brief_sha256.
Recording a dispatch joins the resolution for the same brief bytes and refuses a brief edited after the resolve ✅ pass live s2-s3-whole-brief-and-dispatch-join.txt: --record-dispatch appended a dispatch receipt with the same brief_sha256 and request_id. After the brief was edited, a second call printed 'no resolution recei…
Adversarial: a brief swapped during the resolve cannot make the request and the receipt disagree ✅ pass live s4-adversarial-brief-swap-head-vs-prefix.txt: the brief path was a FIFO whose first open returned the ORIGINAL bytes and every later open returned SWAPPED bytes. On target 5e8c2af the request carried…
A captain's dated deferral is recorded once and re-dates the hold; past, same-day and invalid dates are refused ✅ pass live s6-captain-deferral.txt (tasks-axi 0.2.6 from the temp prefix, added to PATH only): defer dates 2026-09-25, 2026-01-01 and 2026-13-40 were each skipped with 'nothing was recorded'. 2026-11-02 printed…
The bearings Captain's Call board shows 'deferred until <date>' and queues a dated defer answer ✅ pass live s8-board-deferred-option-selected.png, s8-board-after-queue.png, s8-board-queued-answer-context.json, s8-board-payload-guards.txt: a real fm-bearings-board.sh build, rendered in headless Chromium. Sub…
A scaffolded no-mistakes brief tells the worker to return ask-user gates to firstmate as needs-decision ✅ pass live s7-brief-ask-user-routing.txt and s7-generated-no-mistakes-brief.md: the brief generated by fm-brief.sh live-nm-task sample --mode no-mistakes carries the --yes ban and 'Ask-user gates must return t…
fm-send refuses unknown flags and stray --key-style arguments before sending anything ⏸️ untested no bin/fm-gate-refuse-lib.sh deliberately blocks gate agents from fm-send, and I did not bypass that guard. To drive this live, run fm-send outside a no-mistakes gate against a fm-lab-* Herdr lab from bi…
Head-keyed PR review and post-merge QA gates run against a real pull request ⏸️ untested no fm-pr-review.sh needs a live GitHub PR through gh/gh-axi and would publish review state to it; this gate step has no authority to do that. It needs a throwaway GitHub repo or PR with gh auth, approved…
Conditional workflows moved from AGENTS.md into skills (#6) load in the right situations ⏸️ untested no Skill and instruction documents have no runtime surface no-mistakes can drive. Whether an agent follows them is a model-interpretation question for development evaluation.
  • FM_HOME=&lt;private&gt; TYPESAFE_API_KEY=&lt;test&gt; bin/fm-dispatch-resolve.sh scout-brief.md --project pager (real curl + quota-axi, local Typesafe stand-in)
  • bin/fm-dispatch-resolve.sh whole-brief.md and a jq -j byte-hash comparison with receipt brief_sha256
  • bin/fm-dispatch-resolve.sh --record-dispatch whole-brief.md --harness claude --model sonnet --effort high, then again after editing the brief
  • FIFO brief swap run against target bin/ and pre-fix git archive 2a50958^ bin
  • fm-captain-hold.sh hold sample-route ... and answers --source live-test with defer dates today, 2026-01-01, 2026-13-40 and 2026-11-02, plus an exact redelivery
  • bin/fm-brief.sh live-nm-task sample --mode no-mistakes in a private FM_HOME
  • bin/fm-bearings-board.sh build payload.json, then chrome-devtools-axi open/click/fill/screenshot/submit in headless Chromium; duplicate-option and invalid-date payloads refused
  • bin/fm-send.sh lane-live --bogus hello and others (refused by the gate guard)
  • bash tests/fm-dispatch-resolve.test.sh, tests/fm-send-strict.test.sh, tests/fm-send-resolve-key.test.sh, tests/fm-pr-review.test.sh, tests/fm-bearings-board-render.test.sh
  • bash tests/fm-pr-merge.test.sh on the target, an isolated target rerun, the base 3377aa61 tree, and with NO_MISTAKES_GATE unset
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@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, your pull request is larger than the review limit of 150,000 diff characters

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 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-25T00:16:16.293424Z ad22624 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad226249fb

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +124 to +125
url:([$reviewer_comments[] | .url] | first // $url),
author:([$reviewer_comments[] | .author.login] | unique | join(",")),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve inline reply URLs for final dispositions

When the final-disposition post is a reply in an existing inline thread—a form explicitly accepted by final-disposition via a #discussion_r... URL—this normalization retains only the thread's first reviewer-comment URL and joins every participant into one author string. Consequently, checkpoint_apply cannot find the exact evidence URL authored by the collector, observed_in_latest_snapshot remains false, and the ready/merge gate stays blocked despite a valid post. Preserve individual inline comments or separately expose the matching disposition reply.

Useful? React with 👍 / 👎.

twilwa and others added 11 commits September 24, 2026 17:29
… 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 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 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 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
* 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(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
* 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
render_call omitted LAVISH_AXI_STATE_DIR, so the stub lavish-axi wrote
/state.json (permission denied), the board listener never resolved its
session, and the build's liveness check failed whenever it sampled after
the listener exited. Mirror render_board: pin the per-home lavish state
and require the listener to reach its poll.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@twilwa
twilwa force-pushed the fm/fm-upstream-sync branch from a405202 to 5e8c2af Compare September 25, 2026 01:08
@twilwa twilwa changed the title feat(bin): replay fork PRs onto upstream and bind resolver receipts to brief snapshots feat(bin): replay fork workflow gates onto upstream with snapshot-bound resolver receipts Sep 25, 2026
@twilwa

twilwa commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #16 (merged).

@twilwa twilwa closed this Sep 25, 2026
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