Skip to content

feat(bin): continue published PR branches through a guarded resync owner - #50

Merged
Pibomeister merged 16 commits into
mainfrom
fm/fm-pr-published-head-resync-2
Nov 3, 2026
Merged

Pibomeister merged 16 commits into
mainfrom
fm/fm-pr-published-head-resync-2

Conversation

@Pibomeister

@Pibomeister Pibomeister commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Intent

Finish the three required independent Fable review fixes for the preserved pipeline-resync work from PR49 at published d926f79. Gate relaunch_pr_resync on no-mistakes delivery (or a verified no-mistakes remote); relaunch must refuse diverged history rather than archive-advance it, with a direct-PR relaunch negative control. Restore a --pr-branch pool copy to detached on spawn refusal and assert the actual POOL_DIR HEAD. If read-tree fails after conditional update-ref, conditionally restore the branch ref to local_head while retaining the archive, with behavioral tests. Minors4/5 are optional. Use a fresh40M Opus closeout task from the current pushed source; preserve all previous work and costs. Deliver a green Pibomeister/firstmate PR targeting main. Main firstmate merges when green.

Substance of the referenced review of PR49 (pipeline-resync work): (1) blocker - bin/fm-spawn.sh runs the published-head resync for every ship relaunch whose branch exists on origin regardless of delivery mode, so in direct-PR and local-only modes, where the worker owns the branch, a locally amended or rebased but unpushed branch is moved back to origin's older head and its work archived, reversing the relaunch's promise to continue from the branch's current state; there was no direct-PR relaunch negative control. (2) major - a fresh --pr-branch spawn whose resync refuses (exit 1 or 3) after the owner switched the detached pool copy onto the branch leaves that pool copy on a named branch, and the existing test asserted only project refs, never the pool copy's HEAD. (3) major - in bin/fm-pr-resync.sh, if read-tree -m -u fails after the old-OID-conditional update-ref succeeded, HEAD sits at the published head while the index and worktree hold the stale tree, so a later commit would recreate stale content; the fix is a conditional update-ref back to the old local head (old value = the published head) with the archive kept. Optional minor 4: the relaunch origin probe reads exit 2 as branch-absent and hardcodes 120 seconds instead of honoring FM_PR_RESYNC_TIMEOUT. Optional minor 5: --from-branch spawn tests append a synthetic Setup heading instead of scaffolding with fm-brief.sh --from-branch.

What Changed

  • Added bin/fm-pr-resync.sh, the single owner for continuing work on a branch whose pull-request head the pipeline may have rebased and republished. It verifies origin's published head and reads no-mistakes custody with axi sync --check. It then classifies the local branch as equal, ahead, advanced, or archived-advanced. A diverged history is first kept at archive/<task>-pre-rebase-<sha8>. All ref moves are old-OID-conditional. --refuse-diverged leaves a diverged branch untouched. If the index or worktree update fails after the ref moved, the script conditionally moves the branch back to the old local head and keeps the archive. It exits 3 when a pipeline run is active, and --check previews the action without moving any refs.
  • fm-spawn.sh, fm-promote.sh and fm-brief.sh gain --pr-branch, to continue an existing published branch through the resync owner, and --from-branch, to start from origin's source branch while the PR targets the default branch. A refused --pr-branch spawn puts the pool copy back on a detached HEAD. Ship relaunches run the resync only for no-mistakes delivery or when a no-mistakes remote exists. Explicit direct-PR and local-only modes skip it, and a relaunch refuses diverged history instead of archiving it. fm-dod-lib.sh now sends workers to the resync owner instead of hand-run archive, reset or sync steps when branch_sync reports divergence.
  • Updated docs/agent-control.md, docs/architecture.md and the validation-supervision skill to name the resync owner. Added tests/fm-pr-resync.test.sh and extended the brief, relaunch, spawn, DoD and delivery tests. New cases cover a direct-PR relaunch negative control, the pool copy's HEAD after a refused spawn, and rollback after a failed index update.

Risk Assessment

⚠️ Medium: All three required fixes are in place with behavioral tests: relaunch is gated and refuses divergence (with a direct-PR control), the pool copy is restored to detached, and read-tree failure triggers a conditional move-back; but a direct-PR relaunch in a repo with a no-mistakes remote is still routed through the resync and refused, and the relaunch docs are now stale.

Testing

I ran the three focused suites. They drive the real bin/fm-spawn.sh (--relaunch and fresh --pr-branch) and bin/fm-pr-resync.sh against disposable git origins, worktrees and pool copies; all three exited 0. The scenarios cover: - the explicit direct-PR and local-only relaunch skip, with a no-mistakes remote and amended local history - the no-mistakes and legacy diverged refusal, with no move and no archive - the behind advance - the pool copy restored to detached after an owner refusal - the read-tree failure rollback and the concurrent-writer preservation Red counterfactuals showed the explicit-mode precedence guard, the --refuse-diverged wiring and the read-tree move-back are each needed. The pool-detach counterfactual did not apply, so that guard has a passing test but no red proof. The agent launch inside fm-spawn is a test launcher, not a real Claude primary in an fm-lab home. The changed behavior is all git branch custody, which ran for real. There is no UI surface, so no screenshots. The worktree is clean and every file was restored. Overall: go.

  • Live validation: ✅ go - 9 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Direct-PR relaunch in a repo with a no-mistakes remote, on a branch amended locally and not pushed: it launches without calling the resync owner, and HEAD stays at the amended commit with no archive ✅ pass live tests/fm-control-relaunch.test.sh case rl96-direct-PR; CF1 counterfactual went red
