Repository navigation
feat(bin): select named crew and base branches - #6800
wesleymatosdev wants to merge 33 commits into
Conversation
be8be69 to
be4b4fe
Compare
|
Speaking as Kun's firstmate: reviewed #6800 vs main VISION (per-rule): One captain/interface — aligns (CLI captain intent only). Authority explicit — aligns ( contract-class: opt-in — new behavior only when the captain passes CI: portable/Herdr/lint/invariants green on Warm ask: please re-run Once attestation MATCH + checks green, this is auto-merge-eligible as opt-in. |
Bare repositories and office work that ships against a named feature branch need a full crew branch and an integration branch through launch, PR target, review, and landing.
…ests/fm-named-branches.test.sh. Targeted test, bash syntax check, and diff validation pass; shellcheck reports only the existing SC1091 info for tests/lib.sh
…n named-branch tests with main's base contract - fm-promote.sh: CLI --base-branch was silently discarded (overwritten from meta at line 247) so a changed base promoted on the recorded base instead of refusing; preserve the CLI value and compare it against the recorded base. - tests/fm-named-branches.test.sh: align with the reconciled contract — local-only cannot carry a base, missing-base refusals name origin/<branch>, dropped-base refusal uses main's wording, promotion renders the base into worker contract prose, scout-promotion collision cases verify via a real worktree with origin/<base> fetched.
…ses a local named base Review findings on the rebased branch: - fm-merge-local.sh: drop the unreachable recorded-base landing layer (a local-only task can never carry a base; fm_base_branch_valid refuses the combination at brief/spawn/promotion) and refuse a contradictory local-only+base meta loudly instead of silently landing on the default. Bare-repo landing and the shared project lock are kept. - fm-spawn.sh freshen_spawn_worktree_base: a named base that exists only locally (already validated by ensure_named_base_present) now resets the pooled worktree to the local ref instead of refusing on the missing origin branch, so the scout local-base fallback is no longer defeated. - tests/fm-named-branches.test.sh: merge-local cases rewritten to the reconciled contract.
…ining recorded-base landing prose - tests: the merge-local rewrite dropped three test definitions while their runner lines remained (silent command-not-found false green); restore a bare-repo fast-forward test and remove the stale runners. - docs: gerrit-forge-integration, scripts, captain-hold-lifecycle no longer describe a recorded-base landing for local-only (impossible since fm_base_branch_valid refuses the combination). - fm-dod-lib.sh: drop the unreachable base-specific sentence in fm_ship_rule_one's local-only case.
…ckends, verify kept bases on publishing promotion - fm-spawn.sh: a fresh ship spawn whose backend skipped the shared project lock at admission (orca without a capacity declaration) now takes it around the crew-branch occupancy scan, so two spawns cannot claim the same --branch-name concurrently; the header's through-publication claim holds. - fm-promote.sh: a publishing promotion now verifies the base (exists on origin, available in the scout worktree) whether it came from --base-branch or the scout's record; only local-only, which never publishes, skips it. - tests: the local-only-offline spawn case exercises the reachable state (no --base-branch); the recorded-base promotion fixture uses a real checkout/worktree and asserts the verified remote-ref prose. - docs/architecture.md: name the cross-home crew-branch collision window.
…an unrecorded base Review round 3: - fm-spawn.sh: an orca ship spawn without a capacity declaration now takes the shared project lock at the occupancy check and holds it through task metadata publication via SPAWN_TREEHOUSE_PROJECT_LOCK_HELD, so the header's through-publication invariant actually holds and two concurrent spawns cannot claim the same --branch-name. - fm-promote.sh: naming --base-branch on a scout with no recorded base restates the default instead of refusing with a confusing message; a recorded base still refuses any change.
…ef header local-only prose Review round 4: - fm-promote.sh: --base-branch now passes the same mode/forge validation as the recorded base (a local-only or gerrit CLI base refuses with the early explanatory message), and the meta read uses tail like the rest of the codebase. - fm-brief.sh: the usage header no longer says local-only merges to a recorded integration branch; local-only always lands the default.
… refuses a contradictory local-only base Review round 5: - fm-spawn.sh freshen's no-origin branch no longer demands mode=local-only before using a named base: ensure_named_base_present already validated the base exists locally, so ship and scout spawns on origin-less projects start from it instead of dying after slot claim. - fm-teardown.sh: landing_branch refuses a local-only meta that records a base (impossible state; loud refusal instead of silent default landing), and the header prose no longer describes a recorded-base local-only landing.
Behavior portable serial 4 failed on PRs that never touched this path, at two different generations of the same await: a transient failed read (a worker readiness miss, a wedged remote job) makes the runner exit so reconciliation can replace it, and the line already sitting behind the cursor then needs the await itself to start the replacement. The helper checked ownership only once at entry, so a loss after that check burned the whole 40s budget and failed the suite. await_reply_result now runs a bounded second ownership-checked wait, the same recovery await_recapture_result already provides for slow recaptures, and a deterministic regression case pins it: the listener is stopped after the await begins polling and the line is appended only after the loss, so only a later attempt's restart can capture it. With one attempt the case reproduces the CI failure; with two it recovers. Co-Authored-By: Claude Code <noreply@anthropic.com>
32fc1a6 to
1c70a19
Compare
|
Speaking as Kun's firstmate: thank you @wesleymatosdev for the big round of fixes. The project lock held through publication, the checks on kept bases, and the named-branch tests are real improvements. The no-mistakes attestation now binds the head ( What I checked on head Contract-class (my own read): new-default, not opt-in as I said on 10-12.
These are good refusal paths. They still count as new default behavior, so once this is ready it goes to Kun for a merge-or-leave decision and won't auto-merge. VISION, rule by rule: One captain/interface: aligns (refusals are plain one-line errors). Authority: aligns (named branches/bases are explicit, and the new refusals strengthen the gates, not widen them). The bare-repo landing is still the captain-approved merge gate. Scripts own mechanics: aligns. Restart: aligns ( What it's waiting on (you): the no-mistakes run says its Test agent ran out of budget (an unrecognized-model error) before live validation finished, so this head has no live evidence. Its review also left two warnings open: the promote "restate an unrecorded base" arm can leave a task that can't be relaunched, and the named-base brief carries the same
I won't run a live test from here. After that and green CI, it goes to Kun. |
|
Addressing the review: I ran the live named-branch lifecycle test (option 1) on head Results — all green except the one the review predicted:
Review warning 1 (promote restating an unrecorded base) — CONFIRMED, with the exact failure. Scene C spawns a scout with no base, promotes with The promoted meta and the on-disk brief now disagree, and the relaunch brief check (which Scene B proves works when they agree) refuses — so the task cannot be relaunched, exactly as the review suspected. Fix direction when you want it: promote already rewrites the scout's brief (the promoted brief is rendered at Review warning 2 (named-base brief states the CI: The full transcript follows. Full transcript (fm-brief → fm-spawn → fm-promote → fm-control exit → fm-spawn --relaunch → fm-review-diff → fm-merge-local → fm-teardown, three scenes)Live named-branch lifecycle — firstmate PR #6800 head 1c70a19Driven 2026-10-26 23:11:22Z on macOS 26.4.1. Scene A — ship spawned with --branch-name + --base-branch, relaunched, landedA1 — fm-brief.sh scaffolds the ship brief with the named crew branch and baseexit code: 0 A2 — fm-spawn.sh: fresh ship spawn with a named crew branch and named baseexit code: 0 observed: meta:
observed: worktree HEAD: HEAD @ 120f698; office.txt present: yes A2b — the crewmate creates its crew branch (brief step 1) and ships its changeexit code: 0 observed: work committed on feature/widget: 499bc41 ship the office change A3 — fm-control.sh exit: stop the agent so the endpoint is positively freeexit code: 0 A3b — fm-spawn.sh --relaunch: relaunch on the recorded branchesexit code: 0 observed: after relaunch: branch=feature/widget, work file still present: yes A4 — fm-review-diff.sh: review against the recorded baseexit code: 0 A5 — fm-merge-local.sh: land the crew branch into the named baseexit code: 1 observed: office after landing: 120f698 start the office integration branch A5b — push the crew branch to origin (the PR-ready state fm-merge-local's guard expects)exit code: 0 A6 — fm-teardown.sh: tear the landed task downexit code: 0 Scene B — scout spawned on a named base, promoted with the named crew branch, relaunchedB1 — fm-brief.sh: scout brief on the named baseexit code: 0 B2 — fm-spawn.sh: scout spawn with --base-branch officeexit code: 0 observed: meta:
B3 — fm-promote.sh: promote to direct-PR on the named crew branch and baseexit code: 0 observed: meta after promote:
observed: ship-instructions base lines:
B3b — the promoted worker creates the ship branch (brief step 1) and ships its changeexit code: 0 observed: work committed on feature/widget B3c — fm-control.sh exit: stop the agent so the endpoint is positively freeexit code: 0 B4 — fm-spawn.sh --relaunch: relaunch the promoted taskexit code: 0 B5 — fm-review-diff.sh: the promoted task reviews against its recorded baseexit code: 0 B5b — push the crew branch to origin (PR-ready)exit code: 0 B6 — fm-teardown.sh: tear the scout-promoted task downexit code: 0 Scene C — review-warning probe: promote restating an UNRECORDED base, then relaunchThe no-mistakes review left open: the promote arm that lets --base-branch restate a base C1 — fm-brief.sh: scout brief with NO base branchexit code: 0 C2 — fm-spawn.sh: scout spawn with NO --base-branch (base records nothing)exit code: 0 observed: meta:
C3 — fm-promote.sh: promote restating --base-branch office (none was recorded)exit code: 0 observed: meta after promote:
C3b — fm-control.sh exit: stop the agent so the endpoint is positively freeexit code: 0 C4 — fm-spawn.sh --relaunch: can the restated task be relaunched?exit code: 1 Transcript ends. |
What Changed
--branch-name(mutually exclusive with--branch-prefix, refused on scouts, secondmates, and relaunches) instead of the prefix-plus-id default;fm-brief.sh,fm-spawn.sh, andfm-promote.shagree on it, and fresh spawns refuse crew-branch occupancy by another task or local/remote branch collisions before publishing any task record.--base-branch; it is recorded asbase_branch=instate/<id>.meta, reused on relaunch and restated-but-never-changed at promotion, re-verified on origin and in the scout worktree before a publishing promotion, and refused for local-only tasks, while review diff, fleet snapshot, teardown, and local merge landing honor it (fast-forward on a clean recorded-base/default checkout, or an in-place ref update for a bare repo under the project lock) includinglocal <branch>landing notes on completion.tests/fm-named-branches.test.shcovering brief, spawn, and promote named-branch behavior, updates the surrounding test fixtures, and documents the named crew/base branch contracts indocs/,AGENTS.md, andREADME.md.🤖 Generated with Claude Code
Risk Assessment
Testing
The Test agent exceeded its invocation budget before live validation completed; no evidence was gathered for this head.
Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
AGENTS.md- merge conflict rebasing onto origin/mainbin/fm-brief.sh- merge conflict rebasing onto origin/mainbin/fm-promote.sh- merge conflict rebasing onto origin/mainbin/fm-dod-lib.sh:392- Simplification: the new [base-branch] parameter of fm_gerrit_publish_block renders a 'gerrit-axi publish --squash --json --branch <base>' step, but no reachable caller can pass a non-empty base: fm_base_branch_valid (same file, line 180-183) refuses a base whenever forge != none, and it is enforced at line 421 before any gerrit case renders, and at both production callers (bin/fm-brief.sh:724, bin/fm-promote.sh:456). The empty-base arm reproduces the exact pre-change sentence, so this conditional branch (with its printf -v quoting) is a component the named-crew/base intent does not exercise — gerrit is deliberately excluded from bases by the fleet's own invariant. Siblings: call sites at bin/fm-dod-lib.sh:445 and :480, and the header comment at line 112-114 describing the dead argument. The remedy is removal of the parameter/branch (restoring the fixed sentence), which deletes deliberately-written defensive depth rather than fixing a defect, so the removal itself needs authorization.ℹ️
bin/fm-teardown.sh:1694- backlog_done_args generalizes the local-only completion note to 'local <branch>' when a base is recorded but keeps the literal landing=main otherwise, while fm-merge-local.sh:95-125 (changed in this same PR) resolves and fast-forwards the actual default branch, which may be master. For a master-default local-only repo the recorded note ('local main') and the merge output ('merged ... into local master') disagree — a wrong label, not a wrong landing; the landing itself is correct. Pre-existing inaccuracy the change perpetuated while generalizing the named arm; fm_backlog_local_note_valid already accepts 'local master', so a follow-up could resolve default_branch as merge-local does. Sibling prose: bin/fm-dod-lib.sh:508 ('localmain').bin/fm-promote.sh:317- The restatement arm introduced by uncertified fixer commit 2ac012e ("allow restating an unrecorded base", blessed by AGENTS.md:196) lets a promotion write base_branch= to the meta while the durable brief it publishes (the append at fm-promote.sh:534-543, which exists "for future relaunches") never carries a "Base branch:" line - the appended ship contract has no fm_brief_base_branches-recognizable Setup sentence. Concrete sequence: scout briefed without a base -> fm-promote.sh <id> --mode direct-PR --base-branch office succeeds (meta records base_branch=office; no brief check exists on this path) -> worker dies -> fm-spawn.sh <id> --relaunch reads the recorded base and forces BASE_BRANCH_SET=1 (fm-spawn.sh:2427-2429), then the ship brief-agreement gate (fm-spawn.sh:4029-4033) sees BRIEF_BASE=<none> vs base_branch=office and refuses every relaunch, advising re-scaffolding with fm-brief.sh --base-branch, which itself refuses because the brief exists; recovery requires manual brief surgery. Fresh spawns cannot create this state (fm-spawn.sh:3964-3967 requires the brief to record the base); promotion is the only writer violating the "meta base <=> brief Base branch line" invariant this same change established. Remedy: the promoted brief replacement must carry the same base contract fm-brief.sh writes (its SETUP_BASE variant, fm-brief.sh:721-723) whenever a base is in play - squarely within promote's own stated purpose of appending the superseding contract for relaunches; the alternative of again refusing an unrecorded base would revert 2ac012e's deliberate allowance and the AGENTS.md wording, so the append is the minimal fix.bin/fm-dod-lib.sh:605- Simplification: fm_dod_block renders the pre-existing nm_base paragraph ("pass--base-branch officeon everyno-mistakes axi runthat starts a run...", fm-dod-lib.sh:483, emitted at :602) AND the new block at :605-611 ("When starting no-mistakes, passno-mistakes axi run --base-branch office... Do not... change repopr.base_branchsettings") in the same generated contract; rendered and verified both appear (output lines 8 and 38). Introduced by the original feature commit b1c2e32, so both copies ship in every named-base brief (fm-brief.sh:805) and promotion (fm-promote.sh:505). This is a second definition of a rule the contract already states once; the only non-duplicated content is the "do not change repo pr.base_branch settings" sentence. Remedy is removing one paragraph (folding that sentence into nm_base) - recommend deleting the :605-611 block - which changes rendered worker-facing output, so it needs the author's decision.ℹ️
bin/fm-promote.sh:300- fm-promote.sh:300 sets PROMOTE_BASE_WORDS to "copy of the base branch$BASE_BRANCH", but any promotion that reaches the render at :478 with a non-empty base has PROMOTE_BASE_REMOTE=1 (the verification at :329-355 either exits or sets it), and :436-438 unconditionally overwrites the wording to the refs/remotes/origin/... form. Fixer commit e870b26 added the override and left the old assignment behind; it is unreachable in every path that consumes it and now only misleads a reader into thinking two wordings ship. Remedy: delete line 300's assignment, keeping the :299 default.git -C ~\.no-mistakes\worktrees\f4e5d490ae69\01M5QVK2XCWZ93XNVZNGHKCN4N statusandgit -C ~\.no-mistakes\worktrees\f4e5d490ae69\01M5QVK2XCWZ93XNVZNGHKCN4N diff). Respond with fix to validate it, or abort.🔧 No changes applied.
1 warning still open:
✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.