Repository navigation
fix: discover safe herdr AFK supervisor targets - #337
Closed
NumberedThought wants to merge 5 commits into
Closed
NumberedThought wants to merge 5 commits into
NumberedThought wants to merge 5 commits into
Conversation
added 5 commits
July 8, 2026 05:20
7hoenix
added a commit
to 7hoenix/firstmate
that referenced
this pull request
Jul 20, 2026
…internal clones (#5) * feat(spawn): harden no-mistakes internal clones against unattended-credential hangs The no-mistakes pipeline commits and pushes inside its own internal clone at ~/.no-mistakes/repos/<hash>.git, which fm-sign-lib's per-worktree override never reaches. That clone inherits the operator's global git config, so on a machine like the captain's it hits two unattended-hostile settings that block autonomous validation runs: - Surface 3: global commit.gpgsign=true drives a GUI signer no autonomous run can click, hanging every pipeline commit. - Surface 4: a global url."[email protected]:".insteadOf=https://github.com/ rewrites plain-HTTPS network ops to SSH (same GUI agent), and the default macOS credential chain (osxkeychain) hangs when the keychain is locked. Both were recovered manually on ark PR kunchenguid#337 and dotfiles PR #4 with the same dodge. This automates it: bin/fm-nm-clone-config.sh locates the internal clone via the project's own no-mistakes remote (hash-independent) and scopes, repo-local to that clone only, commit/tag.gpgsign=false plus, when SSH routing is detected, the username-form origin URL + reverse insteadOf + gh credential helper. The operator's global config, the no-mistakes install, and every project clone are never touched. Timing: applied at spawn time (fm-spawn.sh, the deterministic firstmate-owned guarantee, where fm-sign-lib already lives) and re-applied by a ship-brief line right before /no-mistakes (the internal clone can be created mid-run, after spawn). Both applications are idempotent. Every piece is a graceful no-op on a machine without the problem: no no-mistakes remote, no global gpgsign, no insteadOf, or no gh each shrink the work to nothing without error. Tests simulate a fake global config + internal clone + project with a curated PATH-shimmed gh, covering the full dodge, gh-absent username fallback, clean machine, non-gated repo, no-resolvable-username, and idempotency. * no-mistakes(test): isolate host git signing config and skip absent-shellcheck in tests * no-mistakes(document): add fm-nm-clone-config.sh to scripts.md toolbelt catalog
Notes
|
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
Fix away-mode supervision so the AFK sub-supervisor can adapt to a herdr primary pane when this API/tool shell lacks HERDR_ENV and HERDR_PANE_ID. Preserve explicit FM_SUPERVISOR_BACKEND and FM_SUPERVISOR_TARGET override precedence, keep direct herdr env target composition and tmux behavior intact, discover a safe firstmate-home Codex pane from herdr agent list when no env markers survived, reject crewmate project/treehouse worktree panes, and fail loudly rather than silently falling back to tmux firstmate:0 in an active herdr fleet with no safe primary. Add focused tests for explicit overrides, direct herdr env, herdr agent-list discovery, crewmate rejection, and the no-safe-primary failure path, and update only the AFK skill contract text that owns this behavior.
What Changed
Risk Assessment
✅ Low: Captain, the change is narrowly scoped, preserves the explicit tmux override after the follow-up fix, and adds focused coverage for the new herdr discovery/refusal behavior.
Testing
The configured full baseline had already passed; I then exercised the focused daemon and session-start regression suites plus a CLI-level daemon startup transcript showing the intended herdr AFK supervisor discovery, rejection, and override behavior. No UI evidence was applicable because this change is shell daemon behavior, not a rendered surface.
Evidence: Focused daemon test transcript
Evidence: Session-start regression transcript
Evidence: Manual herdr AFK supervisor evidence
Shows: safe herdr agent-list discovery resolves backend=herdr and target=default:w1:p1; crewmate-only herdr fleet exits 1 with the loud refusal; explicit tmux backend/target still starts and logs backend=tmux target=firstmate:0.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-supervise-daemon.sh:1014- Captain, this refusal path ignores an explicitFM_SUPERVISOR_BACKEND=tmux: in an active herdr fleet with noTMUX_PANE, startup exits before trying the intentional tmuxfirstmate:0fallback, so a valid explicit backend override no longer takes precedence. Gate this hard-fail to auto-discovery cases, or otherwise skip it when the caller explicitly selected tmux.🔧 Fix: Captain, preserve explicit tmux supervisor override
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed ✅
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"🔧 Fix: Captain: stabilize session-start missing-tool fixture
✅ Re-checked - no issues remain.
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"Baseline already completed before this round:command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"bash tests/fm-daemon.test.shbash tests/fm-session-start.test.shManual evidence script captured safe herdr primary discovery, crewmate-only hard-fail startup, and explicit tmux override preservation in/tmp/no-mistakes-evidence/01KX02R93B4ZQ8R38GT89DX523/herdr-afk-supervisor-e2e-transcript.txt✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.