Repository navigation
Merge upstream/main into the fork, preserving the no-go guard and SDev backend - #4
Merged
Merged
Conversation
…e 1 data layer) fm-sdev-registry.sh reads an SDev project's repo composition from $SDEV_HOME/core/projects.d/<name>.yml via mikefarah yq and answers whether a project is SDev-backed; inert (silent, non-zero) when SDEV_HOME is unset or the project has no entry. fm-landing-policy.sh is a new standalone resolver mapping (project, repo) to <mode> <yolo> from config/landing-policy.json, per-repo override merged over project default, falling back to no-mistakes off - the same fail-safe fm-project-mode.sh uses. Additive only: no spawn/ship/teardown change, fm-project-mode.sh untouched. TDD, colocated fixtures and tests, shellcheck-clean.
jq's // treated an explicit false as empty, so a per-repo yolo:false fell through to a project-default yolo:true and silently resolved to on - failing open on the approval-authority axis. Resolve each axis by has() (null-guarded with type=="object") so an explicitly set false overrides instead of being read as absent. Adds a regression test for the false-over-true override.
Additive multi-repo SDev path alongside the existing treehouse/orca/cmux paths; non-SDev spawns are byte-identical and all existing tests stay green. - fm-spawn.sh: SDev workspace provider gated on an SDev-backed project (phase 1's fm-sdev-registry) with SDEV_HOME set. Creates the workspace via 'sdev new <slug>', places the crewmate in it, asserts per-repo git-worktree isolation, and records sdev_home=/slug=/repos= in meta (project=/worktree= kept). Orca and secondmate excluded. exclude_path now writes only at a genuine worktree root so the multi-repo workspace never pollutes the SDEV_HOME repo's git metadata. - fm-sdev-registry.sh: add 'home' subcommand (resolved SDEV_HOME), one owner of the resolution reused by spawn and run. - fm-run.sh (new): run layer - 'up' boots the stack, 'url' surfaces the live URL from 'sdev ls --json', 'open' opens it; rejects non-SDev tasks. - fm-brief.sh: --sdev multi-repo ship brief (one worktree per repo, branch task/<slug>, combined DoD); single-repo brief unchanged. - Tests: faked-sdev spawn/run/brief suites, registry home tests, and an opt-in real-sdev smoke (FM_SDEV_SMOKE=1) verified against ~/code/shamrock. - docs/sdev-backend.md: backend reference with dated empirical evidence.
fm-review-diff.sh: for an SDev task (slug= in meta) resolve the workspace's per-repo worktrees from the registry and emit one combined diff, comparing each repo's task/<slug> branch against that repo's OWN default_base (fetched from origin when remote-backed, else local); bases may differ per repo. Each changed repo is printed under a labeled header; untouched repos are excluded. Purely additive: a treehouse task (project=, no slug=) takes the unchanged single-repo path byte-for-byte, and tests/fm-review-diff.test.sh stays green. Adds tests/fm-sdev-review-diff.test.sh (2-of-3 repos changed, per-repo bases, --stat) and a combined-review section in docs/sdev-backend.md.
New bin/fm-ship-multi.sh: land a multi-repo SDev task as one atomic unit. It takes the CHANGED repos, resolves each repo's landing mode from the overlay, and requires EVERY changed repo to be a ready candidate before ANY lands - a remote repo needs its recorded pr_<key>= PR OPEN+APPROVED+green, a local-only repo needs its task/<slug> branch to fast-forward onto its base. Partial-failure policy: never partial-merge; if any changed repo is not ready, nothing lands and the blocker is named. Ready repos land in dependency order (overlay 'order' array, else common-first); remote via gh-axi squash-merge, local-only via a source-side fast-forward; each records landed_<key>= in meta for teardown. bin/fm-landing-policy.sh gains an 'order <project>' subcommand (additive; resolve path unchanged). Single-repo ship (fm-pr-check.sh / fm-pr-merge.sh) untouched and their tests stay green. Adds tests/fm-ship-multi.test.sh (2 remote + 1 local-only: nothing lands when one is not green; all land in order when ready) and doc/example updates.
fm-teardown.sh: for an SDev task (slug= in meta) apply the landed-work gate PER REPO - each changed repo's task/<slug> branch must be landed (phase-4 landed_<key>= marker, content-in-default for remote, or merged-into-local-base for local-only) and clean, or teardown refuses and names the offenders; a dirty repo refuses. On success it archives the workspace with 'sdev end <slug>' instead of a treehouse return. --force stays the explicit discard path. Purely additive: the single-repo gate is gated off for SDev by two guard lines only, so a treehouse task is byte-identical and tests/fm-teardown.test.sh (30 cases) stays green. fm-session-start.sh: the fleet digest surfaces an SDev task's slug/repos/workspace/ sdev_home so a restart reconstructs the multi-repo shape rather than assuming a single project=/worktree= (additive; fires only for slug= meta). Adds tests/fm-sdev-teardown.test.sh (refuse-unlanded, refuse-dirty, archive-on- landed, --force-discard) and an SDev recovery-digest case; doc updated.
docs/sdev-backend.md is now the complete standalone backend reference, mirroring the other backend guides: intro, the core/-vs-projects/ source-and-workspace model, the multi-repo task lifecycle (start -> run -> combined review -> all-or-nothing ship -> teardown), configuration, every component (registry, workspace provider, run layer, review, ship, teardown/recovery, brief), and the dated empirical verification. AGENTS.md gains a terse SDev entry per the knowledge-placement decision tree: the never-write rule extends to $SDEV_HOME/core/ (section 1), the two SDev config files are listed (section 2), and section 6 states a project may be SDev-backed with multi-repo tasks - each with a one-line pointer to docs/sdev-backend.md and no restated mechanics (6 added lines total). No behavior change, no new scripts.
feat: SDev multi-repo workspace backend
# Conflicts: # .gitignore # AGENTS.md # bin/fm-spawn.sh # bin/fm-teardown.sh
Sync fork to upstream kunchenguid/firstmate (preserve SDev backend)
Add config/no-go-paths, a local and gitignored list of absolute directory prefixes that agent work must never be dispatched into. An absent file means no restriction, so behavior is unchanged for every home that does not opt in, and no tracked material ever names an operator's private paths. bin/fm-no-go-lib.sh owns the matching so other scripts can adopt it later: comments, blanks, trailing slashes, and a leading ~ are handled, and matching is on a path-component boundary over both the literal and physically resolved forms, so /a/b blocks /a/b and /a/b/c but never /a/bc and a symlinked alias cannot route around a prefix. A malformed line refuses rather than being silently skipped. fm-spawn.sh refuses at two points. The project directory (or a secondmate's resolved firstmate home) is checked before any window, worktree, temp root, hook, state, or metadata exists, so a refused dispatch leaves nothing behind. The final worktree is checked once its provider reveals it, which cannot be before the backend window exists; that limitation is documented rather than engineered around, and declaring the pool root closes it. config/no-go-paths is inherited by secondmate homes, so a secondmate's own crewmates are held to the same boundary. Also classify docs/sdev-backend.md and docs/examples/landing-policy.json, which were already unclassified on main and failed the documentation audience check independently of this change.
The required Herdr lane failed at its first step with `curl: (56) Connection died, tried 5 times before giving up` after 166 ms. Those five tries are curl's own same-connection retries, all fired inside the same instant, so one reset from the release CDN decided the lane's result before any test ran. Both pin installers now use the bounded, backed-off retry that bin/fm-install-shellcheck.sh already owned, and tests/fm-install-pins.test.sh drives the real installers with a scripted curl to prove recovery after a transient failure, the bounded give-up, the growing pause, and that nothing is installed when every attempt fails.
feat(bin): refuse dispatch into operator-declared no-go paths
…v backend Merges upstream/main (10b93b2) into main (944e8a1). Merge base 8c21b10: 24 local commits, 163 upstream commits, 366 files. Resolution rule: take upstream's structure, re-apply the local features onto it. Upstream implements neither fork feature (git grep for 'no-go' and 'sdev' over upstream/main returns nothing), so no local behaviour was superseded except the CI serial-lane timeout. Twelve conflicts resolved, not the eleven that merge-tree --name-only reported; it omitted tests/fm-secondmate-harness.test.sh. Three defects in files that auto-merged cleanly, each fixed here: - freshen_spawn_worktree_base (upstream kunchenguid#2116) ran git fetch against an SDev task's WT, which is the multi-repo workspace directory rather than a git repository, refusing every SDev spawn. Gated on IS_SDEV, with a comment naming sdev/bin/new-task as the mechanism that already fetches each repo's base, so the exclusion is redundancy rather than a coverage gap. - --relaunch (upstream kunchenguid#1568) re-ran `sdev new` against a live slug and applied the single-worktree isolation check to an SDev workspace. Gated on RELAUNCH, with relaunch isolation routed to validate_spawn_sdev_workspace. New regression test in tests/fm-sdev-spawn.test.sh. - spawn_abort_cleanup: both sides inserted a block where base had none, both leaning on a shared trailing fi that was diff alignment rather than code. Upstream now requires an explicit per-task delivery contract (kunchenguid#1563). The --sdev brief takes --mode and stamps the Delivery contract line, with the per-repo landing overlay still refining each repo at ship time. Three fork test files were updated for the same requirement. The local CI serial timeout bump (20 to 30 minutes) is dropped in favour of upstream's four-shard lane, which removes the cause rather than raising the ceiling. Verification: full suite 176 scripts. Three failures, none merge-introduced. tests/fm-wake-queue.test.sh fails 3/3 on a clean upstream/main checkout; tests/fm-bootstrap-network-parallel.test.sh is load-flaky on upstream (FAIL PASS PASS) and passes 3/3 here. The third was a fork test-fixture gap introduced while adapting to --mode, fixed, now 18/18. bin/fm-lint.sh and bin/fm-lint-workflows.sh both clean.
This branch merged upstream into the fork at 10b93b2 (26 Aug). Since then main was rebased onto upstream 1bdfd8c - 177 commits newer - with the same four features replayed as squashed commits adapted to the current upstream shape. Every conflict here is the same conflict: this branch's pre-rebase version of a feature against main's rebased version of it. Main's side wins throughout, because that is the version written against current upstream and covered by the suites that pass on it (SDev spawn 7/7, brief 4/4, teardown 4/4, no-go 17/17). bin/fm-path-state-lib.sh is dropped rather than re-added: the rebase folded its presence probe into bin/fm-no-go-lib.sh, and nothing on main references it, so restoring it would add dead code. The result is therefore content-identical to main. This merge exists to make the branch mergeable and to record why it contributes nothing, not to move code.
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.
Merge upstream/main into the fork, preserving the no-go guard and the SDev backend
Merges
upstream/main(10b93b2) into this fork'smain(944e8a1).Merge base
8c21b101: 24 local commits, 163 upstream commits, 366 files, +96,783/-5,986.This is a merge commit on a branch. Nothing was forced, rebased, or discarded.
What to actually review
The merge itself is mechanical and 366 files is not reviewable hunk by hunk.
The reviewable surface is small and listed here:
Premise corrections found while planning
Twelve conflicts, not eleven.
git merge-tree --name-onlyomittedtests/fm-secondmate-harness.test.sh(5 hunks), the colocated test for the inheritance library.Upstream implements neither fork feature.
git grep -lniE 'no-go|no_go' upstream/mainand the same forsdevboth return nothing.There was therefore no "upstream already did this, delete the local duplicate" case anywhere in this merge, and no local behaviour was dropped in favour of an upstream equivalent.
The one place a local change was deliberately dropped is the CI timing, below.
The twelve conflict resolutions
AGENTS.mdconfig/inventory: keptsdev-homeandlanding-policy.json, took upstream'swatched-tools.jsonand its Relay rename ofx-mode.env.docs/configuration.mdfm-config-push.shsentence whole, including its new local-route-vs-remote-route reread split andtrace-context, and addedno-go-pathsto its item list. Kept the local reread-exclusion sentence.bin/fm-test-run.sh--check-coveragereportstotal=176with everytests/*.test.shclassified exactly once.bin/fm-spawn.shdocs/documentation-audiences.jsonoperator-exampleentries..agents/skills/secondmate-provisioning/SKILL.mdconfig/no-go-pathsto it, kept both local sentences on why the boundary is inherited and why it is excluded from reread inlining.bin/fm-brief.sh.github/workflows/ci.ymlbin/fm-config-inherit-lib.shno-go-pathstoFM_INHERITABLE_CONFIGalongside upstream'strace-context, kept upstream's new session-scoped machinery verbatim.bin/fm-config-push.shdocs/fm-test-portable-shards.mdtests/fm-secondmate-harness.test.shbin/fm-spawn.shspawn_abort_cleanup(): both sides inserted a block where base had none, both leaning on a shared trailingfithat was diff alignment, not code. Concatenated with correct brace accounting. The first attempt left an orphanfi;bash -ncaught it, which is why it was checked rather than eyeballed.FM_CONFIG_INHERIT_LIVE=1, so its side of this hunk was empty. Deleted the local copy at the old site and ported the fatal no-go boundary check onto upstream's new call.ifintoif RELAUNCH ... elif ...; added the SDev exclusion to theelif.bin/fm-brief.shUpstream made delivery mode an explicit required per-task input:
--modereplaces reading the project default,--yolois refused as a brief input, and the generated definition of done carries a fixedDelivery contract: mode=<mode>line thatfm-spawn.shreads back and refuses on mismatch.The
--sdevbrief now requires--modetoo and stamps that line, with one added sentence telling the worker that firstmate resolves each repo's own landing mode from the landing overlay at ship time.A missing contract line is only a warning in
fm-spawn.sh, so this was not a hard break - but exempting--sdevwould have put a permanent hole in an invariant upstream had just established.While resolving this, an accidental duplicate of the existing
--sdev-is-ship-only guard was introduced and then removed; the original auto-merged and is the one in the tree.Three defects in files that auto-merged cleanly
Git merged these without complaint. They were wrong because upstream added code paths the fork's features predate.
M3: upstream's pre-launch origin refresh broke every SDev spawn
Upstream kunchenguid#2116 added
freshen_spawn_worktree_base "$WT", called for every non-secondmate, non-relaunch spawn.It opens with
git -C "$worktree" fetch --quiet originand turns failure intoexit 1.For an SDev task,
$WTis the multi-repo workspace directory, not a git repository. The fetch failed and every SDev spawn was refused.This was invisible in the conflict list.
Gated with
[ "$IS_SDEV" != 1 ]. This is redundancy, not merely inapplicability:sdev newalready fetchesorigin/<base>per repo and startstask/<slug>from the freshest base, including when it re-brands a pooled worktree (sdev/bin/new-task). A comment at the gate says so and names that mechanism, so a future reader does not "fix" it back.Proven: with the gate removed,
test_sdev_backed_takes_sdev_pathfails witherror: could not fetch origin for pooled worktree '.../projects/scdi/task-backed'; refusing to launch from a potentially stale base.M1:
--relaunchre-created an existing SDev workspaceUpstream kunchenguid#1568 added
fm-spawn.sh --relaunch, which adopts a task's recorded worktree. The SDev workspace provider had no relaunch guard, so a relaunch ransdev new <slug>against a live slug.Upstream's relaunch branch also calls
validate_spawn_worktree, which asserts a single git worktree root and refuses an SDev workspace.Gated
spawn_sdev_workspaceonRELAUNCH -eq 0(WTis already set from the recorded meta), leftresolve_sdev_gateungated sosdev_home=/slug=/repos=survive the relaunch, and routed the relaunch isolation check tovalidate_spawn_sdev_workspacewhenIS_SDEV=1.New regression test
test_sdev_relaunch_reuses_the_recorded_workspaceintests/fm-sdev-spawn.test.sh.Proven: with the gate removed it fails with
relaunch: `sdev new` ran a second time and rewrote the ledger entry.M2:
spawn_abort_cleanupbrace accountingCovered above. Caught by
bash -n, not by inspection.The one local change deliberately dropped
The fork raised the portable serial CI job from 20 to 30 minutes because the unsharded remainder measured 18-21 minutes.
Upstream instead split that lane into four balanced shards of about 10.6 minutes each and kept the 20-minute cap.
Upstream's fix removes the cause; the fork's raised the symptom's ceiling. Upstream's is taken, in both
.github/workflows/ci.ymlanddocs/fm-test-portable-shards.md.This fork adds about nine test scripts, several into serial families, so shard balance shifts.
bin/fm-test-run.shgives an unmeasured script a mean-sized balance hint, so this is bounded rather than unbounded. If a shard exceeds 20 minutes in CI the fix is shard-membership rebalancing inbin/fm-test-run.sh, not a wider timeout.Test fixtures updated
Upstream's required per-task delivery contract broke three fork test files that predate it. Ship invocations now pass
--mode no-mistakes --yolo off, matching upstream's own idiom intests/fm-spawn-batch.test.sh:tests/fm-sdev-spawn.test.sh-run_spawnadds the contract; a newrun_spawn_rawomits it for--relaunch, which refuses a flag that would override the recorded mode.tests/fm-spawn-no-go-paths.test.sh- nine ship call sites; the--secondmatecases are untouched because a secondmate spawn refuses--mode.tests/fm-sdev-brief.test.sh- the two ship-brief cases.The SDev fake
tmuxgained two probes (#{pane_current_command}and a window inventory) so a relaunch case can present a positively agent-free endpoint. Defaults are unchanged, so no existing case shifts.What this fork gains from upstream
Grouped by theme, verified against the 163 commits rather than assumed.
Remote and cloud homes. A whole persistent firstmate home can now live on another SSH-reachable host, with the primary keeping routing and supervision (
docs/remote-secondmates.md). Remote commands run through a job worker, with orphan reaping, bounded SSH dead-peer detection, tool-path preflight, and truthful delivery reporting. SSH exit 255 preserves the route and never triggers a local duplicate. About twenty newbin/fm-remote-*.shscripts.Durable steer inboxes replace pane typing.
bin/fm-send.shnow writes a durable record into the task's steering inbox and rings a short constant doorbell line, instead of typing the whole message into the terminal. A lost steer is re-enqueued idempotently and the watcher re-rings. Works the same for local and remote tasks (bin/fm-task-inbox-lib.sh).A persistent Pi supervision branch. Supervision runs as its own branch of attention with its own model and reasoning-effort pins, settable through
/supervision-model(docs/pi-supervision-branch.md).Captain-hold lifecycle. The separate "decision" concept collapsed into "a task held for the captain", with a deterministic mechanism, record-divergence surfacing, and the same bounded pause cadence as a declared wait.
decision-hold-lifecycleis now a redirect stub tocaptain-hold-lifecycle.An interactive Lavish bearings board.
/bearings lavishbuilds and arms a fleet board with close controls, surviving inventory mismatches.GitLab merge requests through the guarded merge path.
bin/fm-pr-merge.shhandles GitLab alongside GitHub, refusing unless every pre-merge condition holds on one live read. This reaches SDev multi-repo ship for free, sincebin/fm-ship-multi.shalready delegates remote landing to it.Ask-user decisions decoupled from yolo. Finding authority is now the
ask-user-authorityskill's own criteria, not the project's yolo posture.Beyond the above, also gained:
bin/fm-control.shplusfm-spawn.sh --relaunchreplace an agent transactionally, keeping every identity axis and the same worktree (docs/agent-control.md).docs/trace-context.md).bin/fm-lint-workflows.sh, pinned lint tools installed across platforms, a fast local changed-shard-only lint mode, and a required no-mistakes pipeline step attestation bound to the PR head.docs/voice-relay.md).bin/fm-procevent-when.sh).CLAUDE.mdis now a real@AGENTS.mdpointer file rather than a symlink.Verification
bin/fm-lint.shclean.bin/fm-lint-workflows.shclean (actionlint 1.7.12 (pinned 1.7.12), 3 workflow files valid) - this is new from upstream.bin/fm-test-run.sh --check-coveragereportstotal=176, everytests/*.test.shclassified exactly once.Full suite:
FM_TEST_SUMMARY total=176 failed=3 skipped_gate=35 duration_ms=4247784.None of the three is merge-introduced. Each was baselined rather than assumed:
upstream/main(10b93b2), 3 runsfm-wake-queue.test.shfm-bootstrap-network-parallel.test.shfm-spawn-no-go-paths.test.sh--mode, not a guard regressionThe no-go failure is worth being explicit about, because it named a non-negotiable. The file has two spawn helpers; the first pass added
--modeonly torun_spawncall sites and missedrun_worktree_spawn, which invokes$SPAWNdirectly. Those cases died at argument validation before the guard ran - the output waserror: ship spawns require --mode, not a missing refusal. After the fix the whole file passes.Non-negotiable 1: a spawn into a no-go path is refused, and fails closed
Direct exercise, not just the suite:
The refusal names the offending path, the matched prefix, and the config file. Fail-closed cases, each exercised directly:
Suite coverage: 18/18 in
tests/fm-spawn-no-go-paths.test.sh, including refusal before metadata is written, worktree and window unwind on refusal, leaving an unproven-clean worktree in place, and a refused batch pair not stopping its siblings.Non-negotiable 2: the boundary is inherited so a secondmate cannot route around it
Direct exercise of the propagation helper:
Suite coverage in
tests/fm-secondmate-harness.test.shincludesB2b spawn: a secondmate that cannot inherit config/no-go-paths is refused, not warnedandB1c propagate_inheritable_config: the fatal boundary flag stays scoped to no-go-paths.This now extends to upstream's new remote secondmate homes at no extra cost. Upstream added
fm_config_inherit_items()as the single derivation that both the remote sender (bin/fm-remote-inherit-push.sh) and the remote receiver (bin/fm-remote-inherit.sh) consume. Addingno-go-pathstoFM_INHERITABLE_CONFIGputs it in that derivation. Verified rather than assumed:Non-negotiable 3: SDev ship stays all-or-nothing; teardown safety and recovery work
The two heavy auto-merges specifically asked about
bin/fm-teardown.shtook 10 upstream commits around 95 lines of fork additions, andbin/fm-session-start.shtook a heavy digest restructure around the fork'ssdev:line. Both auto-merged silently, so both were checked rather than trusted:tests/fm-sdev-teardown.test.shandtests/fm-session-start.test.shbothexit=0.Every fork feature test file passes:
fm-secondmate-harness,fm-sdev-spawn,fm-sdev-teardown,fm-sdev-registry,fm-sdev-brief,fm-sdev-review-diff,fm-sdev-backend-smoke,fm-ship-multi,fm-landing-policy,fm-run,fm-install-pins,fm-shared-captain-inheritance.