Repository navigation
feat(bin): enforce durable dispatch restrictions - #5
Merged
Merged
Conversation
A captain "keep this queued, do not dispatch" instruction used to be only a recorded working practice, so an agent (or a secondmate reconciling its own home at startup) could dispatch it anyway. tasks-axi hold is not durable enough for this either, since completing any related task clears it. Add bin/fm-dispatch-restrict.sh (set/list/lift) and its storage owner bin/fm-dispatch-restrict-lib.sh: a durable per-task-id record under data/dispatch-restrictions/ that nothing in the ordinary backlog/task lifecycle touches. bin/fm-spawn.sh now refuses a ship or scout spawn for a restricted id, naming who restricted it, why, and the exact lift command; --secondmate spawns are exempt since that id names the secondmate's own identity, not a backlog task. Lifting is the only thing that clears it. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HW29AtjyX3dfDNFoCpBNuD
…nd serialize mutations
… transition paths
…g backlog handoff
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.
What Changed
Secondmate Propagation Decision
The task brief asked us to decide, and explain here, how a restriction set in the main home reaches a secondmate home: automatic inheritance through
secondmate-provisioning's inherited-local-material channel, or per-home enforcement.We concluded per-home enforcement is correct, not automatic inheritance. That inherited-local-material channel is a fixed list of home-wide config knobs (
crew-harness,backlog-backend,captain-shared.md, etc.) that converge byte-for-byte across every secondmate home on every sync. A dispatch restriction is not home-wide config — it is data scoped to one task id, and a task belongs to exactly one home's backlog at a time (work routed to a secondmate already lives in that secondmate's own backlog, never mirrored back to the main backlog, perAGENTS.mdsection 10). So a restriction is set directly in whichever home actually holds the task:FM_HOME=<secondmate-home> bin/fm-dispatch-restrict.sh set ....bin/fm-on.sh <secondmate-id> fm-dispatch-restrict.sh ...channel, which already runs anybin/fm-*.shscript in a remote secondmate's home — no new cross-home channel was invented.The one case that needed real handling:
bin/fm-backlog-handoff.shmoves a task's ownership from the main home to a secondmate home, so it now carries an existing dispatch-restriction record along with the item (both the local-copy path and the remote outbox/payload delivery path viabin/fm-backlog-receive.sh), otherwise a restricted item could become dispatchable just by being handed off. The source home deliberately keeps its own copy after a handoff; only an explicitliftremoves it, independently in either home. This is documented as the authoritative contract inbin/fm-dispatch-restrict.sh's own header (one-owner rule), with a one-line pointer inAGENTS.mdsection 10.Merge
Merged by the captain via
bin/fm-pr-merge.shon explicit authorization, as squash commit4a2fc09with a clean subject and body — noCo-Authored-Bytrailer. The delivery contract (mode=no-mistakes,yolo=off) was honored: the driving worker stopped at a green, unmerged PR and the captain merged it explicitly.Risk Assessment
✅ Low: Captain, the fixes now close the promotion, relaunch, direct-spawn, and handoff symlink paths while preserving the intended per-home restriction and locking invariants.
Testing
Focused automated testing verified the restriction across dispatch, relaunch, promotion, handoff, and completion; direct CLI evidence demonstrated set/list/refuse/lift behavior end to end. All change-specific checks passed, while one reproducible and unchanged baseline Herdr teardown test failed.
Evidence: Dispatch restriction CLI lifecycle transcript
Set/list showed the captain-authored restriction; spawn exited 1 with the reason and exact lift command. After lift, spawn advanced to the ordinary missing-brief check.Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (2) ✅
bin/fm-spawn.sh:1085- A restriction set after a scout starts can still be bypassed:fm-promote.shconverts that scout tokind=shipand authorizes implementation without consulting the restriction. Extend the dispatch gate to the scout-to-ship transition and serialize it with the same.spawn-<id>.lock, so set/lift cannot race promotion.🔧 Fix: Captain, harden dispatch restrictions across all transition paths
1 error still open:
bin/fm-backlog-handoff.sh:282- Handoff still follows a symlinked source restriction directory: if$DATA/dispatch-restrictionspoints outside the data tree, local handoff copies a matching external file and remote handoff base64-encodes and transmits it. Applyfm_dispatch_restrict_dir_validatebefore both source-read loops, treating a missing directory as “no restrictions” but refusing an unsafe one.🔧 Fix: Captain, block symlinked restriction reads during backlog handoff
✅ Re-checked - no issues remain.
tests/fm-teardown.test.sh:1612- Pre-existing test failure: the Herdr missing-adapter teardown scenario unexpectedly continues instead of refusing. It reproduced in isolation, but the failing function and the teardown/backend sources it exercises are unchanged from the base commit, so this target did not cause it. The restriction-specific teardown persistence case passed.bin/fm-test-run.sh tests/fm-dispatch-restrict.test.sh tests/fm-backlog-handoff.test.sh tests/fm-remote-backlog-handoff.test.sh tests/fm-control-relaunch.test.sh tests/fm-task-delivery.test.sh tests/fm-teardown.test.shIsolatedtest_herdr_flat_teardown_preflight_refuses_before_changesfromtests/fm-teardown.test.shusing a transient wrapper, then removed the wrapperCompared the failing function andbin/fm-teardown.sh,bin/fm-backend.sh, andbin/backends/herdr.shagainst base commit9bd02325f7e148b623378e1c43ae47489792c3eeManual isolated-home CLI flow:fm-dispatch-restrict.sh set,list, restrictedfm-spawn.sh,lift, then unrestrictedfm-spawn.sh; captured the transcript artifact✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.