Local-only relaunch in a repo with a no-mistakes remote, on a branch amended locally and not pushed: it launches without calling the resync owner, and HEAD stays at the amended commit with no archive ✅ pass live tests/fm-control-relaunch.test.sh case rl96-local-only
No-mistakes relaunch where the pipeline rebased and republished the branch (diverged): the relaunch is refused, the branch is left as-is, nothing is archived and nothing launches ✅ pass live tests/fm-control-relaunch.test.sh case rl90; CF2 counterfactual went red
Legacy relaunch with no recorded mode in a repo with a no-mistakes remote: the resync owner still runs and refuses the diverged branch without moving it ✅ pass live tests/fm-control-relaunch.test.sh case rl97
No-mistakes relaunch where the branch is only behind origin: it advances to the published head and launches ✅ pass live tests/fm-control-relaunch.test.sh case rl95
Fresh --pr-branch spawn where the resync owner refuses (exit 1 or 3) after switching the pool copy: POOL_DIR is detached again at its original HEAD with its files intact, project refs are unchanged, a… ✅ pass live tests/fm-spawn-pool-base-freshen.test.sh: test_pr_branch_unsettled_custody_restores_detached_pool and test_pr_branch_active_custody_refuses_without_launch
fm-pr-resync.sh where read-tree fails after the conditional advance: the branch and HEAD move back to the old local head, the index and worktree stay clean, and the archive is kept ✅ pass live tests/fm-pr-resync.test.sh 'an index update failure restores the branch and reports the retained archive'; CF4 counterfactual went red
Adversarial: a concurrent writer moves the branch during a failed read-tree. The rollback does not clobber it; the writer's commit survives and the archive is kept ✅ pass live tests/fm-pr-resync.test.sh 'a concurrent writer after advance survives the failed index update'
fm-pr-resync.sh --refuse-diverged called directly: a diverged branch exits 1 with the branch, HEAD and archive refs untouched; a behind branch still advances ✅ pass live tests/fm-pr-resync.test.sh behind-refuse-flag and diverged-refuse-flag cases
Evidence: fm-pr-resync suite transcript

Source: fm-pr-resync suite transcript

ok - diverged stale local branch is archived and advanced to the pipeline-rebased published head
ok - behind branch advances without an archive
ok - the divergence refusal flag still allows a behind branch to advance
ok - the divergence refusal flag leaves a diverged branch and worktree untouched
ok - equal branch changes nothing, even with an untracked file
ok - ahead branch changes nothing and reports ahead:1
ok - a dirty tree refuses when the branch must move
status: waiting for both good and bad commits
ok - an in-progress operation refuses
ok - a branch checked out in another worktree refuses
ok - a worktree on a different named branch refuses
ok - a branch missing on origin refuses
ok - a fetched head that differs from the advertised head refuses
ok - an archive name held by another commit refuses before any move
ok - an archive already at the stale head is reused
ok - a remote move after the advance refuses with the archive and verified head reported
ok - a concurrent local commit refuses the old-OID-conditional advance
ok - a concurrent local commit after the conditional advance is preserved and reported
ok - an index update failure restores the branch and reports the retained archive
ok - a concurrent writer after advance survives the failed index update
ok - a detached HEAD capture failure refuses without switching or losing its commit
ok - a detached unpublished commit refuses without switching HEAD
ok - a copy detached at an origin/main newer than the published head's base continues the branch
ok - a copy detached at a moved origin/main switches to and archive-advances its stale branch
ok - an unanchored detached commit on top of a moved origin/main still refuses
ok - Git network timeout refuses safely at normal operation 1
ok - Git network timeout refuses safely at normal operation 2
ok - Git network timeout refuses safely at normal operation 3
ok - Git network timeout refuses safely at normal operation 4
ok - Git network timeout refuses safely at check operation 1
ok - Git network timeout refuses safely at check operation 2
ok - Git network timeout refuses safely at check operation 3
ok - a remote move before the advance refuses with nothing moved
ok - custody active at preflight exits 3 with nothing changed
ok - blocked_diverged custody settles after archive and advance
ok - recover_custody runs its fixed command and re-checks to settled
ok - adopt_published runs its fixed command and re-checks to settled
ok - a recovery whose fresh re-check is not settled refuses
ok - a preserved pipeline-head fetch timeout refuses before binding or recovering
ok - terminal-run manual reconciliation archives, binds and recovers only under verified proof
ok - keep-local recovery without a verified own-archive proof refuses (unverified)
ok - keep-local recovery without a verified own-archive proof refuses (foreign)
ok - keep-local recovery without a verified own-archive proof refuses (preserved)
ok - keep-local recovery without a verified own-archive proof refuses (required)
ok - an unhandled native verdict refuses with its output
ok - a native verdict outside the handled set refuses before any change
ok - a native verdict outside the handled set just before the move refuses with nothing moved
ok - unreadable custody refuses before any change
ok - --check reports the planned action and changes nothing
ok - --check refuses when origin moves to an already-present commit around its fetch (after read 1)
ok - --check refuses when origin moves to an already-present commit around its fetch (after read 2)
ok - custody taken between preflight and move is caught before any ref moves
ok - custody taken after the pre-move check is reported with the archive and advance
ok - a detached worktree without a local branch reports the created branch on exit 3
ok - a detached worktree switched to its existing branch reports the switch on exit 3
ok - an unsettled verdict after a detached switch refuses and reports the switch
ok - an invalid timeout cannot disable the Git network bound
ok - a relative worktree is a usage error
Evidence: fm-control-relaunch suite transcript

Source: fm-control-relaunch suite transcript

