Repository navigation
feat(bin): refuse a fresh worker spawn whose brief names no skills - #26
Merged
Merged
Conversation
A fresh ship or scout spawn now refuses a brief with no # Required skills section unless --no-skills "<reason>" records why in the task record. fm-skill-select falls back to the project AGENTS.md Skills to load table when no skill clears the floor. Test briefs gain a skills section.
…ilure only reports it. I couldn't run the hc test locally because `herdr-core` isn't installed here, so the fix is unconfirmed until CI reruns. - **Behavior tests (herdr-core):** `tests/fm-backend-hc-appdetect-smoke.test.sh` writes its own worker brief, and that brief had no `# Required skills` section. This PR's new spawn check in `bin/fm-spawn.sh` (around line 4380) correctly refused it. This PR had already updated the other spawn tests' briefs, but this one was missed. - **Fix:** added `# Required skills` with `- tdd` to the test's brief, the same change this PR made to `tests/fm-backend-autodetect-smoke.test.sh`. Both spawn cases in that test use this brief, so both are covered. The spawn check itself is unchanged. - **Full suite:** it fails whenever any lane fails, so it should pass once the hc lane does. No separate fix needed. - **Checked locally:** `bash -n` passes. Running the test only prints "skip: hc not found". The spawn check passes a brief as long as the section has content, which this one now does
demy00
added a commit
that referenced
this pull request
Nov 13, 2026
…ixed 3 root causes in 4 files and verified each one locally. - **Test coverage guard, and tests/fm-test-run.test.sh (parallel 2), which runs the same guard.** - Invariant: no more than 15% of portable serial scripts may lack a duration hint. - Cause: the merge brought in 2 upstream tests with no hint, `fm-remote-inherit-generation` and `fm-supervision-host-herdr-live-e2e`. That moved the count from 44 to 46 out of 306, which is just over 15%. - Fix: added serial hints in `bin/fm-test-run.sh` for both: 3436 ms and 132 ms. These are their passing Ubuntu `FM_TEST_END` timings from this PR's own CI run, 43525853047. - Recorded where the numbers came from in `docs/fm-test-portable-shards.md`. - The guard now reports ok: 44 scripts without a hint, and the largest shard is 1198585 ms against a 1200000 ms budget. - **Serial 8: tests/fm-lane-capacity-integration.test.sh.** - Invariant: every brief for a fresh spawn must have a `# Required skills` section. This is the fork's gate from #26. - Cause: this test is new from upstream, and its `write_brief` fixture had no such section, so `fm-spawn` refused with exit 1. - Fix: added `# Required skills` with `- tdd` to the fixture, the same way `tests/fm-project-capacity.test.sh` does. The one other place this test writes a brief already gets the fix, because it goes through `write_brief`. - **Serial 1: tests/fm-gotmp.test.sh, "teardown exited non-zero".** - Invariant: each fake root's `bin/` must hold every lib that teardown sources. - Cause: the fork's `fm-dod-lib.sh` sources the fork-only `fm-task-branch-lib.sh`, and teardown also reaches the `fm-supervision-engine-lib.sh` lazy source in `fm-lease-lib.sh`. Neither file was linked into the upstream test's fake roots. - Fix: added symlinks for both libs in both fake-root builders in that file. - Other tests that use `fm-dod-lib` source it from the real `bin/` and passed in CI. - **Full suite** was only the roll-up of the failed jobs. Verification, run locally: - `bin/fm-test-run.sh --check-coverage`: ok. - `tests/fm-test-run.test.sh`, `tests/fm-gotmp.test.sh` and `tests/fm-lane-capacity-integration.test.sh`: all pass. Both of the last two failed before the fix. - shellcheck and `git diff --check`: clean
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
The captain asked for a review of skill usage across recent worker PRs. Firstmate then proposed building the firstmate-side recommendations from that review (recs 1, 6 and 9: refuse to start a worker whose instructions name no skills, check Docker disk, tools and credentials before starting a worker, and script the weekly skill table). The captain's answer, 2026-10-16: "build the firstmate improvements."
This task is recommendation 1: make skill selection a spawn gate.
Recommendation 1, as the review wrote it: workers load the skills their instructions name (132 of 132 named skills loaded, against 46% without a list), but the skills section was missing from every brief over several days and selector errors were swallowed. Change: bin/fm-spawn.sh refuses a ship or scout brief without a
# Required skillssection, unless--no-skills "<reason>"is given. bin/fm-skill-select.sh: when the selector model scores no skill above the floor, fall back to the repository's own skills table (a "Skills to load" table in the project's AGENTS.md); it should exit non-zero on usage errors before anything spawns. Batch scripts call the same gate. Where: bin/fm-spawn.sh, bin/fm-skill-select.sh, and the AGENTS.md skill-selection line.Captain 2026-11-09, releasing the held firstmate fixes: "5 yup" (start them, two at a time).
What Changed
bin/fm-spawn.shnow refuses a fresh ship or scout spawn if the brief has no nonempty# Required skillssection. The new--no-skills "<reason>"flag skips the check and saves the reason asno_skills=in the task record. The flag is refused in four cases: when the brief already names skills, on--secondmate, on--relaunch, and in batch spawns. Relaunches are never gated.bin/fm-skill-select.shhas a newfallbackstatus. It falls back when no skill scores at or above the 0.8 floor, when the selector is off, or when it errors. In those cases it reads the installed skills named in theSkillscolumn of the "Skills to load" table in the project'sAGENTS.md, without a network call, and--applywrites them into the brief. Usage and configuration errors, such as a missing flag or an unreadable brief, still exit 2, so a chained spawn never starts.AGENTS.md,docs/configuration.md,docs/scripts.md, thebin/fm-brief.shheader andCHANGELOG.mdto describe the gate and the fallback.bin/fm-live-lab.shand the test fixtures and spawn tests now pass--no-skillsor write a skills section. New tests cover the gate, the opt-out refusals and theAGENTS.mdfallback.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The spawn gate, the --no-skills opt-out (relaunch keeps it through preserve_relaunch_meta, batch spawns go through the same per-task gate) and the fixer's off/error AGENTS.md fallback all trace correctly; the fallback stays local, does not run before candidates exist or after a write, and is covered by behavioral tests.
Testing
Ran the focused fm-skill-select, fm-task-delivery and fm-spawn-orca-worktree suites; all passed. Ran the CLI by hand with no API key on an isolated home. It printed the off line, reported
status: fallback, and wrote a# Required skillssection listingtddandtypescriptfrom the project AGENTS.md table into the brief. A missing brief and a missing--projecteach exited 2. Saved the transcript and the spawn-gate test lines as evidence.Evidence: fm-skill-select off-path fallback and usage-error CLI transcript
Source: fm-skill-select off-path fallback and usage-error CLI transcript
Evidence: fm-spawn skills-gate test results
Source: fm-spawn skills-gate test results
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
CHANGELOG.md- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Review** - 2 issues found → auto-fixed ✅
bin/fm-skill-select.sh:411- The AGENTS.md "Skills to load" fallback only runs after the selector answers with statusnone. It never runs on anoffpath (no TYPESAFE_API_KEY, a never-send match, or no candidates, line ~411) or on anerroroutcome. Before this change that was harmless because skill selection was opt-in. Now fm-spawn.sh refuses any brief without a# Required skillssection. Concrete case: a home with no TYPESAFE_API_KEY runsfm-skill-select.sh --applyon a project whose AGENTS.md liststdd. It printsskill-select: off, writes nothing, and the spawn is refused. Firstmate then has to--setby hand, even though the project's own table could have supplied the skills locally with no network. This matches the intent's literal wording (fall back when the model scores none above the floor). Applying the fallback on off/error as well would widen that scope, so the author should decide.bin/fm-spawn.sh:4379- The skills gate runs after the project-capacity admission check. A brief with no skills section on a full project is first tolddeferred(backlog item stays queued), and is only refused for the missing skills when it is dispatched again later. Moving the gate ahead of the capacity check, next to the other brief-content checks, would report the actionable refusal first. Low impact.🔧 Fix: Use AGENTS.md skills fallback on off and error outcomes
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-skill-select.test.sh(covers the fallback on none, off with no key, off on a never-send match, and HTTP 500 error; also the usage errors that exit 2)bash tests/fm-task-delivery.test.sh(fm-spawn gate: refusals,--no-skillsreason recorded in the task record, refusals for a contradicting flag, secondmate, relaunch and batch)bash tests/fm-spawn-orca-worktree.test.sh(spawn suite changed by this branch)Manual: ranbin/fm-skill-select.sh brief.md --project webapp --harness claude --applywithout TYPESAFE_API_KEY on an isolated HOME and FM_HOME; the project AGENTS.md has a Skills to load table. Then ran the same command with a missing brief, and again without--project.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Skills used
firstmate-coding-guidelines,firstmate-self-repo,pipeline.Also tidied
bin/fm-brief.shheader anddocs/scripts.mdno longer call the# Required skillssection optional or opt-in, since a fresh spawn now requires it.CHANGELOG.mdentry indocs/documentation-audiences.jsoninstead of the earlier patch's duplicate.Noticed
These test files fail identically on clean main (
4123a5eb) and are not touched by this change; each needs its own fix:tests/fm-muse-harness.test.sh: "fm-harness.sh under process 'muse-bin-0.1.0-R708.1' reported '', expected muse"tests/fm-hermes-harness.test.sh: "NUL argv identity lost when names/ps args are blind"tests/fm-control.test.sh: "Hermes gateway diagnostic missing (missing: 'gateway')"tests/fm-cursor-harness.test.sh: "a real cursor-agent ancestor must detect cursor, got ''"tests/fm-gotmp.test.sh: "teardown exited non-zero with a valid tasktmp"tests/fm-remote-secondmate-lifecycle-e2e.test.sh: "the exited rex agent was not projected dead from its own host"All six were run locally on macOS; they may be platform-specific since CI is green.
Better idea
bin/fm-spawn.sh(the skills check runs after the project-capacity check, so a full project first defers a skill-less brief and only refuses it on a later dispatch) was not applied in this run. Moving the check next to the other brief-content checks would report the actionable refusal first; it is a small follow-up.