Skip to content

fix(bin): keep the pr= block last in task metadata on relaunch - #12

Merged
beardedgingerdesigns merged 3 commits into
mainfrom
fm/fm-relaunch-breaks-pr-watch
Oct 4, 2026
Merged

beardedgingerdesigns merged 3 commits into
mainfrom
fm/fm-relaunch-breaks-pr-watch

Conversation

@beardedgingerdesigns

Copy link
Copy Markdown
Owner

Intent

dispatch crews for the queued work that has no blockers

Context: this queued item is a Firstmate bug seen twice on 2026-10-03 (task truss-r40-orbit-blend). After a worker is relaunched on a task that already has a PR, the merge watch for that PR is refused as unauthenticated until bin/fm-pr-check.sh is rerun by hand. Cause: bin/fm-control.sh relaunch appends control_relaunch_tx= after pr= in state/<id>.meta, and fm_pr_metadata_identity_parse in bin/fm-pr-lib.sh treats any line after pr= other than pr_head and x_* as invalid.

What Changed

  • bin/fm-spawn.sh now writes control_relaunch_tx= before the preserved relaunch lines instead of after them, so a preserved pr= / pr_head= block stays last in state/<id>.meta and fm_pr_metadata_identity_parse accepts the record.
  • spawn_record_traceparent inserts the traceparent= carrier ahead of the first pr= line (still appending at the end when the record has no pr=) rather than always appending it, for the same reason.
  • tests/fm-control-relaunch.test.sh adds two cases that relaunch a task whose record already has pr= and pr_head=, one plain and one with trace context on, and assert the resulting record passes fm_pr_metadata_identity_parse.

Risk Assessment

✅ Low: A two-hunk reorder in bin/fm-spawn.sh puts control_relaunch_tx= and traceparent= ahead of the preserved pr= block, both relaunch writers of post-pr keys are covered, and the two new tests drive a real relaunch and the real identity parser.

Testing

