Repository navigation
feat: collapse decisions into tasks held for the captain - #2728
Merged
Merged
Conversation
…r the captain A decision is no longer a separate type: it is an ordinary backlog task held for the captain, identified by its task id. bin/fm-captain-hold.sh owns the surviving behaviors - guarded hold creation, the recorded-answer close (answer/answers with a release mode for captain-gated work), the source bindings, and the investigation completion gate - and bin/fm-decision-hold.sh becomes a one-release compatibility shim over it. The fleet snapshot now parses hold-until and computes captain_actionable as queued + captain-held + unblocked + due, independent of row kind, plus a presentation-only deferred_marker for prose-deferred rows. Bearings renders every due captain-held task in Captain's Call, date-deferred holds as dated Charted Next gates, suppresses prose-deferred rows from default views with an omitted disclosure, and excludes from Recently Landed anything that closed while still held for the captain. Legacy compatibility: pre-collapse <origin>-decision-<key> rows are already plain task ids and keep working; short keys in recorded metadata, concrete origin bindings, chat --resolve-key fallbacks, and old resolution records all resolve in place.
kunchenguid
force-pushed
the
fm/decisions-collapse-to-captain-task-r1
branch
from
August 21, 2026 06:35
ecd4ebb to
77ce20d
Compare
Intent
Collapse firstmate's separate 'decisions' concept into the one primitive the captain cares about: a decision is simply a task waiting on the captain - an ordinary backlog task held for the captain (tasks-axi hold --kind captain), identified by its task id. Captain-approved simplification grounded in two investigation reports (data/decisions-concept-ripout-investigation-s1, data/fm-decision-hold-noise-investigation-s1) which found the old decision type (the -decision- derived identity, the kind==captain projection filter, and the ~900-line bin/fm-decision-hold.sh) recorded which script created a row rather than what the captain has to do, and misclassified live data in both directions - surfacing noise AND hiding real captain-blocked work. All in ONE PR, per the captain's direction.
Requirements in their accepted form:
Deliberate decisions a diff-only reviewer would otherwise flag: the metadata attestation keeps the historical decisions_reviewed=1 / decision_keys= key names for compatibility with existing on-disk task metadata and the backend test fixtures that write them (entries are now task ids; legacy short entries resolve via origin composition, exact-task-id match wins). complete no longer enforces a per-status-key inventory mapping: with a non-empty verified inventory it transfers EVERY still-open keyed status decision to that inventory (the old per-key forcing produced the 28-holds-from-one-review pathology the reports document), while --none is still refused whenever lifecycle-open status decisions exist. answer closes a task even when work is routed behind it, because a Done blocker reads as resolved everywhere; the old routed 'resolve' path is retired and the shim maps it to answer plus recording the routed ids in the decision text and clearing the edges. The resolution block is written at the TOP of the body via --body-file with tasks-axi --archive-body, preserving the previous body below it so a released work item keeps its plan. A re-held task accepts a NEW answer as a new record on top; an interrupted-close retry has its recorded close mode checked so a retry cannot silently flip a release into a completion. The intake refuses to retro-record on already-closed items (reported skipped) except for an idempotent replay of the identical answer. hold no longer sets a kind on created tasks - kind is deliberately meaningless to captain surfaces now. Adding hold-until to the title metadata-stripping pattern also fixes a pre-existing bug where a dated row leaked '(hold-until: ...)' into its parsed title.
What Changed
fm-captain-hold.shfor idempotent holds, dated deferrals, recorded-answer completion or release, keyed answer intake, and investigation verification. Legacy identities, metadata, records, bindings, and all retiredfm-decision-hold.shcommands remain compatible for one release; running homes receive the renamed policy surface through the normal update path.close: release, supersedingfm-bearings-board-ui-options-close-r1and folding its intent into the task-ID model.Risk Assessment
✅ Low: The implementation is internally consistent with the required collapse, preserves legacy paths, and no material source-verifiable defect remains.
Testing
Inspected the target change, exercised the focused captain-hold lifecycle, Bearings snapshot/board, and fleet projection suites, then captured a rendered Captain’s Call board and an end-to-end release transcript showing the captain’s words recorded while the work remains queued and unheld; all checks succeeded and the worktree remained clean.
Evidence: End-to-end captain hold and release transcript with persisted task state
Source: End-to-end captain hold and release transcript with persisted task state
Evidence: Generated Bearings board HTML
Source: Generated Bearings board HTML
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed (6) ✅
bin/fm-captain-hold.sh:702- After areleaseanswer,tasks-axi unholdremoves the captain hold annotations. Replaying the identical keyed answer therefore reaches this guard and is reported as skipped instead of the promised idempotent no-op, despitecommand_answerhaving a released-record replay path. Check the recorded digest/mode before rejecting an unheld queued task, or delegate this case toanswer.bin/fm-captain-hold.sh:331- The hand-written JSON-style unescape corrupts existing bodies containing literal escape sequences. For example, a shown\\nsequence matches the\nreplacement before escaped backslashes are decoded, turning literal text into a newline. Unicode escapes are also not restored. Sinceanswer --releaserewrites the active work item's body, its preserved plan can be changed silently. Decode the quoted field with a real JSON-string decoder or consume an authoritative raw-body interface.bin/fm-captain-hold.sh:681- A pre-collapse keyed-answer record hashed the legacy text containingDecision key: <short-key>, while the new intake hashesTask: <resolved-id>. Replaying the same captured legacy answer after upgrade therefore fails the digest comparison at line 693 and is reported skipped, contrary to legacy-record recognition and digest idempotency. Accept the legacy keyed-text digest when the stored record was written by fm-decision-hold.sh.🔧 Fix: Fix captain answer replay and body preservation
2 issues (1 error, 1 warning) still open:
bin/fm-captain-hold.sh:409- The idempotency check compares the requested title with tasks-axi's encoded display value. Titles containing structural characters such as:or,are shown as quoted JSON-style strings, so repeating an identical create/hold command fails with “different title.” Decode the shown title before comparison, ideally at the shared show-field boundary.bin/fm-captain-hold.sh:697- Legacy digest reconstruction only handles the explicit(any)origin. The new no-origin intake is documented as equivalent, but replaying a pre-collapse keyed answer with its full legacy task id and no origin computes only the newTask:digest and reports the already-closed task as skipped. Treat an empty origin like(any)when deriving the legacy short key.🔧 Fix: Fix captain hold idempotency and legacy replay
2 errors still open:
bin/fm-procevent-lavish.sh:224- A captured choice declaring an unsupported close mode is silently converted to an omitted mode, which the intake interprets asdone. For example,"close":"drop"on a valid captain-held task completes it instead of failing closed. Distinguish an absent close field from a present invalid value and skip or forward the invalid value so the intake refuses it.bin/fm-decision-hold.sh:86- The compatibilityresolvecloses and records the legacy decision before checking any routed task or edge, and line 95 suppresses every unblock failure despite claiming it is loud. A nonexistent routed id or a task not blocked by this decision therefore reportsresolvedafter closing the decision, whereas the retired command refused before mutation. Validate all routed tasks and blocker edges beforeanswer, then surface any edge-clearing failure.🔧 Fix: Validate card close modes and compatibility routing
1 error still open:
bin/fm-captain-hold.sh:543- Afteranswer --releaserecords the answer and unholds the task, replaying the same decision without--releasereaches this branch and reports success even though the requested completion does not occur. This bypasses the required recorded close-mode check and can mislead callers into believing the task was completed. Requirerecorded_resolution_modeto bereleasedand the current invocation to include--release; reject every mode mismatch.🔧 Fix: Enforce release replay mode matching
2 errors still open:
.agents/skills/captain-hold-lifecycle/SKILL.md:21- The policy explicitly allows one task-backed gate to fan multiple questions out on the board, but every card uses that same task-id key andfm-procevent-lavish.sh:234discards all but the last answer for duplicate keys. If delivered separately, the first answer closes the task and later answers skip instead. Either path violates criterion 2(b), “nothing the captain owns may be closed without recording what he actually said.” Decide whether the board must consolidate all questions into one recorded answer or reject duplicate task keys until aggregation is supported.bin/fm-captain-hold.sh:493- A work item can be released, complete normally later, then receive the original decision again without--release. This branch checks only the digest and reportsanswered:even though the newest record saysResolution mode: released, bypassing the strict close-mode invariant added for queued released tasks. Read and validate the recorded mode before accepting a closed-task replay, and reject this mismatch while namingreleased.🔧 Fix: Prevent duplicate decision cards and released replay mismatches
2 errors still open:
bin/fm-captain-hold.sh:676- The tab-separated intake uses a whitespace IFS, which collapses an empty label column. A valid line liketask-id<TAB>go<TAB><TAB>releaseassignsreleasetolabeland leavesmodeempty, so the task is completed instead of released without error. Parse the four columns while preserving empty fields.bin/fm-decision-hold.sh:119- Intent requires that “old resolution records are recognized wherever a record is read” and that the resolve shim keep in-flight briefs working. A pre-collapse resolved record hashes only the original decision file, but the shim always appendsRouted work:before callinganswer; replaying the same legacy resolve therefore produces a different digest and fails. Detect a matching legacy routed record and replay using its historical digest/text while still validating and clearing the recorded edges.🔧 Fix: Preserve answer columns and legacy resolve replays
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-captain-hold-lifecycle.test.shbash tests/fm-bearings-snapshot.test.shbash tests/fm-fleet-snapshot-view.test.shbash tests/fm-bearings-board.test.shBuilt a realistic board throughbin/fm-bearings-board.sh build <payload>and rendered it with headless Google Chrome.Manually held an ordinary queued work task, answered it throughfm-captain-hold.sh answer --release, and inspected persistedtasks-axi showstate before and after.git status --shortconfirmed testing left the worktree clean.✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix: Quote done literals to satisfy ShellCheck
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.