Repository navigation
feat(bin): continue published PR branches through a guarded resync owner - #49
Closed
Pibomeister wants to merge 12 commits into
Closed
Pibomeister wants to merge 12 commits into
Pibomeister wants to merge 12 commits into
Conversation
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.
…t detached switches
Owner
Author
|
Closing as superseded by #50, which contains all of this PR's commits plus the review fixes. Per the captain's decision (GS-003-firstmate). |
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.
What Changed
bin/fm-pr-resync.sh, a single owner for continuing a branch whose PR head the no-mistakes pipeline may have rebased and republished. It checks the published head on origin and compares the local branch against it. Then it either leaves the branch alone (equalorahead:N) or moves it forward with an old-OID-conditional ref update. A diverged local branch is first saved underrefs/heads/archive/<task>-pre-rebase-<sha8>. A detached worktree is switched onto the branch first, and the switch is reported as a change. Before anything moves it reads custody withno-mistakes axi sync --check, and it only takes the native recover, adopt or bind-archive actions. Exit 3 means a run is still active and prints monitoring-only lines. A--checkmode plans the action without changing any ref. It never force-pushes, force-moves or deletes a ref.--pr-branch <branch>tofm-spawn.sh,fm-brief.shandfm-promote.shfor continuing an existing published branch. Spawn runs the resync owner instead of the base refresh, and promote runs it before the task record changes. The brief tells the worker it is already on the branch, so it does not create one. Also adds--from-branch <branch>so a ship or scout can start from origin's<branch>while its PR still targets the default or--base-branch. On a fresh launch, spawn checks it against the brief'sSource branch:line. A ship relaunch whose recorded branch exists on origin runs the resync first. A fresh clean Orca copy is detached before the continuation resync.fm-dod-lib.shand the validation-supervision skill now sends a branch that is stale or diverged against the published head tofm-pr-resync.shinstead of hand-run archive, reset or sync steps.fm_brief_base_branchesalso recognises the new PR-continuation Setup sentence. The docs cover the new flags and the relaunch resync, and there is a newtests/fm-pr-resync.test.shplus additions to the brief, DoD, spawn, relaunch and delivery tests.Risk Assessment
🚨 High: The new resync owner wrongly refuses continuation spawns and promotions from copies detached at a current origin/main once main moves (reproduced), so the required stale-branch recovery still needs hand-run steps in the most common case.
Testing
I ran the resync owner, promotion and brief generation live against throwaway git origins in which a pipeline rebase and lease-publish left a stale local branch, inside a marked lab home that was removed afterwards. All live scenarios passed and the transcripts are saved as evidence. The seven focused test files for the changed scripts also passed; they cover fm-spawn, relaunch, Orca and pool copies, plus custody verdicts from a no-mistakes stand-in. Those spawn/relaunch and custody scenarios are recorded as untested live, because only the test suites exercised them. Live custody checks against a real no-mistakes gate were not run, because this phase may not invoke no-mistakes sync or init. The change has no UI, so there are no screenshots.
Evidence: Live fm-pr-resync transcript (stale branch vs pipeline-rebased head; refusals; detached cases)
Source: Live fm-pr-resync transcript (stale branch vs pipeline-rebased head; refusals; detached cases)
Evidence: Live fm-promote --pr-branch and fm-brief --pr-branch transcript in a lab home
Source: Live fm-promote --pr-branch and fm-brief --pr-branch transcript in a lab home
Evidence: Resync owner core result
Evidence: fm-pr-resync test log
Source: fm-pr-resync test log
Evidence: fm-task-delivery test log
Source: fm-task-delivery test log
Evidence and verification status
agent-kit verify gate not recorded: no runner-attested verifier on this host (known boundary); host-unattested verifier receipt attached.
Host-unattested verifier receipt
An independent verifier seat (different model from the author) ran each ticket's verification command at the exact clean pre-pipeline head through a runner that refuses unless the worktree is clean at that head. Every receipt below records
isolation: host-unattestedandattestation: null. Together they are an independent receipt. They are not a recorded agent-kit verify gate.40d528543b1643b3de1fdb13486399708b14536b(clean tree, empty diff hash)codex-gpt-6-1-sol-verifier; implementer seatclaude-opus-5-5-authorbash tests/fm-pr-resync.test.shbin/fm-pr-resync.shALL-CONTROLS-RED)fm-task-delivery,fm-spawn-pool-base-freshen,fm-control-relaunch,fm-briefsuitesbash tests/fm-brief.test.shandbash tests/fm-dod-lib.test.shbin/fm-lint.shandbin/fm-doc-audience-check.shThe two controls checks first failed in an earlier attempt at this revision. In both cases the cause was four control mutation patterns that no longer matched the rewritten source lines. They were not product failures. The patterns were corrected (all 24 and 19 patterns now match the current source exactly once), and the two checks were rerun fresh. Both passed, and the logs showed no fixture errors.
This receipt covers
40d52854. The pipeline later added the review-round fixes listed below, and the verifier was not rerun at the PR head. Per policy, verify is re-run after merge.Pipeline evidence at the published PR head (separate from the receipt above)
main,40d52854becamedf3ca95f. The pipeline's review fixes added8684a105and2548564c, and the document step addedd926f79b, which is the PR head.2548564c. All seven focused suites exited 0:fm-pr-resync,fm-task-delivery,fm-spawn-pool-base-freshen,fm-spawn-orca-worktree,fm-control-relaunch,fm-briefandfm-dod-lib. The live scenarios in the Testing section above also passed.d926f79b: status is reported by the checks on this PR and is updated here when they finish.Earlier independent review (pre-pipeline, at
cbad5bcd)A different-model review panel found eight P2 findings, all fixed at
40d52854with 28 new per-guard negative controls (28/28 red when their guard is reverted):Base branch:line;FM_PR_RESYNC_TIMEOUT, default 120s), including the relaunch pre-probe;Review coverage gaps, stated plainly: the project-standards seat was unavailable (its packet lacked file-to-criteria pairing), and the maintainability seat was unavailable (model capacity). No agent-kit review-delta or readiness gate was run; that remaining coverage went through this pipeline's review.
Pipeline review rounds (this PR)
origin/mainnewer than the PR base was wrongly refused. Commits already on origin now count as safely anchored. Genuinely unanchored commits still refuse.--check) was declined deliberately.--checkis the approved operator dry-run contract, and its no-ref, no-FETCH_HEAD, no-recovery behaviour is tested and was shown live in the test step.Known boundaries and follow-ups
blocked_diverged,recover_custody, bind-archive,blocked_remote_rewritten) are covered only through a no-mistakes stand-in in the suites. No runtime evidence ofblocked_remote_rewrittenwas available.tests/lib.shcannot create its TMPDIR registries, suites that source it with a bare. lib.shcan keep running and printokfor cases whose assertions never executed. This is a pre-existing class acrosstests/*.test.sh; a fix is. lib.sh || exit 1or failing hard insidelib.sh.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-pr-resync.sh:230- The detached-HEAD guard refuses when the detached HEAD has commits absent from both the local branch and the published head, but it doesn't exclude commits already on origin. A pooled, Orca or scout copy detached at a current origin/main therefore refuses whenever main has moved past the PR's last pipeline rebase. Reproduced in a scratch repo: a worktree detached at origin/main one commit past the PR head's base got 'refused: detached HEAD ... contains commits absent from feat and the published head', exit 1. This breaks intent (1) for fm-spawn --pr-branch and fm-promote --pr-branch in the common case. Sibling sites: bin/fm-spawn.sh:5751-5761 (pooled copy with freshen skipped; detached Orca copy) and bin/fm-promote.sh:252-260 (scout worktree freshened to current origin/main). No test covers this: the fixtures detach before main moves (tests/fm-task-delivery.test.sh, tests/fm-spawn-pool-base-freshen.test.sh) or have no moved main (tests/fm-spawn-orca-worktree.test.sh). Fix in the owner by also excluding --remotes, e.g. rev-list "$detached_head" --not "$pub" ${local_head:+"$local_head"} --remotes, and add a regression test with the copy detached at the moved origin/main.bin/fm-pr-resync.sh:236- In a detached worktree the script switches to <branch> (or creates <branch> at the published head) before the no-mistakes custody read at lines 258-264. That contradicts the header (lines 47-50), which promises an unhandled verdict refuses before anything moves. The switch to an existing branch is only printed with say, never recorded with note_change, so a refusal prints 'changed: nothing' after HEAD moved, and exit 3 leaves the copy switched. Sibling paths: the fresh-spawn exit-3 refusal (bin/fm-spawn.sh:3881-3889) leaves the pooled copy on the branch; tests/fm-task-delivery.test.sh has to re-detach the scout after its exit-3 promotion; bin/fm-promote.sh:252-260 runs the owner before the self-repository publication gate (lines 264-273), so a gate refusal comes after archive/advance changes while the message says only 'the task record is unchanged'. Fix: record the switch with note_change or run the custody preflight before switching, and move the promotion resync after the publication gate.bin/fm-pr-resync.sh:208- The --check dry-run mode (lines 73-77, 208-216, 265) has no caller and no intent requirement asks for it. It adds its own objects-only fetch and re-advertise path. Spawn, promote, relaunch, the generated DoD block and validation-supervision all call the owner without --check; only tests/fm-pr-resync.test.sh uses it. Recommend removing it unless it is wanted as an operator tool; that is the author's call.🔧 Fix applied.
5 issues (1 error, 3 warnings, 1 info) still open:
bin/fm-pr-resync.sh:230- The detached-HEAD guard refuses when the detached HEAD has commits absent from both the local branch and the published head, but it doesn't exclude commits already on origin. A pooled, Orca or scout copy detached at a current origin/main therefore refuses whenever main has moved past the PR's last pipeline rebase. Reproduced in a scratch repo: a worktree detached at origin/main one commit past the PR head's base got 'refused: detached HEAD ... contains commits absent from feat and the published head', exit 1. This breaks intent (1) for fm-spawn --pr-branch and fm-promote --pr-branch in the common case. Sibling sites: bin/fm-spawn.sh:5751-5761 (pooled copy with freshen skipped; detached Orca copy) and bin/fm-promote.sh:252-260 (scout worktree freshened to current origin/main). No test covers this: the fixtures detach before main moves (tests/fm-task-delivery.test.sh, tests/fm-spawn-pool-base-freshen.test.sh) or have no moved main (tests/fm-spawn-orca-worktree.test.sh). Fix in the owner by also excluding --remotes, e.g. rev-list "$detached_head" --not "$pub" ${local_head:+"$local_head"} --remotes, and add a regression test with the copy detached at the moved origin/main.bin/fm-pr-resync.sh:236- In a detached worktree the script switches to <branch> (or creates <branch> at the published head) before the no-mistakes custody read at lines 258-264. That contradicts the header (lines 47-50), which promises an unhandled verdict refuses before anything moves. The switch to an existing branch is only printed with say, never recorded with note_change, so a refusal prints 'changed: nothing' after HEAD moved, and exit 3 leaves the copy switched. Sibling paths: the fresh-spawn exit-3 refusal (bin/fm-spawn.sh:3881-3889) leaves the pooled copy on the branch; tests/fm-task-delivery.test.sh has to re-detach the scout after its exit-3 promotion; bin/fm-promote.sh:252-260 runs the owner before the self-repository publication gate (lines 264-273), so a gate refusal comes after archive/advance changes while the message says only 'the task record is unchanged'. Fix: record the switch with note_change or run the custody preflight before switching, and move the promotion resync after the publication gate.bin/fm-pr-resync.sh:208- The --check dry-run mode (lines 73-77, 208-216, 265) has no caller and no intent requirement asks for it. It adds its own objects-only fetch and re-advertise path. Spawn, promote, relaunch, the generated DoD block and validation-supervision all call the owner without --check; only tests/fm-pr-resync.test.sh uses it. Recommend removing it unless it is wanted as an operator tool; that is the author's call.bin/fm-promote.sh:267- Sibling left behind by the round-1 F2 fix (fm-promote.sh:252-273). The fix moved the --pr-branch resync after the self-repository publication gate, but the resync still runs before the brief-content refusals at bin/fm-promote.sh:283-307: the {TASK}/{FIRSTMATE_SPEC} placeholder check, the content-validity check, the operator-address check and the provenance-marked intent check. Concrete sequence: a scout whose brief still has a placeholder is promoted with --pr-branch onto a pipeline-rebased branch. fm-pr-resync switches the detached scout worktree, archives the stale local head and advances the branch (exit 0). Promotion then exits 1 with only the brief error, so the scout worktree has been switched, archived and advanced although the promotion was refused. That is the 'mutation before a refusal' F2 was meant to close. Those four checks only read the brief, so the smallest fix is to move the PR_BRANCH_SET resync block below line 307, just before the ship instructions are rendered. A test would promote with a placeholder brief and assert the worktree HEAD and branch ref are unchanged.bin/fm-pr-resync.sh:51- The header line edited in the fix round says an unhandled custody verdict 'refuses before any ref moves'. That is still not true in one case: with a detached worktree and no local branch, line 242 creates refs/heads/<branch> at the published head before the custody read at lines 260-263. Creating that ref is reported correctly (note_change) and matches the authorized behavior in lines 17-20, but the header claim is wrong. Reword it to e.g. 'refuses before any archive or advance (a detached switch or branch creation is reported)' so the comment doesn't overstate the guarantee.🔧 Fix applied.
1 warning still open:
bin/fm-pr-resync.sh:208- The --check dry-run mode (lines 73-77, 208-216, 265) has no caller and no intent requirement asks for it. It adds its own objects-only fetch and re-advertise path. Spawn, promote, relaunch, the generated DoD block and validation-supervision all call the owner without --check; only tests/fm-pr-resync.test.sh uses it. Recommend removing it unless it is wanted as an operator tool; that is the author's call.bin/fm-pr-resync.sh:208- F3 disposition carried forward: the --check dry-run mode is intentionally kept. It is the approved spec1g, plan and T1 AC4 operator contract, the removal suggestion was declined, and this is not a pending product question. A live run in this step showed --check changes no refs and writes no FETCH_HEAD.bin/fm-pr-resync.sh demo <wt> fm/demo --check, run live on a stale local branch against a pipeline-rebased origin headbin/fm-pr-resync.sh demo <wt> fm/demo, run live: dirty-tree refusal, archived-advanced, idempotent rerun, ahead:1, and a branch origin lacksbin/fm-pr-resync.shrun live on a detached copy at a moved origin/main (accepted), a detached copy with an unanchored commit (refused) and an archive-name collision (refused)bin/fm-promote.sh live-pr1 --mode direct-PR --yolo off --pr-branch feature/prin abin/fm-lab-home.shlab home: dirty refusal, then a clean promotionbin/fm-brief.sh live-pr2 fixture-project --mode no-mistakes --pr-branch feature/pr, plus--pr-branchcombined with--branch-prefix(refused)bash tests/fm-pr-resync.test.sh(exit 0)bash tests/fm-task-delivery.test.sh(exit 0)bash tests/fm-spawn-pool-base-freshen.test.sh(exit 0)bash tests/fm-spawn-orca-worktree.test.sh(exit 0)bash tests/fm-control-relaunch.test.sh(exit 0)bash tests/fm-brief.test.sh(exit 0)bash tests/fm-dod-lib.test.sh(exit 0)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.