ok - fm-spawn --relaunch: tracked opencode wiring is retired as on main
ok - fm-control removes the dialog file after exit and after relaunch
ok - fm-control exit removes the dialog file before it releases the control lock
ok - fm-control relaunch: a same-harness relaunch replaces the agent in the same endpoint and worktree
ok - fm-control relaunch: pending composer text refuses before the exit command is typed
ok - fm-control relaunch: an unreadable composer fails safe before the exit command is typed
ok - fm-control relaunch: a linked spawning home preserves committed and unfinished work in the recorded copy
ok - fm-control relaunch: durable task metadata survives replacement launch publication
ok - fm-control relaunch: delivery and concurrent task metadata publication serialize
ok - fm-control relaunch: disabling tracing clears metadata and pane context
ok - fm-control relaunch: progress and the Firstmate-worktree worker identity reach the replacement
ok - fm-control relaunch: the progress note's inbox listing is silent on an empty inbox
ok - fm-control relaunch: a ship task refuses without the progress note its replacement needs
ok - fm-control relaunch: switching harness is one ordinary relaunch, and the old wiring goes with the old agent
ok - fm-control relaunch: a refused relaunch onto polytoken keeps the project's own hook layer and the running agent
ok - fm-control relaunch: a refused polytoken profile leaves the running agent untouched
ok - fm-spawn --relaunch: retiring a raw polytoken launch's wiring keeps the project's own layers
ok - fm-control relaunch: a harness switch resets model and effort unless they are named too
ok - fm-control relaunch: a prefixed recorded harness can switch adapters transactionally
ok - fm-control relaunch: a prefixed command requires an explicit replacement harness
ok - fm-control relaunch: a same-harness relaunch keeps the profile axes it was running with
ok - native Ultra relaunch preserves its profile and rejects an unsupported model before stopping
ok - codex max relaunch rejects a model the catalog does not advertise max for before stopping
ok - fm-control relaunch: a signed-out worker account pin refuses before the old agent stops
ok - fm-control relaunch: the replacement follows the home's current worker account pin
ok - fm-control relaunch: mate pins are re-read for Claude and Pi, and unusable pins refuse before stopping the agent
ok - fm-control relaunch: a Pi replacement keeps the home's tool exclusions
ok - fm-control relaunch: exclusion-list refusals happen before the running agent stops
ok - fm-control relaunch: explicit model and effort win over the recorded ones
ok - fm-control relaunch: refuses to relaunch onto an adapter with no verified mechanics
ok - fm-control relaunch: the retired incarnation's global turn-end token is revoked
ok - fm-control relaunch: wiring cleanup failure refuses replacement arming
ok - fm-control-lib: one owner resolves each harness's turn-end registry entry, and refuses a malformed token
ok - fm-control relaunch: a secondmate relaunch re-resolves its durable configured harness pin
ok - fm-control relaunch: a claude secondmate keeps settings.local.json and retires the state settings file and the Stop pointer
ok - fm-control relaunch: a mate with a per-mate override line lands on that override, not the default pin
ok - fm-control relaunch: a mate with no override line still resolves the default pin
ok - fm-control relaunch: a legacy secondmate pin file still relaunches the mate onto its first line
ok - fm-control relaunch: an unparseable secondmate pin refuses before anything is stopped
ok - fm-control relaunch: invalid configured effort is ignored before stop
ok - fm-control relaunch: an adapter unverified for this task kind refuses before the agent is stopped
ok - fm-control relaunch: explicit secondmate harness resets unnamed profile axes
ok - fm-control relaunch: a ship task keeps its recorded harness instead of re-reading crew config
ok - fm-spawn --relaunch: with no explicit harness it reuses the task's recorded one, never the crew default
ok - fm-spawn --relaunch: a promoted scout with a recorded custom branch relaunches on it instead of being refused
ok - fm-spawn --relaunch: no-mistakes divergence refuses, behind advances, and explicit worker-owned modes skip resync despite a no-mistakes remote
ok - fm-spawn --relaunch: under an active run the replacement launches with the owner's monitoring-only contract
ok - relaunch refuses a bounded origin pre-probe timeout before launching or changing refs
ok - fm-spawn --relaunch: a successor relaunches without --from-branch despite its brief's Source branch line
ok - fm-promote/fm-spawn --relaunch: the current ship contract supersedes stale scout delivery text
ok - fm-spawn --relaunch: wiring armed under a prefixed harness name is still retired
ok - fm-spawn --relaunch: switching away from muse retires its session binding
ok - fm-spawn --relaunch: switching away from cursor retires its session binding
ok - fm-control relaunch: an unaccountable local copy refuses before the agent is touched
ok - fm-control relaunch: a worker with nothing to work from is never launched
ok - fm-control relaunch: a refusal before the agent is stopped leaves the durable record untouched
ok - fm-control relaunch: checkpoint inspection failures refuse before stopping
ok - fm-control relaunch: a launch failure after the stop keeps the prior record and reports the real state
ok - fm-control relaunch: unpublished rollback keeps concurrent durable metadata
ok - fm-control relaunch: post-publication failure keeps the new durable record
ok - fm-control relaunch: partial stop reconciles actual agent state
ok - fm-control relaunch: failed journal replacement preserves durable phase
ok - fm-spawn relaunch: prepublication abort removes replacement state
ok - fm-control relaunch: the checkpoint records the exact unlanded work it preserved
ok - fm-control relaunch: a secondmate's child work is accounted for and its charter is left alone
ok - fm-control relaunch: a secondmate home that is not this secondmate's is refused
ok - fm-control relaunch: unreadable child records fail checkpoint
ok - fm-control relaunch: unlistable state fails checkpoint
ok - fm-control relaunch: a vanished watcher scratch file does not fail the child-record checkpoint
ok - fm-control relaunch: two control actions on one task serialize instead of interleaving
ok - fm-spawn relaunch: direct entry participates in lifecycle serialization
ok - fm-promote: promotion participates in lifecycle serialization
ok - fm-spawn --relaunch: refuses to launch a second agent into a live endpoint
ok - fm-spawn --relaunch: symlinked records refuse before inspection
ok - fm-spawn --relaunch: keeps its early meta lock continuous
ok - fm-spawn --relaunch: pending closes refuse before replacement begins
ok - fm-spawn --relaunch: every identity axis comes from the record, and a contradicting flag refuses
ok - fm-spawn --relaunch: an unrecorded task is refused
ok - fm-spawn --relaunch: refuses to start a replacement outside the copy holding its work
ok - tmux: a window absent from its session refuses both verbs rather than being assumed gone
ok - tmux: an unfindable session refuses both verbs, so a live agent is never duplicated
ok - tmux: a dead server on this socket refuses both verbs rather than proving absence
ok - tmux: a recorded server proven gone is reclaimed on that server; another server's seat is refused
ok - reclaim: an unclassifiable endpoint is still refused, so two agents cannot share one
ok - fm-spawn --relaunch: resumes the bound Pi session only for a Pi registration
ok - reclaim: a herdr pane that outlived its stopped server is adopted, never orphaned beside a new tab
ok - fm-control exit: a herdr pane that outlived its stopped server is already-stopped, not gone
ok - fm-control exit: post-command Herdr absence proof confirms only gone or idle endpoints
ok - reclaim: a herdr rebind is created in the session the record names, never the ambient one
ok - reclaim: a herdr agent that came back with its server refuses, so one worktree keeps one agent
ok - reclaim: a herdr reclaim rebinds the endpoint and leaves the whole rest of the task alone
ok - reclaim: a herdr secondmate whose endpoint is gone is sent to its own respawn owner
ok - reclaim: a rebind refused from a plain shell reports the real cause, not a fabricated session mismatch
ok - relaunch re-reads the backlog item instead of blindly re-running the transition
ok - relaunch heals an item that drifted out of In flight while the task stayed live
ok - away supervision relaunches existing In-flight and queued items under the saturated fresh-spawn spend cap
Evidence: fm-spawn-pool-base-freshen suite transcript

