Repository navigation
feat(sbx): automate fork token swap and lint tool provisioning for sandboxed ships - #6
Merged
Merged
Conversation
… manual steps A ship of the Firstmate fork swaps the sandbox's github secret to the fork-only token from the host file and points the clone's origin at the fork. No-mistakes ships also get the host's pinned ShellCheck and actionlint copied into the VM, so the lint step runs for real without widening the network allowlist.
… of A-Z/a-z in tr
…x-run.test.sh (test_lint_tools_of_the_wrong_version_or_that_do_not_run_are_left_out_loudly). The test previously stubbed PATH as "$FAKE:/usr/bin:/bin" after deleting the fake shellcheck/actionlint, assuming the host's real /usr/bin and /bin would not contain these tools. On the GitHub Actions ubuntu runner (and potentially other hosts), shellcheck/actionlint are pre-installed in /usr/bin, so command -v found the real binaries and fm_sbx_lint_tools reported an actual version instead of 'nothing', breaking the assertion "the host shellcheck reports 'nothing'". Root-cause fix: replaced the raw PATH override with the existing fm_test_base_path_sans helper (tests/lib.sh:751), which builds a curated directory containing symlinks to every tool resolvable on the base PATH except the named ones (shellcheck, actionlint) — guaranteeing those two tools are genuinely absent regardless of where the host installs them, while every other utility the wrapper needs (bash, grep, mv, install, etc.) stays resolvable. This is the same helper already used elsewhere in the suite (tests/fm-brief.test.sh:979) for exactly this absent-tool simulation problem. Verified: confirmed this sandbox itself has real shellcheck/actionlint at /usr/local/bin, and that fm_test_base_path_sans correctly excludes them from the resulting curated PATH (command -v finds nothing). Ran the full tests/fm-sbx-run.test.sh suite (30 tests) — all pass, including the fixed test and its sibling assertions (wrong-version and cannot-run cases, which were already using fake binaries and unaffected). No other test in the file relies on host-PATH absence of shellcheck/actionlint, and tests/fm-afk-return.test.sh / tests/fm-branch-supervision.test.sh were left untouched per instructions
ICBreakerLA
added a commit
that referenced
this pull request
Oct 6, 2026
…hot.test.sh that broke "Behavior portable serial 7". Rule that was broken: each test must start from a clean remote-ledger fixture, whatever tests ran before it. Cause: call #5 (test_remote_ledgers_share_one_concurrent_budget_and_fall_back_to_cache) leaves $TMP_ROOT/remote-ledger-home-1/state/slow-ledger-read behind, and only call #6 removes it. Slice 1of2 runs #5 but skips #6, so in call #25 (test_landed_preserves_kindless_v1_summary_reports) the fake ssh sleeps 30s against the 15s budget and collection times out. Fix: one line in make_remote_ledger_fleet (line 258), the single place every test builds these homes. After mkdir -p "$remote_home/state" it runs rm -f on slow-ledger-read, unbounded-ledger-read and home-summary.json; write_remote_home_summary then rewrites the summary. All other uses of these marker files are per-test create/remove pairs. The 15s budget and all assertions are unchanged. Verification: (1) a copy of the script calling only #5 then #25 (slice 1of2 order) fails without the line ("structured home ledger collection timed out and no valid cached copy is available") and passes with it; the copy and the leftover untracked tests/_verify-fix.test.sh were deleted. (2) bin/fm-lint.sh exits 0 (ShellCheck 0.11.0, actionlint 1.7.12). A direct shellcheck run shows one SC2034 at line 271 that predates this fix and is not flagged by the project lint. (3) bin/fm-test-run.sh --lane portable-serial-7of12 still exits 1 locally with 4 failures, each from sandbox gaps (no tmux, no tasks-axi, curl 403 fetching the pinned action verifier). The remote-ledger tests in it pass, but the bearings script stops at the tasks-axi requirement before call #25, so only check (1) exercises #25. Nothing was committed
ICBreakerLA
added a commit
that referenced
this pull request
Oct 6, 2026
* ci: split long serial suites into slices, add lint partitions, run parallel lanes 4-wide
The serial lane's longest shard carried 30 minutes of one-runner work and was
cancelled at its cap. Slice the independent test_* calls of ten long suites
across twelve shards, partition lint eight ways, and run the proven-isolated
parallel lanes at their proven --jobs 4. No test, check, or threshold is
removed or loosened.
* test: drop the unused dups local from the serial shard partition test
* no-mistakes(document): Update CONTRIBUTING.md required-check list for 8 lint and 12 serial shards
* no-mistakes(lint): Add missing shellcheck shell=bash directive to sourced test slice gate
* no-mistakes(ci): Fixed the real defect behind "Lint 4": bin/fm-test-run.sh:907 (`portable_serial_lane_weight()`) was dead code — its only call site had been replaced by `portable_serial_assignments | awk ...` earlier in the same diff, and ShellCheck's SC2329 ("function is never invoked") correctly flags it, which fails the lint step by default severity. Confirmed by reproducing locally: `FM_LINT_JOBS=1 bin/fm-lint.sh --partition 4of8` reported `bin/fm-test-run.sh ... reason=findings rc=1` with the SC2329 hit before the fix, and exits clean (rc=0, no SC2329) after deleting the unused function. Grepped the whole tree to confirm nothing else calls it, so removal (not suppression) is correct per the removal-first rule. This was the only genuine lint finding in the diff; a second PR-noted dead-code item (an unreachable `uniq -d` duplicate check inside `run_coverage_guard`, PR body line ~130) is real but belongs to the separate "Test coverage guard" job, which is not among the failing checks, is not flagged by any tool, and is out of scope for this round's two selected findings — left untouched. For "Behavior portable serial 7" I could not confirm a code-caused defect. I verified the new 12-shard/slice mechanism directly: `bin/fm-test-run.sh --check-coverage` passes cleanly (exact-once coverage, no dup/missing units across all 12 shards), the full `tests/fm-test-run.test.sh` self-test suite passes every case about the new slicing/packing logic ("slice gate runs every call exactly once...", "portable serial shards are a deterministic disjoint cover...", etc.), and a direct manual run of slice 1of8 of the longest split script (tests/fm-watch-triage.test.sh) dispatched exactly 18 of its 141 top-level test_* calls (the expected ~1/8), confirming the slice gate works correctly. Running the actual portable-serial-7of12 lane locally produced only 4 script failures, and each traces unambiguously to this sandbox's missing tooling rather than to the change: no tmux binary (blocks the afk/tmux-dependent fm-supervision-host assertions), no tasks-axi binary and a blocked npm registry (`fail "tasks-axi is required for ..."` in fm-bearings-snapshot and fm-teardown-sandbox), and blocked outbound network (curl 403 fetching a pinned GitHub Action verifier in fm-no-mistakes-required, a pre-existing test untouched by this PR). I could not fetch the actual GitHub Actions job log for shard 7 either — the Actions log-blob endpoint returned 403/"approval required" in this sandbox, matching the task's own "log retrieval incomplete" note. Per the task rules, since every concrete signal I could obtain points at sandbox-only tooling/network gaps rather than the PR's sharding/slicing code (which I verified behaves correctly), I did not invent a speculative fix for this check
* no-mistakes(ci): Fixed a test fixture leak in tests/fm-bearings-snapshot.test.sh that broke "Behavior portable serial 7". Rule that was broken: each test must start from a clean remote-ledger fixture, whatever tests ran before it. Cause: call #5 (test_remote_ledgers_share_one_concurrent_budget_and_fall_back_to_cache) leaves $TMP_ROOT/remote-ledger-home-1/state/slow-ledger-read behind, and only call #6 removes it. Slice 1of2 runs #5 but skips #6, so in call #25 (test_landed_preserves_kindless_v1_summary_reports) the fake ssh sleeps 30s against the 15s budget and collection times out. Fix: one line in make_remote_ledger_fleet (line 258), the single place every test builds these homes. After mkdir -p "$remote_home/state" it runs rm -f on slow-ledger-read, unbounded-ledger-read and home-summary.json; write_remote_home_summary then rewrites the summary. All other uses of these marker files are per-test create/remove pairs. The 15s budget and all assertions are unchanged. Verification: (1) a copy of the script calling only #5 then #25 (slice 1of2 order) fails without the line ("structured home ledger collection timed out and no valid cached copy is available") and passes with it; the copy and the leftover untracked tests/_verify-fix.test.sh were deleted. (2) bin/fm-lint.sh exits 0 (ShellCheck 0.11.0, actionlint 1.7.12). A direct shellcheck run shows one SC2034 at line 271 that predates this fix and is not flagged by the project lint. (3) bin/fm-test-run.sh --lane portable-serial-7of12 still exits 1 locally with 4 failures, each from sandbox gaps (no tmux, no tasks-axi, curl 403 fetching the pinned action verifier). The remote-ledger tests in it pass, but the bearings script stops at the tasks-axi requirement before call #25, so only check (1) exercises #25. Nothing was committed
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
Remove two manual steps that every Firstmate-fork PR from a sandboxed worker currently needs. (1) A new sandbox starts with the SportsMeet-only GitHub credential, so the pipeline push to ICBreakerLA/firstmate fails with 403 until the host swaps the sandbox's github secret to the fork-only token by hand (sbx secret rm/set github --sandbox with a --command that reads ~/.config/firstmate/fork-gh-token, never printing it). (2) The sandbox cannot download ShellCheck (blocked by the network allowlist), so the no-mistakes lint step fails and a human runs bin/fm-lint.sh on the host and approves past it. Both must happen without anyone doing anything by hand.
What Changed
bin/fm-sbx-lib.sh: addsfm_sbx_github_slug,fm_sbx_fork_repo/fm_sbx_fork_token_file, andfm_sbx_fork_urlto detect when a sandboxed ship's repository names the Firstmate fork, plusfm_sbx_fork_secretto swap the sandbox'sgithubsecret for the fork-only token (read viasbx secret set --commandso the value never enters a variable, argument, or environment), andfm_sbx_lint_tools/_fm_sbx_tool_versionto copy the host's pinned ShellCheck and actionlint binaries into a ship's VM when their versions match whatbin/fm-lint.sh/bin/fm-lint-workflows.shpin.bin/fm-sbx-run.sh: for ship sandboxes, repoints the clone'soriginat the fork and stores the fork token automatically when a remote names the fork and no explicitFM_SBX_GH_TOKENis set (falling back to the home's token with a notice otherwise), and invokesfm_sbx_lint_toolsto provision ShellCheck/actionlint before the no-mistakes pipeline runs.bin/fm-sbx-bridge.sh: addskeep_fork_originsoscrub_clonepreserves a fork origin URL on sync back to the host only when that fork is already one of the host worktree's own remotes, otherwise falling back to the host's origin.docs/configuration.md: documents the fork-token file (~/.config/firstmate/fork-gh-token, overridable viaFM_SBX_FORK_TOKEN_FILE/FM_SBX_FORK_REPO), the automatic ShellCheck/actionlint provisioning for no-mistakes ships, and adds the optional fork-token-file creation step to the sbx operator checklist.tests/fm-sbx-bridge.test.sh,tests/fm-sbx-lib.test.sh, andtests/fm-sbx-run.test.shto cover the new origin-preservation, fork-secret, and lint-tool-provisioning behavior.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change precisely implements both required automations (fork-token swap via sbx's --command form, and pinned ShellCheck/actionlint sideloading), guards the secret path against symlinks/empty files/explicit-token override, scopes the fork swap to ships whose repo actually lists the fork remote, strips credentials before any origin comparison, and is backed by tests that exercise real behavior (log/env assertions, not source-text matching); only a cosmetic diagnostic-message nit was found.
Testing
The prior turn ran the existing behavioral suites for fm-sbx-lib, fm-sbx-bridge and fm-sbx-run against a recording fake
sbx, asserting on real git/file/env side effects — but that is a test harness driving a stand-in, not the live product, so those results do not satisfy a live pass/fail. The one scenario that targeted the realsbxCLI/microVM (tests/fm-sbx-live.test.sh) could not run becausesbxis not installed in this environment (nor areshellcheck/actionlint). Per the live-validation contract, every scenario that lacks a live=true, evidence-backed result is reported as untested rather than pass/fail.sbxrecorder, not the live product; no live run against the r…sbxrecorder, not a live run; no live product was exercised.sbxrecorder, not a live run; no live product was exerci…sbxrecorder, not a live run; no live product was exercised.sbxrecorder, not a live run; no live product was exercised.sbxrecorder, not a live run; shellcheck/actionlint are not installed on this host, so th…sbxrecorder, not a live run; no live product was exercise…sbxCLI is not installed/on PATH in this environment, so the project's own opt-in live gate (tests/fm-sbx-live.test.sh, gated on FM_SBX_LIVE=1 plus installed sbx/no-mistakes/git) cannot run; nei…Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-sbx-lib.sh:296- In fm_sbx_lint_tools, the same else-branch notice "the host $tool cannot run inside $name" fires whether sbx cp failed, the root install failed, or the copy genuinely cannot run in the VM — the first two cases never actually copied the binary, so the message misdiagnoses a copy/install failure as a runtime-compatibility failure. Downstream behavior is unaffected (the tool is still correctly absent and the lint step still fails naming it), so this is purely a diagnostic-accuracy nit.sbxrecorder, not the live product; no live run against the r…sbxrecorder, not a live run; no live product was exercised.sbxrecorder, not a live run; no live product was exerci…sbxrecorder, not a live run; no live product was exercised.sbxrecorder, not a live run; no live product was exercised.sbxrecorder, not a live run; shellcheck/actionlint are not installed on this host, so th…sbxrecorder, not a live run; no live product was exercise…sbxCLI is not installed/on PATH in this environment, so the project's own opt-in live gate (tests/fm-sbx-live.test.sh, gated on FM_SBX_LIVE=1 plus installed sbx/no-mistakes/git) cannot run; nei…bash tests/fm-sbx-lib.test.sh (test_github_slugs_and_the_fork_remote)bash tests/fm-sbx-bridge.test.sh (test_the_forks_origin_survives_a_scrub_only_when_the_host_lists_it)bash tests/fm-sbx-run.test.sh (test_a_fork_ship_swaps_the_secret_and_points_origin_at_the_fork, test_a_fork_swap_never_applies_to_other_work, test_a_fork_ship_without_a_usable_fork_token_keeps_the_home_token_and_says_so, test_an_explicit_token_beats_the_fork_swap, test_nm_ship_gets_the_pinned_host_lint_tools, test_lint_tools_of_the_wrong_version_or_that_do_not_run_are_left_out_loudly)bash tests/fm-sbx-live.test.sh (confirmed opt-in live gate skips without FM_SBX_LIVE=1 and would additionally fail for missingsbx)command -v sbx / shellcheck / actionlint (confirmed none are installed in this environment)✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.