Repository navigation
Conversation
freshen_spawn_worktree_base() unconditionally fetched origin before every non-relaunch, non-secondmate spawn, so a purely local project with no origin remote could never host a crewmate or scout. Detect the absence of an origin remote positively (git remote get-url origin), skip the freshen with a clear notice, and let the spawn proceed. An origin that exists but fails to fetch still refuses exactly as before.
…ng origin positively
This was referenced Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Make firstmate able to launch workers (crewmates/scouts) on a project that has no origin remote. Currently freshen_spawn_worktree_base() in bin/fm-spawn.sh unconditionally fetches origin before every non-relaunch, non-secondmate spawn, so a project with no origin remote can never host a crewmate or scout. Required behavior: when the worktree's repository has no origin remote, skip the freshen, print one clear single-line notice to stderr saying the base was not freshened because the project has no origin remote, and let the spawn proceed. When origin exists and the fetch fails, keep refusing exactly as today with the unchanged message - that refusal is the real staleness guard and must not be weakened. Detect the absence of origin positively by checking whether origin appears in the configured remote list, never by inspecting fetch failure output or exit codes and never by treating a failure to read origin's URL as absence (a project can have an origin with only a push address configured) - inferring 'no remote' from a failed operation would turn a network problem into a silent stale-base launch. The no-remote path must not fall into remote set-head origin --auto, default-branch resolution, or the second fetch of refs/heads/... since none of those apply without a remote. Testing requirements: unit-level coverage for three cases (no origin: skips, notices, succeeds; origin present but fetch fails: still refuses, message unchanged; origin present and fetch succeeds: existing behavior byte-for-byte unchanged), added to the existing test file that covers this script (tests/fm-spawn-pool-base-freshen.test.sh). A real end-to-end crewmate spawn into a throwaway git repository with no remote, proving it succeeds and lands in an isolated worktree, was already performed and verified manually against a real Herdr-backed spawn in an isolated lab session (not part of the committed automated test suite). Acceptance criteria: a repository with no origin remote can host a crewmate spawn, proven end to end; a repository with origin whose fetch fails still refuses to launch with the current message; the passing-fetch path is byte-for-byte unchanged; tests cover all three cases; the no-remote notice is a single clear line rather than a silent skip. This is a change to firstmate's own shared tracked material (bin/fm-spawn.sh and its colocated test file). During review, three follow-up decisions were made and are already committed on this branch: (1) the no-remote early return must not skip the pre-existing dirty-pooled-worktree refusal that the origin path gets, so that refusal now applies on both paths while the no-remote path still bypasses only the fetch and reset machinery; (2) the no-remote path has its own accurate refusal wording, separate from the origin path's refresh-specific wording, since nothing is fetched or reset on that path; (3) every message on the no-remote path says the project has no origin remote specifically (not no remote at all), because the detection principle is that these messages must say exactly what the code checks and nothing broader - the code checks specifically for a remote named origin, and a project can have other remotes. No em dashes in any commit, comment, or PR text (standing captain instruction).
What Changed
freshen_spawn_worktree_base()inbin/fm-spawn.shnow reads the absence of origin positively off the configured remote list (git remoteoutput, matched exactly againstorigin), and on that path skips the fetch,remote set-head, default-branch resolution, and reset entirely, printing one stderr line (notice: pooled worktree '...' base was not freshened because the project has no origin remote) before letting the spawn proceed. An origin that is configured but unusable (for example fetch URL unset, push URL only) still falls through to the existing fetch, whose refusal message is unchanged.require_clean_spawn_worktree(), so the dirty-pool refusal now guards both paths instead of only the origin path. Each caller passes its own message tail: the origin path keeps itsrefreshing its basewording byte for byte, while the no-origin path says the project has no origin remote and refuses to launch a worker on top of uncommitted work, rather than blaming a refresh that never ran.tests/fm-spawn-pool-base-freshen.test.sh(no-origin pool skips, notices exactly once on stderr, and spawns; dirty no-origin pool refuses without discarding work; upstream-only pool skips the freshen, names the missing origin, and fetches nothing; origin with no fetch address still refuses) via ano-originmode on the shared fixture builder and aspawn_envhelper that keeps stdout and stderr separate. The pre-existing dirty-pool test now asserts its full refusal string, and the spawn header plusdocs/architecture.mddocument the no-origin exception.Risk Assessment
✅ Low: The change is confined to one function plus an extracted helper, leaves the origin fetch/reset path and all of its refusal messages byte-for-byte identical, detects missing origin positively so a network failure still refuses, keeps the clean-pool guard on both paths, and is covered by four behavior-level tests; the only findings are informational wording and test-strength nits.
Testing
I ran the script's own focused test file (9 cases, all passing, with the operator-visible notice and refusal lines captured), proved the three new no-origin cases fail against the base commit's fm-spawn.sh while the unusable-origin guard passes on both sides, and then demonstrated the intent end to end: a real fm-spawn.sh crewmate launch into a throwaway no-remote git repo using real treehouse pooling and a real tmux server on an isolated socket succeeded with exactly one stderr notice naming the missing origin remote, and the worker really ran in an isolated pooled worktree distinct from the project checkout. The same lab shows the origin-present path unchanged (no notice, base freshened to the origin tip including a commit pushed after the pool worktree existed) and that an unfetchable origin still launches nothing; note that in the live treehouse path treehouse's own fetch fails before fm-spawn's does, so fm-spawn's own unchanged refusal wording is evidenced at the real-script level in the unit transcript rather than in the live lab. This change is CLI/stderr-only with no rendered UI surface, so terminal transcripts are the reviewer-visible evidence. Adjacent spawn-path tests also pass, and I left the worktree clean with all lab and scratch artifacts removed.
Evidence: End-to-end transcript: real crewmate spawn into a no-origin project, plus the two origin-present contrasts
notice: pooled worktree '/tmp/fm-noremote-lab-e2e/project/.treehouse/project-a2d1ad/1/project' base was not freshened because the project has no origin remote spawned nr-evidence-a1 harness=bash kind=ship mode=local-only yolo=off window=firstmate:fm-nr-evidence-a1 worktree=/tmp/fm-noremote-lab-e2e/project/.treehouse/project-a2d1ad/1/project == spawn exit=0 == -- crewmate landed in an isolated pooled worktree, not the project checkout -- /tmp/fm-noremote-lab-e2e/project 8000a9a [main] /tmp/fm-noremote-lab-e2e/project/.treehouse/project-a2d1ad/1/project 8000a9a (detached HEAD) -- the crewmate process is really running in that worktree -- firstmate:fm-nr-evidence-a1 cwd=/tmp/fm-noremote-lab-e2e/project/.treehouse/project-a2d1ad/1/project running=bash crewmate-worker-alive lines in pane: 1Evidence: Fail-before-fix: the three no-origin cases against the base commit's fm-spawn.sh
=== PRE-FIX test_no_origin_remote_skips_freshen_and_succeeds === not ok - spawn should succeed on a pooled worktree with no origin remote: expected exit 0, got 1 === PRE-FIX test_no_origin_dirty_pool_refuses_without_discarding_work === not ok - the no-origin dirty refusal should be exactly one complete line naming the missing origin remote, found 0 === PRE-FIX test_non_origin_remote_only_skips_freshen_and_names_origin === not ok - spawn should succeed on a pool whose only remote is not origin: expected exit 0, got 1 === PRE-FIX test_configured_but_unusable_origin_still_refuses === ok - an origin configured without a fetch address still refuses instead of skipping the freshenEvidence: Post-fix focused unit run with the observed spawn messages
# observed no-origin notice: notice: pooled worktree '.../no-origin/pool' base was not freshened because the project has no origin remote # observed no-origin dirty refusal: error: pooled worktree '.../no-origin-dirty/pool' is not clean; the project has no origin remote, so refusing to launch a worker on top of uncommitted work; preserved=keep this local work # observed upstream-only notice: notice: pooled worktree '.../upstream-only/pool' base was not freshened because the project has no origin remote # observed unusable-origin refusal: error: could not fetch origin for pooled worktree '.../unusable-origin/pool'; refusing to launch from a potentially stale base # all fm-spawn-pool-base-freshen tests passedPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-spawn.sh:146- The header comment still describes the no-origin refusal as wording "that names the missing remote", the exact imprecision this branch went back and corrected everywhere else: eba912c changed all three runtime messages from "has no remote" to "has no origin remote", and 676fc33 changed docs/architecture.md from "there is nothing to freshen against" to "there is no origin to freshen against". docs/architecture.md:162 designates this header as the owner of the exact refusal mechanics, so the one surface that owns the mechanics is now the only one describing them more broadly than the code checks (the code checks for a remote named origin specifically, and the upstream-only test at tests/fm-spawn-pool-base-freshen.test.sh:302 exists precisely because other remotes can be present). Suggested fix: "names the missing origin remote".tests/fm-spawn-pool-base-freshen.test.sh:320- The assertion "spawn fetched a non-origin remote while skipping the freshen" cannot fail for the reason it states. The upstream remote added at line 307 points at file://$CASE_DIR/upstream-never-fetched.git, a path that is never created, so refs/remotes/upstream stays empty whether or not a fetch was attempted. Today the case is still not vacuous overall (a failed fetch would break the expect_code 0 above it), but if a future change ever fetched non-origin remotes tolerantly, this test would pass while claiming to prove nothing was fetched. Pointing upstream at a real bare clone carrying a commit (the fixture already knows how to make one in origin mode) gives the assertion teeth without changing anything else in the case.bin/fm-spawn.sh:1763- Recording the accepted tradeoff, not requesting a change: on the no-origin path the worker starts from whatever commit the pooled worktree already holds, which for a treehouse pool can be behind the project's local trunk (the stale-pool premise this test file opens with). Aligning to the local default branch tip is exactly what the intent forbids on this path ("must not fall into ... default-branch resolution"), and the required single-line notice is the disclosure, so the behavior as written is the authorized one. No action needed; noted only so the operator-visible consequence of the notice is on the record.✅ **Test** - passed
✅ No issues found.
FM_TEST_EVIDENCE=1 bin/fm-test-run.sh tests/fm-spawn-pool-base-freshen.test.sh(all 9 cases pass, including the 4 new ones; captured operator-visible notice and refusal lines)Fail-before-fix check: scratch copy ofbin/+tests/withgit show ef35d79:bin/fm-spawn.sh, each new case run in isolation -test_no_origin_remote_skips_freshen_and_succeeds,test_no_origin_dirty_pool_refuses_without_discarding_work,test_non_origin_remote_only_skips_freshen_and_names_originall fail pre-fix;test_configured_but_unusable_origin_still_refusespasses pre- and post-fixManual end-to-end lab (real git + realtreehousepool + realtmux -L fmnoremotelab+ sandboxed FM_HOME/state/config, worker =bash -lc "echo crewmate-worker-alive; sleep 900"):bin/fm-spawn.sh nr-evidence-a1 <no-remote-project> --mode local-only --yolo off --backend tmux --harness '...'-> exit 0, one no-origin notice, worker running in the pooled worktreeIsolation proof for the no-remote spawn:git -C <project> remote -v(empty),git -C <project> worktree list,tmux list-windows -a -F '...pane_current_path...',tmux capture-pane -p -t firstmate:fm-nr-evidence-a1, and the recordedstate/nr-evidence-a1.metaSame lab with a reachable origin (nr-evidence-c3): no notice emitted, crew worktreeHEAD == origin/main, and the commit pushed to origin after the pool worktree existed is present in the crew worktreeSame lab with an unfetchable origin (nr-evidence-b2): spawn refuses and no worker launches (treehouse's owngit fetch originfails before fm-spawn's fetch is reached)bin/fm-test-run.sh tests/fm-spawn-batch.test.sh tests/fm-spawn-dispatch-profile.test.sh tests/fm-spawn-worktree-settle.test.sh tests/fm-trace-context-spawn.test.sh tests/fm-control-relaunch.test.sh(5/5 pass) - adjacent fresh-spawn paths whose sandbox projects have no origin and therefore now take the new branchgit status --porcelainafter cleanup (clean; lab, scratch copy, and per-task/tmp/fm-*dirs removed, isolated tmux server killed)docs/architecture.md:161- Judgment call, no doc added: the manual end-to-end herdr crewmate spawn into a no-remote repo stays PR/task evidence rather than becoming a docs/verification record. The guard is git-based, not a harness-emitted signal, so firstmate-coding-guidelines' harness-dependent live-evidence rule does not apply, and the placement policy forbids creating a new documentation surface merely to close a perceived gap. The durable facts already live in their owners: the boundary and its one exception in docs/architecture.md, the exact refusal mechanics in bin/fm-spawn.sh's header, and the portable regression coverage in tests/fm-spawn-pool-base-freshen.test.sh.✅ **Push** - passed
✅ No issues found.