Source: fm-spawn-pool-base-freshen suite transcript

ok - a remote-seeded secondmate home allocates and launches from its Treehouse pool
ok - a Treehouse slot claim names the launched task, refuses when unclaimable, and is dropped by a locked abort
ok - a launch refused after its slot claim leaves the pool for a retry and a second task
ok - a refused polytoken launch leaves its per-id paths alone while another spawn holds the per-id lock
ok - a non-polytoken launch refused after its slot claim keeps main's abort behavior
ok - the treehouse-get isolation refusal points only at what survives the abort
ok - linked spawning home: primary preserves the primary before any refresh
ok - linked spawning home: primary-alias preserves the primary before any refresh
ok - linked spawning home: spawning preserves the primary before any refresh
ok - linked spawning home: scout preserves the primary before any refresh
ok - a stale pooled worktree refreshes to current origin/main before a crew branch is created
ok - --base-branch picks the copy's starting point and is recorded; a missing or local-only base refuses
ok - a spawn refuses when --base-branch and the brief's Base branch lines disagree
ok - a Base branch line in the captain's intent neither blocks nor redirects a spawn
ok - a based scout on a forge=gerrit project is refused at spawn
ok - a stale pooled worktree resolves and refreshes a non-main default branch
ok - direct-PR ships and scouts both refresh stale pooled worktrees before launch
ok - a dirty pooled worktree is refused without discarding its local work
ok - an unresolved remote default branch refuses the pooled worktree
ok - an unreachable origin refuses a potentially stale pooled worktree
ok - an origin-less pooled worktree launches as-is, skipping the freshness gate
ok - a dirty origin-less pooled worktree is refused without discarding its local work
ok - an origin configuration without a URL refuses the pooled worktree
ok - an empty origin configuration section refuses the pooled worktree
ok - an empty-only included origin section documents the accepted detection boundary
ok - an inactive conditional origin include leaves the pooled worktree origin-less
ok - an origin-less pool with a stale submodule pin refuses while naming both pins and no remedy
ok - an unpushed submodule commit keeps the uncommitted-work refusal and survives it
ok - work inside a submodule is still refused as uncommitted work, not called stale
ok - a stale pin carrying real work is refused conservatively, never called stale
ok - a stale pin beside other dirt yields the conservative refusal alone, with no stale-pin line
ok - --pr-branch archives the stale local branch and launches on origin's published head
ok - a continuation scaffold with an explicit target passes the public spawn agreement
ok - fresh continuation refuses owner exit 3 with no launch, metadata or branch/archive change
ok - an owner exit 1 after switching leaves the pool copy detached and intact
ok - a dirty copy or a contradicting flag refuses a continuation with the branch and records untouched
ok - --from-branch starts from origin's source, records no base, and must agree with the brief
# all fm-spawn-pool-base-freshen tests passed
Evidence: Red counterfactual transcript (CF1, CF2, CF4 red; CF3 edit did not apply)

Source: Red counterfactual transcript (CF1, CF2, CF4 red; CF3 edit did not apply)

== CF1: precedence guard removed (explicit mode falls through to remote probe)
 bin/fm-spawn.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ok - fm-control relaunch: an unreadable composer fails safe before the exit command is typed
ok - fm-control relaunch: wiring cleanup failure refuses replacement arming
not ok - direct-PR worker-owned branch did not relaunch
exit=
== CF2: --refuse-diverged not passed on relaunch
 bin/fm-spawn.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ok - fm-control relaunch: an unreadable composer fails safe before the exit command is typed
