Repository navigation
fix(bin): keep the pr= block last in task metadata on relaunch - #12
Merged
Merged
Conversation
… 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.
… block on relaunch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.shis rerun by hand. Cause:bin/fm-control.sh relaunchappendscontrol_relaunch_tx=afterpr=instate/<id>.meta, andfm_pr_metadata_identity_parseinbin/fm-pr-lib.shtreats any line afterpr=other thanpr_headandx_*as invalid.What Changed
bin/fm-spawn.shnow writescontrol_relaunch_tx=before the preserved relaunch lines instead of after them, so a preservedpr=/pr_head=block stays last instate/<id>.metaandfm_pr_metadata_identity_parseaccepts the record.spawn_record_traceparentinserts thetraceparent=carrier ahead of the firstpr=line (still appending at the end when the record has nopr=) rather than always appending it, for the same reason.tests/fm-control-relaunch.test.shadds two cases that relaunch a task whose record already haspr=andpr_head=, one plain and one with trace context on, and assert the resulting record passesfm_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.sharmed a merge watch on a real merged public PR (cli/cli#1) through gh,fm-control.sh relaunchreplaced the worker, and the realfm-watch.shran the check. Fixed commit, trace off and trace on: watcher printedcheck: ...check.sh: mergedand retired the poll. Base commit 27391f2: watcher printedcheck: rejected unauthenticated state checks, withcontrol_relaunch_tx=afterpr_head=in the record. Commit 991b766 with trace on: same refusal, withtraceparent=afterpr_head=. A fifth drive confirmed the guard is not weakened: the fixed watcher still refuses a record with a foreign key afterpr=. 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).check: /private/tmp/fm-lab.y46HUO/state/rlpr.check.sh: merged; poll retired, rlpr.pr-poll-merge-not….trace-context-effective: 33660 on; record has control_relaunch_tx=, traceparent=, then pr=, pr_head=; watcher outputcheck: .../rl-traced.check.sh: mergedcheck: rejected unauthenticated state checks: .../rl-base.check.shcheck: rejected unauthenticated state checks: .../rl-mid.check.shcheck: rejected unauthenticated state checks: .../rl-guard.check.sh, check file still armedtests/fm-control-relaunch.test.sh, which is not a drive of the live running product, so it does not establish a live result. The…command -v tmuxfinds 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
Evidence: Fixed commit, trace context on: relaunch then watcher reports merged
Source: Fixed commit, trace context on: relaunch then watcher reports merged
Evidence: Base commit 27391f2: watcher refuses the check as unauthenticated
Source: Base commit 27391f2: watcher refuses the check as unauthenticated
Evidence: Commit 991b766, trace context on: watcher refuses the check
Source: Commit 991b766, trace context on: watcher refuses the check
Evidence: Fixed commit still refuses a foreign key after pr=
Source: Fixed commit still refuses a foreign key after pr=
Evidence: Before/after: tail of the task record and watcher verdict
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
fm-lab-nonethat did not exist, and runningfm-pr-check.sh/fm-watch.shagainst it left an empty running Herdr session of that name (no workspaces).bin/fm-herdr-lab.sh teardownrefuses 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 && 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.WvKUldexisted before this run and are not mine.bin/fm-claude-trust.shadd workspace-trust entries to~/.claude.jsonfor 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.check: /private/tmp/fm-lab.y46HUO/state/rlpr.check.sh: merged; poll retired, rlpr.pr-poll-merge-not….trace-context-effective: 33660 on; record has control_relaunch_tx=, traceparent=, then pr=, pr_head=; watcher outputcheck: .../rl-traced.check.sh: mergedcheck: rejected unauthenticated state checks: .../rl-base.check.shcheck: rejected unauthenticated state checks: .../rl-mid.check.shcheck: rejected unauthenticated state checks: .../rl-guard.check.sh, check file still armedtests/fm-control-relaunch.test.sh, which is not a drive of the live running product, so it does not establish a live result. The…command -v tmuxfinds 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 <worktree> 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.shat 3bc76a9live-drive.sh <worktree> traced on- same drive withconfig/trace-contextand the session-start trace record on, at 3bc76a9live-drive.sh <git archive of 27391f2> base off- same drive against the base commitlive-drive.sh <git archive of 991b766> mid on- same drive, trace on, against the commit before the review fixFixed-commitbin/fm-pr-check.shthen a foreignsome_other_key=1appended afterpr=, thenbin/fm-watch.shbash tests/fm-control-relaunch.test.shat 3bc76a9 (unit test, not live): 75 ok, rc=0bash 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.