Drove the real product four times in a throwaway Herdr lab session and marked lab home (tmux is not installed on this machine, so Herdr was the live backend): a real Claude worker was launched, fm-pr-check.sh armed a merge watch on a real merged public PR (cli/cli#1) through gh, fm-control.sh relaunch replaced the worker, and the real fm-watch.sh ran the check. Fixed commit, trace off and trace on: watcher printed check: ...check.sh: merged and retired the poll. Base commit 27391f2: watcher printed check: rejected unauthenticated state checks, with control_relaunch_tx= after pr_head= in the record. Commit 991b766 with trace on: same refusal, with traceparent= after pr_head=. A fifth drive confirmed the guard is not weakened: the fixed watcher still refuses a record with a foreign key after pr=. Separately, as a non-live unit-test run, the targeted test file passes at the fixed commit (75 ok), and its two new tests fail at the base and pre-review-fix commits respectively; that is recorded as supporting context, not as a live scenario result. No UI surface, so evidence is CLI transcripts. Every lab session I provisioned was torn down with the default-session tripwire unchanged; one stray empty session and some Claude trust entries remain (see findings).

  • Live validation: ✅ go - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Relaunch a worker on a task that already has an armed PR; the watcher then runs the merge check and reports the merge without anyone rerunning fm-pr-check.sh ✅ pass live live-relaunch-fixed.log: record after relaunch has control_relaunch_tx= before pr=; watcher output check: /private/tmp/fm-lab.y46HUO/state/rlpr.check.sh: merged; poll retired, rlpr.pr-poll-merge-not…
Same relaunch with trace context on; traceparent is written before pr= and the watcher still runs the merge check ✅ pass live live-relaunch-fixed-traced.log: .trace-context-effective: 33660 on; record has control_relaunch_tx=, traceparent=, then pr=, pr_head=; watcher output check: .../rl-traced.check.sh: merged
Adversarial: the identical drive on the base commit reproduces the reported bug (merge watch refused as unauthenticated after relaunch) ✅ pass live live-relaunch-base.log: record ends pr=, pr_head=, control_relaunch_tx=; watcher output check: rejected unauthenticated state checks: .../rl-base.check.sh
Adversarial: with trace context on, the commit before the review fix still refuses the merge watch, so the traceparent fix is what makes the traced relaunch pass ✅ pass live live-relaunch-prefix-traced.log: record ends pr=, pr_head=, traceparent=; watcher output check: rejected unauthenticated state checks: .../rl-mid.check.sh
Adversarial: the fix does not weaken the guard; the fixed watcher still refuses a task record with a foreign key after pr= and never executes its check ✅ pass live live-guard-still-refuses-foreign-key.log: check: rejected unauthenticated state checks: .../rl-guard.check.sh, check file still armed
The two new regression tests pass at the fixed commit and fail before their respective fixes ⏸️ untested no The prior payload established this only by running the unit test file tests/fm-control-relaunch.test.sh, which is not a drive of the live running product, so it does not establish a live result. The…
Same relaunch on the tmux backend, where the 2026-10-03 case was presumably seen ⏸️ untested no tmux is not installed on this machine (command -v tmux finds nothing) and installing system packages is outside this phase's boundary. Install tmux and re-run to cover it. The changed code in bin/fm…
Evidence: Fixed commit: relaunch then watcher reports merged

Source: Fixed commit: relaunch then watcher reports merged


=== product under test ===
root=~/.no-mistakes/worktrees/d2386019607f/01M43SNZP68TR050EE5X40A4N0 label=fixed trace=off
herdr=herdr 0.8.0 claude=2.1.289 (Claude Code)

=== lab home + lab Herdr session ===
home=/private/tmp/fm-lab.y46HUO session=fm-lab-rlpr-fixed-70500-3533

=== launch the first real Claude worker (fm-spawn.sh --relaunch into the agent-free pane) ===
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
warning: /private/tmp/fm-lab.y46HUO/data/rlpr/launch-brief.md records no ship branch; defaulting to legacy branch fm/rlpr
warning: /private/tmp/fm-lab.y46HUO/data/rlpr/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned rlpr harness=claude kind=ship mode=no-mistakes yolo=off window=fm-lab-rlpr-fixed-70500-3533:w1:p2 worktree=/private/tmp/fm-lab.y46HUO/wt
agent_state=alive

=== worker pane (first incarnation) ===
  /1791129306-0f327c83abb43555.msg' and handle its
  contents as Firstmate operational input.

  Read 1 file

⏺ READY

✻ Cogitated for 4s · done 10:55 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 1…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== arm the PR merge watch: fm-pr-check.sh rlpr https://github.com/cli/cli/pull/1 ===
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
armed: state/rlpr.check.sh

=== task record before relaunch ===
    window=fm-lab-rlpr-fixed-70500-3533:w1:p2
    endpoint_task_id=rlpr
    worktree=/private/tmp/fm-lab.y46HUO/wt
    project=/private/tmp/fm-lab.y46HUO/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rlpr
    tasktmp=/tmp/fm-rlpr
    model=default
    effort=default
    busy_gen=g1791129301.72561.1315
    spawn_gen=s1791129302.70792.13942
    backend=herdr
    herdr_session=fm-lab-rlpr-fixed-70500-3533
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4

=== fm-control.sh rlpr relaunch --note ... ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.y46HUO
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.y46HUO
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
warning: /private/tmp/fm-lab.y46HUO/data/rlpr/launch-brief.md records no ship branch; defaulting to legacy branch fm/rlpr
warning: /private/tmp/fm-lab.y46HUO/data/rlpr/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
relaunched rlpr harness=claude from=claude model=default effort=default backend=herdr endpoint=fm-lab-rlpr-fixed-70500-3533:w1:p2 worktree=/private/tmp/fm-lab.y46HUO/wt
relaunch exit=0
agent_state=alive

=== task record after relaunch ===
    window=fm-lab-rlpr-fixed-70500-3533:w1:p2
    endpoint_task_id=rlpr
    worktree=/private/tmp/fm-lab.y46HUO/wt
    project=/private/tmp/fm-lab.y46HUO/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rlpr
    tasktmp=/tmp/fm-rlpr
    model=default
    effort=default
    busy_gen=g1791129362.84396.2737
    spawn_gen=s1791129362.83683.8901
    backend=herdr
    herdr_session=fm-lab-rlpr-fixed-70500-3533
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    control_relaunch_tx=82248.20261004T155559Z.28992
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4

=== worker pane (replacement) ===


⏺ READY

✻ Worked for 13s · done 10:56 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 6…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== watcher: run the real bin/fm-watch.sh until it reports on the check ===
    rlpr.busy-gen
    rlpr.busy-state
    rlpr.check.sh
    rlpr.control-relaunch
    rlpr.control-relaunch.brief-prior
    rlpr.control-relaunch.meta-prior
    rlpr.control-relaunch.note
    rlpr.git-hooks
    rlpr.inbox
    rlpr.meta
    rlpr.pr-poll
    rlpr.pr-poll-registration
    rlpr.turn-ended
watcher output (1 run(s)):
    check: /private/tmp/fm-lab.y46HUO/state/rlpr.check.sh: merged

=== state after the watcher ===
    rlpr.busy-gen
    rlpr.busy-state
    rlpr.control-relaunch
    rlpr.control-relaunch.brief-prior
    rlpr.control-relaunch.meta-prior
    rlpr.control-relaunch.note
    rlpr.git-hooks
    rlpr.inbox
    rlpr.meta
    rlpr.pr-poll-merge-notified
    rlpr.turn-ended

=== cleanup ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.y46HUO
stopped rlpr harness=claude backend=herdr endpoint=fm-lab-rlpr-fixed-70500-3533:w1:p2 worktree=/private/tmp/fm-lab.y46HUO/wt
lab session fm-lab-rlpr-fixed-70500-3533 torn down; default-session tripwire unchanged
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/pre-rebase: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/pre-applypatch: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/pre-auto-gc: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/pre-merge-commit: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/post-commit: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/sendemail-validate: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/applypatch-msg: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/prepare-commit-msg: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/post-checkout: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/post-applypatch: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/post-rewrite: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/commit-msg: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/pre-push: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/post-merge: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks/pre-commit: Permission denied
rm: /private/tmp/fm-lab.y46HUO/state/rlpr.git-hooks: Directory not empty
rm: /private/tmp/fm-lab.y46HUO/state: Directory not empty
rm: /private/tmp/fm-lab.y46HUO: Directory not empty
RESULT[fixed]=merge-watch-ran-and-reported-merged
Evidence: Fixed commit, trace context on: relaunch then watcher reports merged

Source: Fixed commit, trace context on: relaunch then watcher reports merged


=== product under test ===
root=~/.no-mistakes/worktrees/d2386019607f/01M43SNZP68TR050EE5X40A4N0 label=traced trace=on
herdr=herdr 0.8.0 claude=2.1.289 (Claude Code)

=== lab home + lab Herdr session ===
home=/private/tmp/fm-lab.KUIBQq session=fm-lab-rl-traced-33662-31583

=== trace context on for this home's session ===
.trace-context-effective: 33660 on

=== launch the first real Claude worker (fm-spawn.sh --relaunch into the agent-free pane) ===
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
warning: /private/tmp/fm-lab.KUIBQq/data/rl-traced/launch-brief.md records no ship branch; defaulting to legacy branch fm/rl-traced
warning: /private/tmp/fm-lab.KUIBQq/data/rl-traced/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned rl-traced harness=claude kind=ship mode=no-mistakes yolo=off window=fm-lab-rl-traced-33662-31583:w1:p2 worktree=/private/tmp/fm-lab.KUIBQq/wt
agent_state=alive

=== worker pane (first incarnation) ===
  /1791129564-bca3739738c80066.msg' and handle its
  contents as Firstmate operational input.

  Read 1 file

⏺ READY

✻ Brewed for 6s · done 10:59 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 1…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== arm the PR merge watch: fm-pr-check.sh rl-traced https://github.com/cli/cli/pull/1 ===
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
armed: state/rl-traced.check.sh

=== task record before relaunch ===
    window=fm-lab-rl-traced-33662-31583:w1:p2
    endpoint_task_id=rl-traced
    worktree=/private/tmp/fm-lab.KUIBQq/wt
    project=/private/tmp/fm-lab.KUIBQq/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rl-traced
    tasktmp=/tmp/fm-rl-traced
    model=default
    effort=default
    busy_gen=g1791129561.35905.28030
    spawn_gen=s1791129562.34128.16723
    backend=herdr
    herdr_session=fm-lab-rl-traced-33662-31583
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    traceparent=00-9c660bbf522acfca7efa76a3e00642bf-72b3dbf5e481d7bf-01
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4

=== fm-control.sh rl-traced relaunch --note ... ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.KUIBQq
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.KUIBQq
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
warning: /private/tmp/fm-lab.KUIBQq/data/rl-traced/launch-brief.md records no ship branch; defaulting to legacy branch fm/rl-traced
warning: /private/tmp/fm-lab.KUIBQq/data/rl-traced/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
relaunched rl-traced harness=claude from=claude model=default effort=default backend=herdr endpoint=fm-lab-rl-traced-33662-31583:w1:p2 worktree=/private/tmp/fm-lab.KUIBQq/wt
relaunch exit=0
agent_state=alive

=== task record after relaunch ===
    window=fm-lab-rl-traced-33662-31583:w1:p2
    endpoint_task_id=rl-traced
    worktree=/private/tmp/fm-lab.KUIBQq/wt
    project=/private/tmp/fm-lab.KUIBQq/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rl-traced
    tasktmp=/tmp/fm-rl-traced
    model=default
    effort=default
    busy_gen=g1791129618.52524.16138
    spawn_gen=s1791129619.50918.2971
    backend=herdr
    herdr_session=fm-lab-rl-traced-33662-31583
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    control_relaunch_tx=48946.20261004T160015Z.4888
    traceparent=00-9c660bbf522acfca7efa76a3e00642bf-72b3dbf5e481d7bf-01
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4

=== worker pane (replacement) ===
  Read 1 file, listed 1 directory

⏺ READY

✻ Churned for 14s · done 11:00 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 9…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== watcher: run the real bin/fm-watch.sh until it reports on the check ===
    rl-traced.busy-gen
    rl-traced.busy-state
    rl-traced.check.sh
    rl-traced.control-relaunch
    rl-traced.control-relaunch.brief-prior
    rl-traced.control-relaunch.meta-prior
    rl-traced.control-relaunch.note
    rl-traced.git-hooks
    rl-traced.inbox
    rl-traced.meta
    rl-traced.pr-poll
    rl-traced.pr-poll-registration
    rl-traced.turn-ended
watcher output (1 run(s)):
    check: /private/tmp/fm-lab.KUIBQq/state/rl-traced.check.sh: merged

=== state after the watcher ===
    rl-traced.busy-gen
    rl-traced.busy-state
    rl-traced.control-relaunch
    rl-traced.control-relaunch.brief-prior
    rl-traced.control-relaunch.meta-prior
    rl-traced.control-relaunch.note
    rl-traced.git-hooks
    rl-traced.inbox
    rl-traced.meta
    rl-traced.pr-poll-merge-notified
    rl-traced.turn-ended

=== cleanup ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.KUIBQq
stopped rl-traced harness=claude backend=herdr endpoint=fm-lab-rl-traced-33662-31583:w1:p2 worktree=/private/tmp/fm-lab.KUIBQq/wt
lab session fm-lab-rl-traced-33662-31583 torn down; default-session tripwire unchanged
lab home removed
RESULT[traced]=merge-watch-ran-and-reported-merged
Evidence: Base commit 27391f2: watcher refuses the check as unauthenticated

Source: Base commit 27391f2: watcher refuses the check as unauthenticated


=== product under test ===
root=/tmp/fm-relaunch-base.O3gP3H label=base trace=off
herdr=herdr 0.8.0 claude=2.1.289 (Claude Code)

=== lab home + lab Herdr session ===
home=/private/tmp/fm-lab.hwNkWP session=fm-lab-rl-base-97129-9110

=== launch the first real Claude worker (fm-spawn.sh --relaunch into the agent-free pane) ===
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
warning: /private/tmp/fm-lab.hwNkWP/data/rl-base/launch-brief.md records no ship branch; defaulting to legacy branch fm/rl-base
warning: /private/tmp/fm-lab.hwNkWP/data/rl-base/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned rl-base harness=claude kind=ship mode=no-mistakes yolo=off window=fm-lab-rl-base-97129-9110:w1:p2 worktree=/private/tmp/fm-lab.hwNkWP/wt
agent_state=alive

=== worker pane (first incarnation) ===
  /1791129455-5f64dbfefc0ec138.msg' and handle its
  contents as Firstmate operational input.

  Read 1 file

⏺ READY

✻ Cogitated for 5s · done 10:57 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 1…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== arm the PR merge watch: fm-pr-check.sh rl-base https://github.com/cli/cli/pull/1 ===
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
armed: state/rl-base.check.sh

=== task record before relaunch ===
    window=fm-lab-rl-base-97129-9110:w1:p2
    endpoint_task_id=rl-base
    worktree=/private/tmp/fm-lab.hwNkWP/wt
    project=/private/tmp/fm-lab.hwNkWP/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rl-base
    tasktmp=/tmp/fm-rl-base
    model=default
    effort=default
    busy_gen=g1791129449.617.2055
    spawn_gen=s1791129450.97971.22397
    backend=herdr
    herdr_session=fm-lab-rl-base-97129-9110
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4

=== fm-control.sh rl-base relaunch --note ... ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.hwNkWP
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.hwNkWP
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
warning: /private/tmp/fm-lab.hwNkWP/data/rl-base/launch-brief.md records no ship branch; defaulting to legacy branch fm/rl-base
warning: /private/tmp/fm-lab.hwNkWP/data/rl-base/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
relaunched rl-base harness=claude from=claude model=default effort=default backend=herdr endpoint=fm-lab-rl-base-97129-9110:w1:p2 worktree=/private/tmp/fm-lab.hwNkWP/wt
relaunch exit=0
agent_state=alive

=== task record after relaunch ===
    window=fm-lab-rl-base-97129-9110:w1:p2
    endpoint_task_id=rl-base
    worktree=/private/tmp/fm-lab.hwNkWP/wt
    project=/private/tmp/fm-lab.hwNkWP/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rl-base
    tasktmp=/tmp/fm-rl-base
    model=default
    effort=default
    busy_gen=g1791129511.19029.17172
    spawn_gen=s1791129512.17832.21513
    backend=herdr
    herdr_session=fm-lab-rl-base-97129-9110
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4
    control_relaunch_tx=14958.20261004T155828Z.11900

=== worker pane (replacement) ===


⏺ READY

✻ Churned for 13s · done 10:58 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 9…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== watcher: run the real bin/fm-watch.sh until it reports on the check ===
    rl-base.busy-gen
    rl-base.busy-state
    rl-base.check.sh
    rl-base.control-relaunch
    rl-base.control-relaunch.brief-prior
    rl-base.control-relaunch.meta-prior
    rl-base.control-relaunch.note
    rl-base.git-hooks
    rl-base.inbox
    rl-base.meta
    rl-base.pr-poll
    rl-base.pr-poll-registration
    rl-base.turn-ended
watcher output (1 run(s)):
    check: rejected unauthenticated state checks: /private/tmp/fm-lab.hwNkWP/state/rl-base.check.sh

=== state after the watcher ===
    rl-base.busy-gen
    rl-base.busy-state
    rl-base.check.sh
    rl-base.control-relaunch
    rl-base.control-relaunch.brief-prior
    rl-base.control-relaunch.meta-prior
    rl-base.control-relaunch.note
    rl-base.git-hooks
    rl-base.inbox
    rl-base.meta
    rl-base.pr-poll
    rl-base.pr-poll-registration
    rl-base.turn-ended

=== cleanup ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.hwNkWP
stopped rl-base harness=claude backend=herdr endpoint=fm-lab-rl-base-97129-9110:w1:p2 worktree=/private/tmp/fm-lab.hwNkWP/wt
lab session fm-lab-rl-base-97129-9110 torn down; default-session tripwire unchanged
lab home removed
RESULT[base]=merge-watch-REFUSED-as-unauthenticated
Evidence: Commit 991b766, trace context on: watcher refuses the check

Source: Commit 991b766, trace context on: watcher refuses the check


=== product under test ===
root=/tmp/fm-relaunch-mid.C85jGO label=mid trace=on
herdr=herdr 0.8.0 claude=2.1.289 (Claude Code)

=== lab home + lab Herdr session ===
home=/private/tmp/fm-lab.1HFI4T session=fm-lab-rl-mid-67558-9060

=== trace context on for this home's session ===
.trace-context-effective: 67551 on

=== launch the first real Claude worker (fm-spawn.sh --relaunch into the agent-free pane) ===
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
warning: /private/tmp/fm-lab.1HFI4T/data/rl-mid/launch-brief.md records no ship branch; defaulting to legacy branch fm/rl-mid
warning: /private/tmp/fm-lab.1HFI4T/data/rl-mid/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned rl-mid harness=claude kind=ship mode=no-mistakes yolo=off window=fm-lab-rl-mid-67558-9060:w1:p2 worktree=/private/tmp/fm-lab.1HFI4T/wt
agent_state=alive

=== worker pane (first incarnation) ===
  /1791129680-fcb2e8365f5bd3bf.msg' and handle its
  contents as Firstmate operational input.

  Read 1 file

⏺ READY

✻ Cogitated for 7s · done 11:01 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 1…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== arm the PR merge watch: fm-pr-check.sh rl-mid https://github.com/cli/cli/pull/1 ===
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
armed: state/rl-mid.check.sh

=== task record before relaunch ===
    window=fm-lab-rl-mid-67558-9060:w1:p2
    endpoint_task_id=rl-mid
    worktree=/private/tmp/fm-lab.1HFI4T/wt
    project=/private/tmp/fm-lab.1HFI4T/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rl-mid
    tasktmp=/tmp/fm-rl-mid
    model=default
    effort=default
    busy_gen=g1791129675.70553.2567
    spawn_gen=s1791129676.68529.30226
    backend=herdr
    herdr_session=fm-lab-rl-mid-67558-9060
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    traceparent=00-075a8dedff3f2c0f29075358dfa580f5-3197d9d624009ada-01
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4

=== fm-control.sh rl-mid relaunch --note ... ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.1HFI4T
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.1HFI4T
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
warning: /private/tmp/fm-lab.1HFI4T/data/rl-mid/launch-brief.md records no ship branch; defaulting to legacy branch fm/rl-mid
warning: /private/tmp/fm-lab.1HFI4T/data/rl-mid/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
relaunched rl-mid harness=claude from=claude model=default effort=default backend=herdr endpoint=fm-lab-rl-mid-67558-9060:w1:p2 worktree=/private/tmp/fm-lab.1HFI4T/wt
relaunch exit=0
agent_state=alive

=== task record after relaunch ===
    window=fm-lab-rl-mid-67558-9060:w1:p2
    endpoint_task_id=rl-mid
    worktree=/private/tmp/fm-lab.1HFI4T/wt
    project=/private/tmp/fm-lab.1HFI4T/projects/demo
    harness=claude
    kind=ship
    mode=no-mistakes
    yolo=off
    branch=fm/rl-mid
    tasktmp=/tmp/fm-rl-mid
    model=default
    effort=default
    busy_gen=g1791129735.88178.15294
    spawn_gen=s1791129736.86580.22486
    backend=herdr
    herdr_session=fm-lab-rl-mid-67558-9060
    herdr_workspace_id=w1
    herdr_tab_id=w1:t2
    herdr_pane_id=w1:p2
    control_relaunch_tx=84531.20261004T160212Z.20907
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4
    traceparent=00-075a8dedff3f2c0f29075358dfa580f5-3197d9d624009ada-01

=== worker pane (replacement) ===
  nothing to act on. No files edited, no PR opened;
  the only command run was the inbox listing the
  relaunch note asked for.

✻ Crunched for 15s · done 11:02 AM

──────────────────────────────────────────────────────
❯
──────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_COD…
  Opus 5.5 (1M context) · high │ wt ░░░░░░░░░░ 8% 1…
  ⏵⏵ bypass permissions on (shift+tab to cycle)
=== watcher: run the real bin/fm-watch.sh until it reports on the check ===
    rl-mid.busy-gen
    rl-mid.busy-state
    rl-mid.check.sh
    rl-mid.control-relaunch
    rl-mid.control-relaunch.brief-prior
    rl-mid.control-relaunch.meta-prior
    rl-mid.control-relaunch.note
    rl-mid.git-hooks
    rl-mid.inbox
    rl-mid.meta
    rl-mid.pr-poll
    rl-mid.pr-poll-registration
    rl-mid.turn-ended
watcher output (1 run(s)):
    check: rejected unauthenticated state checks: /private/tmp/fm-lab.1HFI4T/state/rl-mid.check.sh

=== state after the watcher ===
    rl-mid.busy-gen
    rl-mid.busy-state
    rl-mid.check.sh
    rl-mid.control-relaunch
    rl-mid.control-relaunch.brief-prior
    rl-mid.control-relaunch.meta-prior
    rl-mid.control-relaunch.note
    rl-mid.git-hooks
    rl-mid.inbox
    rl-mid.meta
    rl-mid.pr-poll
    rl-mid.pr-poll-registration
    rl-mid.turn-ended

=== cleanup ===
fm-gate-refuse: gate agent lifecycle permitted only against lab home /private/tmp/fm-lab.1HFI4T
stopped rl-mid harness=claude backend=herdr endpoint=fm-lab-rl-mid-67558-9060:w1:p2 worktree=/private/tmp/fm-lab.1HFI4T/wt
lab session fm-lab-rl-mid-67558-9060 torn down; default-session tripwire unchanged
lab home removed
RESULT[mid]=merge-watch-REFUSED-as-unauthenticated
Evidence: Fixed commit still refuses a foreign key after pr=

Source: Fixed commit still refuses a foreign key after pr=

=== fixed commit: arm the merge watch, then something else appends a foreign key after pr= ===
armed: state/rl-guard.check.sh
    pr=https://github.com/cli/cli/pull/1
    pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4
    some_other_key=1
=== fixed commit watcher ===
    check: rejected unauthenticated state checks: /private/tmp/fm-lab.rlguard/state/rl-guard.check.sh
    still armed, never executed: rl-guard.check.sh
Evidence: Before/after: tail of the task record and watcher verdict
BASE 27391f2 (after fm-control.sh relaunch)
pr=https://github.com/cli/cli/pull/1
pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4
control_relaunch_tx=14958.20261004T155828Z.11900
watcher: check: rejected unauthenticated state checks: /private/tmp/fm-lab.hwNkWP/state/rl-base.check.sh

FIXED 3bc76a9 (after fm-control.sh relaunch)
control_relaunch_tx=82248.20261004T155559Z.28992
pr=https://github.com/cli/cli/pull/1
pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4
watcher: check: /private/tmp/fm-lab.y46HUO/state/rlpr.check.sh: merged

FIXED 3bc76a9, trace context on
control_relaunch_tx=48946.20261004T160015Z.4888
traceparent=00-9c660bbf522acfca7efa76a3e00642bf-72b3dbf5e481d7bf-01
pr=https://github.com/cli/cli/pull/1
pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4
watcher: check: /private/tmp/fm-lab.KUIBQq/state/rl-traced.check.sh: merged

991b766 (before review fix), trace context on
control_relaunch_tx=84531.20261004T160212Z.20907
pr=https://github.com/cli/cli/pull/1
pr_head=e9a3253762e768badaa1d4a5b3d267416d1e42f4
traceparent=00-075a8dedff3f2c0f29075358dfa580f5-3197d9d624009ada-01
watcher: check: rejected unauthenticated state checks: /private/tmp/fm-lab.1HFI4T/state/rl-mid.check.sh
- Outcome: ⚠️ 2 infos across 1 run (26m11s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 2 infos
  • ℹ️ My guard check used a task record naming a Herdr session fm-lab-none that did not exist, and running fm-pr-check.sh/fm-watch.sh against it left an empty running Herdr session of that name (no workspaces). bin/fm-herdr-lab.sh teardown refuses it because it has no ownership tripwire, and I did not bypass the helper. To remove it: herdr session stop fm-lab-none --session fm-lab-none &amp;&amp; herdr session delete fm-lab-none --session fm-lab-none. The default session was not touched. A second session, fm-lab-relaunch-pr-87993-11575, and /tmp/fm-lab.WvKUld existed before this run and are not mine.
  • ℹ️ Launching real Claude workers made the product's own bin/fm-claude-trust.sh add workspace-trust entries to ~/.claude.json for eight deleted lab paths (/private/tmp/fm-lab.{y46HUO,hwNkWP,KUIBQq,1HFI4T}/{wt,projects/demo}). They are inert and I left them rather than edit user config by hand.
  • Live validation: ✅ go - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Relaunch a worker on a task that already has an armed PR; the watcher then runs the merge check and reports the merge without anyone rerunning fm-pr-check.sh ✅ pass live live-relaunch-fixed.log: record after relaunch has control_relaunch_tx= before pr=; watcher output check: /private/tmp/fm-lab.y46HUO/state/rlpr.check.sh: merged; poll retired, rlpr.pr-poll-merge-not…
Same relaunch with trace context on; traceparent is written before pr= and the watcher still runs the merge check ✅ pass live live-relaunch-fixed-traced.log: .trace-context-effective: 33660 on; record has control_relaunch_tx=, traceparent=, then pr=, pr_head=; watcher output check: .../rl-traced.check.sh: merged
Adversarial: the identical drive on the base commit reproduces the reported bug (merge watch refused as unauthenticated after relaunch) ✅ pass live live-relaunch-base.log: record ends pr=, pr_head=, control_relaunch_tx=; watcher output check: rejected unauthenticated state checks: .../rl-base.check.sh
Adversarial: with trace context on, the commit before the review fix still refuses the merge watch, so the traceparent fix is what makes the traced relaunch pass ✅ pass live live-relaunch-prefix-traced.log: record ends pr=, pr_head=, traceparent=; watcher output check: rejected unauthenticated state checks: .../rl-mid.check.sh
Adversarial: the fix does not weaken the guard; the fixed watcher still refuses a task record with a foreign key after pr= and never executes its check ✅ pass live live-guard-still-refuses-foreign-key.log: check: rejected unauthenticated state checks: .../rl-guard.check.sh, check file still armed
The two new regression tests pass at the fixed commit and fail before their respective fixes ⏸️ untested no The prior payload established this only by running the unit test file tests/fm-control-relaunch.test.sh, which is not a drive of the live running product, so it does not establish a live result. The…
Same relaunch on the tmux backend, where the 2026-10-03 case was presumably seen ⏸️ untested no tmux is not installed on this machine (command -v tmux finds nothing) and installing system packages is outside this phase's boundary. Install tmux and re-run to cover it. The changed code in bin/fm…
  • live-drive.sh &lt;worktree&gt; fixed off - Herdr lab + real Claude worker + bin/fm-pr-check.sh rlpr https://github.com/cli/cli/pull/1 + bin/fm-control.sh rlpr relaunch --note ... + bin/fm-watch.sh at 3bc76a9
  • live-drive.sh &lt;worktree&gt; traced on - same drive with config/trace-context and the session-start trace record on, at 3bc76a9
  • live-drive.sh &lt;git archive of 27391f2&gt; base off - same drive against the base commit
  • live-drive.sh &lt;git archive of 991b766&gt; mid on - same drive, trace on, against the commit before the review fix
  • Fixed-commit bin/fm-pr-check.sh then a foreign some_other_key=1 appended after pr=, then bin/fm-watch.sh
  • bash tests/fm-control-relaunch.test.sh at 3bc76a9 (unit test, not live): 75 ok, rc=0
  • bash tests/fm-control-relaunch.test.sh (the new test file) run inside archives of 27391f2 and 991b766 (unit test, not live): the new test for each fix fails before that fix
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

… relaunch

fm_pr_metadata_identity_parse rejects any key after pr= other than pr_head and x_*, so a relaunched task with a PR lost its merge watch until fm-pr-check.sh was rerun.
@beardedgingerdesigns
beardedgingerdesigns merged commit 63fe176 into main Oct 4, 2026
35 of 37 checks passed
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