ok - fm-control relaunch: wiring cleanup failure refuses replacement arming
not ok - a diverged relaunch was not refused
exit=
== CF3: pool detach restore removed
exit=
== CF4: read-tree move-back removed
 bin/fm-pr-resync.sh | 4 ----
 1 file changed, 4 deletions(-)
not ok - index update refused: branch moved back (expected '25c8779b9949d36687f57b54d2759062809d1fe9', got '0faa42beacce4835c02df358c52220097f1ba0a8')
exit=
Evidence: Key scenario results
ok - the divergence refusal flag still allows a behind branch to advance
ok - the divergence refusal flag leaves a diverged branch and worktree untouched
ok - an index update failure restores the branch and reports the retained archive
ok - a concurrent writer after advance survives the failed index update
ok - fresh continuation refuses owner exit 3 with no launch, metadata or branch/archive change
ok - an owner exit 1 after switching leaves the pool copy detached and intact
ok - fm-spawn --relaunch: no-mistakes divergence refuses, behind advances, and explicit worker-owned modes skip resync despite a no-mistakes remote
CF1 (precedence guard removed): not ok - direct-PR worker-owned branch did not relaunch
CF2 (--refuse-diverged dropped): not ok - a diverged relaunch was not refused
CF4 (read-tree move-back removed): not ok - index update refused: branch moved back

Pipeline

Updates from git push no-mistakes

Evidence for this closeout

agent-kit verify gate not recorded: no runner-attested verifier on this host (known boundary); host-unattested verifier receipt attached.

This PR supersedes the predecessor branch for the same work (published at d926f79b) and adds the three required fixes from its independent review, plus the explicit-mode precedence fix this pipeline's review requested.

What changed in this closeout

  • Ship relaunch resyncs the recorded branch only for no-mistakes delivery, or for legacy task records with no recorded mode in a repository with a no-mistakes remote. An explicit direct-PR or local-only relaunch never resyncs, so unpushed local work stays in place.
  • A relaunch resync passes --refuse-diverged: a diverged branch is refused and left as-is, with no archive and no ref move. A behind branch still advances, and an active run still relaunches monitoring-only.
  • A refused --pr-branch spawn returns a pool copy it found detached to detached at its current HEAD, without removing files or branches.
  • If the index/worktree update fails after the conditional advance, bin/fm-pr-resync.sh moves the branch back only while it still holds the published head, keeps the archive, and reports the actual position.

Real-tool suite runs

Run with the real /bin/ps and a PATH without mise activation, at d926f79b plus the candidate diff (sha256 75301ea6…, committed unchanged as b9228328):

Command Exit Result
bash tests/fm-pr-resync.test.sh 0 57 passed
bash tests/fm-spawn-pool-base-freshen.test.sh 0 37 passed
bash tests/fm-spawn-orca-worktree.test.sh 0 36 passed
bash tests/fm-control-relaunch.test.sh 0 96 passed
bin/fm-lint.sh 0 ShellCheck 0.11.0 and actionlint 1.7.12 pinned
bin/fm-doc-audience-check.sh 0 134 surfaces, 955 local links

The pipeline's own test step then ran at the final head af81c3d9.

Red counterfactuals

Each guard was removed alone in a clone with full history, and the suite failed on that guard's own regression after earlier tests passed:

Guard removed Failing assertion
explicit-mode precedence (at af81c3d9) direct-PR worker-owned branch did not relaunch (45 earlier passes)
mode gate (at b9228328) direct-PR worker-owned branch did not relaunch (45 earlier passes)
diverged refusal diverged with refusal flag: exit: expected exit 1, got 0
pool-copy detach restore active continuation left the pool copy on a named branch (33 earlier passes)
read-tree rollback index update refused: branch moved back

One earlier attempt at two of these controls used copies without Git history, and failed on unrelated fixtures; it is not relied on.

Host-unattested independent verifier receipt

A separate read-only model context reviewed only these three fixes, the suite receipts and the red controls at d926f79b plus diff sha256 75301ea6…, ran no suites, and returned PASS. It records isolation: host-unattested. It is not an agent-kit verify gate. Coverage limit it named: a read-tree that fails after a partial index or worktree update is not separately exercised; the branch and archive are protected, and the files would still need inspection.

agent-kit lifecycle record

A task-bound agent-kit 0.1.73 run was opened from an approved ticket for these three fixes. Its check --evidence still refuses: the build-checks, verify, review-full and review-readiness gates have no recorded evidence, and acceptance criteria AC-1 to AC-3 are uncovered. No gate was recorded, because none has a genuine agent-kit judgment at this head yet. The verify gap is the known runner-attestation boundary; the build-checks and two review gaps are separate missing judgments, not part of that boundary. This pipeline's review is a no-mistakes review and is not relabelled as an agent-kit review.

Verification scope at the final head

The verifier receipt and suite table above cover b9228328. The final head af81c3d9 adds the pipeline's explicit-mode precedence and documentation fix; its evidence is the pipeline's own test step and the precedence red control above, not the earlier verifier receipt.

Predecessor history (unchanged, not re-verified here)

  • The predecessor's verify receipt was host-unattested with no native verify gate; it is not reused as proof for this head.
  • In the predecessor's final review, the project-standards and maintainability seats were unavailable, and the last ten changed files had no separate re-review.
  • The predecessor's CI Lint 2 job timed out once and passed on a single targeted retry.
✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ⚠️ bin/fm-spawn.sh:3903 - An explicit direct-PR or local-only relaunch still runs the resync whenever the repo has a no-mistakes remote. relaunch_pr_resync only skips the resync for a non-no-mistakes MODE when git remote get-url no-mistakes fails. The worktree shares remotes with the project, so a task recorded as mode=direct-PR in a repo that has a no-mistakes remote still runs the resync. One example is a direct-PR task in a no-mistakes-prod-only project; fm-spawn.sh:4150 allows that mode. In that repo the worker owns the branch. Concrete sequence: the worker amends or rebases the branch locally without pushing, then gets relaunched. axi sync --check reports no push binding (blocked_wrong_branch, no run), which settled() counts as settled. The branch classifies as diverged, and --refuse-diverged refuses at bin/fm-pr-resync.sh:287. The worker's work is no longer archived, which was the old blocker. But the relaunch is now refused outright for a branch the worker legitimately owns. PR49's promise was to continue from the branch's current state, and that still fails for these tasks. The direct-PR/local-only negative control (tests/fm-control-relaunch.test.sh, the rl96 loop) never adds a no-mistakes remote, so this path is untested. The intent says "(or a verified no-mistakes remote)", but the code only checks that a remote with that name exists. Decision needed: should the remote fallback apply only when no mode is recorded (MODE empty, legacy metadata), so that an explicit direct-PR/local-only always skips? Or is a bare remote name meant to count as "verified"? If the narrower rule is chosen, the fix is case &#34;$MODE&#34; in direct-PR|local-only) return 0 ;; esac before the remote probe, plus a negative-control case that has a no-mistakes remote.
  • ⚠️ docs/agent-control.md:92 - The relaunch documentation still says every ship relaunch with an origin branch resyncs to the published head: "A ship relaunch whose recorded branch exists on origin first resyncs that worktree to the published head through bin/fm-pr-resync.sh." After this change, the resync only runs for no-mistakes delivery or when a no-mistakes remote exists. A diverged branch is now refused and left as-is rather than resynced (bin/fm-spawn.sh:69-72 and 3903-3913). An operator reading this doc would expect a direct-PR relaunch to be moved to origin's head, and a diverged no-mistakes relaunch to be archive-advanced; neither happens now. The same staleness is at docs/architecture.md:405, which describes the owner as "archiving stale local history" for the callers it lists, including ship relaunch. Relaunch no longer archives. Fix: reword both to match the fm-spawn.sh header (no-mistakes-gated; divergence refused and left as-is).
  • ℹ️ bin/fm-spawn.sh:3919 - The diverged-relaunch refusal does not name the recovery step. Now that a no-mistakes relaunch refuses a branch the pipeline rebased (rel=diverged), the operator only sees "branch ... diverged from the published head; the branch was left as-is". The message does not say that running bin/fm-pr-resync.sh &lt;id&gt; &lt;wt&gt; &lt;branch&gt; without --refuse-diverged is the supported way to archive-advance before relaunching. The refusal itself is what the intent requires; this only notes that the message gives no next step.

🔧 Fix applied.
1 info still open:

  • ℹ️ bin/fm-spawn.sh:3919 - The diverged-relaunch refusal does not name the recovery step. Now that a no-mistakes relaunch refuses a branch the pipeline rebased (rel=diverged), the operator only sees "branch ... diverged from the published head; the branch was left as-is". The message does not say that running bin/fm-pr-resync.sh &lt;id&gt; &lt;wt&gt; &lt;branch&gt; without --refuse-diverged is the supported way to archive-advance before relaunching. The refusal itself is what the intent requires; this only notes that the message gives no next step.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 9 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Direct-PR relaunch in a repo with a no-mistakes remote, on a branch amended locally and not pushed: it launches without calling the resync owner, and HEAD stays at the amended commit with no archive ✅ pass live tests/fm-control-relaunch.test.sh case rl96-direct-PR; CF1 counterfactual went red
Local-only relaunch in a repo with a no-mistakes remote, on a branch amended locally and not pushed: it launches without calling the resync owner, and HEAD stays at the amended commit with no archive ✅ pass live tests/fm-control-relaunch.test.sh case rl96-local-only
No-mistakes relaunch where the pipeline rebased and republished the branch (diverged): the relaunch is refused, the branch is left as-is, nothing is archived and nothing launches ✅ pass live tests/fm-control-relaunch.test.sh case rl90; CF2 counterfactual went red
Legacy relaunch with no recorded mode in a repo with a no-mistakes remote: the resync owner still runs and refuses the diverged branch without moving it ✅ pass live tests/fm-control-relaunch.test.sh case rl97
No-mistakes relaunch where the branch is only behind origin: it advances to the published head and launches ✅ pass live tests/fm-control-relaunch.test.sh case rl95
Fresh --pr-branch spawn where the resync owner refuses (exit 1 or 3) after switching the pool copy: POOL_DIR is detached again at its original HEAD with its files intact, project refs are unchanged, a… ✅ pass live tests/fm-spawn-pool-base-freshen.test.sh: test_pr_branch_unsettled_custody_restores_detached_pool and test_pr_branch_active_custody_refuses_without_launch
fm-pr-resync.sh where read-tree fails after the conditional advance: the branch and HEAD move back to the old local head, the index and worktree stay clean, and the archive is kept ✅ pass live tests/fm-pr-resync.test.sh 'an index update failure restores the branch and reports the retained archive'; CF4 counterfactual went red
Adversarial: a concurrent writer moves the branch during a failed read-tree. The rollback does not clobber it; the writer's commit survives and the archive is kept ✅ pass live tests/fm-pr-resync.test.sh 'a concurrent writer after advance survives the failed index update'
fm-pr-resync.sh --refuse-diverged called directly: a diverged branch exits 1 with the branch, HEAD and archive refs untouched; a behind branch still advances ✅ pass live tests/fm-pr-resync.test.sh behind-refuse-flag and diverged-refuse-flag cases
  • bash tests/fm-pr-resync.test.sh (exit 0): --refuse-diverged on behind and diverged branches, read-tree failure with move-back (index.lock held), concurrent writer surviving a failed index update
  • bash tests/fm-control-relaunch.test.sh (exit 0): real bin/fm-spawn.sh --relaunch on cases rl90 (diverged no-mistakes), rl95 (behind), rl96-direct-PR and rl96-local-only (no-mistakes remote plus an amended unpushed commit), rl97 (legacy, no mode)
  • bash tests/fm-spawn-pool-base-freshen.test.sh (exit 0): fresh --pr-branch spawn where the resync owner exits 1 or 3; asserts POOL_DIR is detached at STALE_SHA with its files intact
  • Counterfactual CF1: replaced the explicit-mode precedence guard with the remote-probe fallback; red with not ok - direct-PR worker-owned branch did not relaunch; file restored
  • Counterfactual CF2: dropped --refuse-diverged from relaunch_pr_resync; red with not ok - a diverged relaunch was not refused; file restored
  • Counterfactual CF4: removed the read-tree move-back in fm-pr-resync.sh; red with not ok - index update refused: branch moved back; file restored
  • Counterfactual CF3 (pool detach restore removed) did not apply: the perl edit matched nothing, so the suite ran against unchanged source and proved nothing
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

bin/fm-pr-resync.sh verifies a branch's published head on origin, archives
stale non-contained local history under archive/<task>-pre-rebase-<sha8>,
advances with reset --keep on a clean tree, and settles no-mistakes branch
custody only through native-offered actions with refusals and no force.
tests/fm-pr-resync.test.sh reproduces a pipeline-rebased published head
against a stale local branch with a real bare remote.
…--check ref-free

The resync owner now refuses a native no-mistakes verdict outside its handled
set at the preflight and pre-move reads, before any archive or advance, and
--check fetches objects only so no remote-tracking ref or FETCH_HEAD changes.
--check now reads origin's advertised head before and after its ref-free
fetch and refuses when they differ, so a move to an already-present commit
cannot pass the fetched/advertised check; the redundant unreadable-custody
branch is folded into the handled-verdict refusal.
fm-brief and fm-spawn gain --pr-branch for continuing an existing
published branch: the brief ships that exact branch, and the spawn runs
bin/fm-pr-resync.sh on the pooled copy instead of the hard-reset base
refresh, refusing unless it settles. --from-branch starts a ship or scout
from origin's source branch while the pull request keeps its default
target. A ship relaunch whose recorded branch is on origin runs the owner
in the recorded worktree first and embeds its monitoring-only contract
when a run is active; fm-promote --pr-branch runs the owner before the
task record changes.
…nuation's ship line

A successor launched with --from-branch keeps its brief's Source branch
line, so checking it on relaunch refused every relaunch of that task.
The agreement now binds only the launch that selects the start. A
--pr-branch launch also no longer inherits the legacy default-branch
warning: its brief must carry the matching Ship branch line.
The no-mistakes driving block now names bin/fm-pr-resync.sh with the task and
branch for a branch diverged from or rewritten against the pipeline's
published head, and validation-supervision names it for supervisors, so
neither teaches a hand-run archive/reset/sync sequence.
… test

The validation-supervision check grepped skill source, which the coding
guidelines forbid; the rendered DoD assertions stay.
The no-mistakes driving block now names each brief's task and branch in the
resync owner command, so the gerrit/default forge comparison maps that line
the same way it already maps the arm command.
The advance is now conditional on the branch tip captured at classification,
so a concurrent local commit makes the owner refuse instead of resetting it
away, and a detached HEAD holding commits absent from the branch and the
published head refuses before any switch. Every Git network call, including
the relaunch pre-probe, runs under the existing bounded runner and refuses on
timeout while reporting earlier changes.

A PR continuation brief keeps its Base branch line so spawn accepts
--pr-branch with --base-branch, and a fresh Orca copy is detached before the
continuation resync while its initial branch stays.

Tests cover mismatched keep-local identities, the monitoring-only contract's
permissions and release condition, and active-custody refusal at fresh
continuation and promotion.
…ch custody

- Relaunch resyncs the recorded branch only for no-mistakes work or a copy with
  a no-mistakes remote, and passes --refuse-diverged so diverged history is
  refused without an archive or ref move; direct-PR and local-only branches
  stay worker-owned.
- A refused --pr-branch spawn returns a pool copy it found detached to detached
  at its current HEAD, without discarding files or branches.
- When the index/worktree update fails after the conditional advance,
  fm-pr-resync.sh moves the branch back only while it still holds the
  published head, keeps the archive and reports the actual position.
Pibomeister added a commit that referenced this pull request Oct 30, 2026
… local checks pass on the final code. The five changed files are uncommitted in the worktree; I did not commit or push them. This replaces my earlier result, which reported the final lint run as unknown. Changes: - `bin/fm-lint.sh`: `--partition` accepts KofN for N >= 1 and 1 <= K <= N. It refuses 0ofN, K>N, N<1, leading zeros, malformed values and integers past the shell range, with exit 2. Packing uses N bins with the same greedy least-loaded rule, and ties go to the lowest bin. Error and help text are updated. - `tests/fm-lint.test.sh`: the 1of3 refusal is replaced with runs of 1of3, 2of3 and 3of3. It also checks that the N parts cover every canonical root exactly once for N=2 and N=3, and adds more refusal cases. - `.github/workflows/ci.yml`: lint matrix is `[1, 2, 3]`; timeout-minutes stays 30. - `CONTRIBUTING.md`: adds the `Lint 3` context. - `docs/fm-test-portable-shards.md`: now says three lint partitions and twenty-one jobs. One addition goes beyond the literal scope. A partition with no roots (K above the root count, such as 9999of10000) crashed on an unbound `ROOTS`. Accepting any N makes that input reachable, so I fixed it: it now prints a note, runs the non-ShellCheck checks and exits by their result. The test file covers this case. Evidence on the final code: - `/bin/bash tests/fm-lint.test.sh`: rc 0, 50 ok, no `not ok`. - `/bin/bash tests/fm-ci-workflow.test.sh`: rc 0. - `bin/fm-lint.sh`: rc 0, in changed-file mode, so this is not a full canonical lint. - Assignment for 1of2 and 2of2: identical to the old two-bin formula, compared over the same current weights. This was a local check and is not a committed test. The edit changed byte weights, so the lists can differ from those taken before the edit. - Split at 3 bins: 195, 195 and 196 roots. Not verified: - CI on the new head, so whether three partitions finish under 30m is unproven. - The `Full suite` log. Its failure is attributed to the cancelled `Lint 2` from timing only. Decisions for you: - If a branch ruleset on the fork lists `Lint 1` and `Lint 2`, add `Lint 3`, or the new job is not enforced. I did not inspect the ruleset. - PR #50 has the same Lint 2 timeout and gets this fix only after it picks up this change
cursoragent and others added 2 commits November 2, 2026 23:12
Keep main's fm_nm_driving_block signature (<forge|no-ci> <task-id>)
and freshen_spawn_worktree_base plus the t3code skip. Fold #50's
--pr-branch/--from-branch resync around them so freshening the base
does not clobber a published PR head, and keep main's disk-alarm,
pr=manual, Rex, and primary-checkout base behavior.

Co-authored-by: Eduardo Picazo <[email protected]>
Bring in #122, #124, #123, and #121. No textual conflicts; keep the
published-head resync owner on main's driving-block signature,
freshen_spawn_worktree_base, and t3code skip.

Co-authored-by: Eduardo Picazo <[email protected]>
@Pibomeister

Copy link
Copy Markdown
Owner Author

AgentKit super-review

  • PR: feat(bin): continue published PR branches through a guarded resync owner #50, fm/fm-pr-published-head-resync-2
  • Reviewed head: d5c88a07638caf2c98550bd09a8d87f26c34cfb0 (checked with gh pr view)
  • Comparison base: main f2cdff19e0ed91c577f1629018ce09d631262ae5
  • Mode: full (pass 1). Catalog: agent-kit origin/main skills/super-review + roles/code-review/*
  • Snapshot: git diff origin/main...d5c88a07 (16 files, +1821/−28)

Seats

Seat Why it was seated State
correctness always on covered: no findings
project-standards repo declares AGENTS.md/CLAUDE.md covered: no rule violations cited
testing the change alters behavior covered: 1 info note
reliability timeouts, bounded network calls, refuse/rollback paths covered: no findings
maintainability new structure: a new owner script and cross-file wiring covered: 1 non-blocking finding
adversarial over the size guidance; ref moves on a published branch covered: no findings
security, api-contract, data-migration, performance, frontend-races, swift-ios, learnings no signal for them skipped
previous-comments the PR has no review comments skipped

Verdict: APPROVE (no blocking findings)

Findings

  1. maintainability · non-blocking bin/fm-dod-lib.sh:449 (printf -v branch_q '%q' "${branch:-}")
    • fm_nm_driving_block reads the branch from its caller's dynamically scoped branch local. Both current callers (fm_dod_block and fm_dod_manual_pr_block) set it.
    • If a future caller doesn't, the emitted resync command at line 476 ends in ''. fm-pr-resync.sh would then exit 2 (usage), so the guidance would fail quietly rather than unsafely.
    • Fix: pass the branch as an explicit third argument, or leave out the resync sentence when branch is empty.
  2. testing · info
    • At the head, these passed: tests/fm-pr-resync, fm-spawn-pool-base-freshen, fm-dod-lib, fm-brief, fm-spawn-orca-worktree and fm-task-delivery. In fm-control-relaunch, the new resync and monitoring-only relaunch cases pass.
    • One case fails: "exit must succeed once the recorded tmux server is proven gone". It fails the same way on main f2cdff1, so the PR didn't cause it. It looks tied to this environment.

Correctness and adversarial checks (no findings)

  • fm-pr-resync.sh never forces a ref. Every advance is an old-OID-conditional update-ref.
  • Before a diverged branch moves, it is archived, and an archive name held by another commit refuses.
  • The advertised head is re-read before and after the move.
  • A failed read-tree rolls the branch back on the same condition.
  • --check uses --no-write-fetch-head --refmap=, so it changes no refs.
  • continue_active_run exits 3 at all three custody checkpoints.
  • --keep-local runs only after the archive and required head are proven.
  • The relaunch path uses --refuse-diverged, and an ls-remote exit 2 (branch absent) skips the resync.
  • --pr-branch/--from-branch exclusivity is enforced the same way in brief, spawn and promote.
  • --from-branch feeds freshen_spawn_worktree_base without changing the recorded base.
  • On the t3code path, the lease handling is unchanged for non-continuation launches.

Protocol steps that couldn't run here

  • There was no ak CLI or runner, so no ak firstmate grant/ak-gate start, no snapshot hash, and no schema-validated run artifacts were produced.
  • No independent model seats were available. One fresh reviewer, who didn't write the change, applied each seat's role lens in turn. Seat isolation is therefore weaker than the protocol intends.
  • Independent closure verification of findings was not done (finding 1 is open and non-blocking).

@Pibomeister
Pibomeister merged commit 9ac50cd into main Nov 3, 2026
26 of 27 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.

2 participants