Repository navigation
fix(captain-hold): resolve attested captain calls from the done archive - #1
Merged
Merged
Conversation
The completion gate re-resolves every previously attested decision key on every later attempt, but resolved them from the live backlog only. Retention prunes an answered captain call out of that backlog into the configured archive, so a completely ordinary lifecycle - answer the call, let retention archive it - permanently wedged every later `complete` and `verify` for that origin with "no captain-held task <id> and no migrated hold for it". No supported command could reach it: `answer` and `hold` require the task to exist, and `reconcile` requires a pending board request. The recorded answer was never lost, only unreachable. The archive is an ordinary markdown backlog whose sections are dated "## Archived <date>" headings rather than "## Done", which tasks-axi's markdown parser skips outright, reading the file as zero tasks. The gate now reads an archived row through a private scratch copy with those headings renamed, so the row is parsed by tasks-axi itself into the same --full field shape as a live one. The archive is never written. Only the lookup widens. verify_hold_durable applies the same rule to an archived row as to a live one, and an archived row is closed by definition, so it satisfies the gate solely on a recorded captain answer; a key naming no row in either place still refuses with exactly the message it always did. The mutating subcommands keep resolving from the live backlog alone, because tasks-axi cannot address an archived row and it must never be handed to hold, answer, or reconcile as if it could.
…urce and bound its read Archive resolution now follows tasks-axi's own precedence, including $HOME/.tasks-axi/config.toml, through one resolver in fm-tasks-axi-lib.sh. The archive read uses the backlog row read bound, and a bound hit propagates instead of reading as an absent row. The no-toml test pins HOME so the developer's ambient tasks-axi config cannot decide it.
demy00
added a commit
that referenced
this pull request
Oct 16, 2026
## Conflict resolutions The trial merge listed 13 conflicted files; the actual merge also conflicts in `tests/fm-procevent.test.sh` (14 total). | File | Fork origin | Resolution | | --- | --- | --- | | `.agents/skills/agent-skill-trigger-index/SKILL.md` | 09efd59 (#6, clickup-tickets) | Fork's `clickup-tickets` trigger line re-added to upstream's list unchanged. | | `AGENTS.md` | 3843b2c (#8, skill selection); 89e1459 (#3, `feature/` prefix) | Fork's `fm-skill-select.sh --apply` line and the `feature/` default wording re-applied on upstream's new section 7 text (upstream added `--base-branch` and self-repo consent lines next to it; both kept). | | `README.md` | 89e1459 (#3), via earlier fork syncs | Default ship-branch prefix wording stays `feature/` in upstream's rewritten bullet. | | `bin/fm-captain-hold.sh` | 999f9d8 (#1, done-archive evidence) | Fork's done-archive lookup re-applied unchanged on upstream's version. | | `bin/fm-dod-lib.sh` | 89e1459 (#3), 16cc4bd | Upstream's new base-branch/forge/consent code kept; its two `fm/$id` defaults now call `fm_task_branch` and the lib sources `fm-task-branch-lib.sh`, as the fork did before. | | `bin/fm-procevent-lavish.sh` | 826e32b, 79d101b, d0ac8f4, cbfb295 (#7) | True clash, decided by the captain (option A) - see below. | | `bin/fm-spawn.sh` | 89e1459 (#3), 16cc4bd, b7edc11, 153f4e2, de04c2d | Fork's `feature/` branch naming and legacy-brief branch binding re-applied unchanged on upstream's version. | | `bin/fm-timeout-lib.sh` | 9e8b923 (bash without `BASHPID`) | Upstream fixed the same macOS bash 3.2 bug independently (5838f10, kunchenguid#6028, perl watchdog takes the pre-exec parent). Took upstream's code; the fork's regression test for it is kept and passes on upstream's fix. | | `docs/architecture.md` | 89e1459 (#3) | `feature/` default and the `fm-task-branch-lib.sh` ownership line re-applied. | | `tests/fm-brief.test.sh` | 89e1459 (#3), via earlier fork syncs | Expected branch names stay `feature/<id>` in upstream's updated cases. | | `tests/fm-calm-pi-extension.test.sh` | bc3f178 (#10), 1757302 (#8 CI fix) | Upstream fixed the `/reload` geometry flake its own way (`wait_for_geometry_reload` on a durable status row), so the fork's `pipe-pane` version is dropped. Kept the fork's lookup-counting export renderer, the report-based Chrome hang attempt check, and the `tuiMode: regular` settings pin next to upstream's `--tui-mode regular` flag. | | `tests/fm-procevent.test.sh` | #7 | Both test sets kept; see the Lavish decision. | | `tests/fm-review-diff.test.sh` | 89e1459 (#3) | Fork's two unrecorded-`feature/` branch cases re-added; case letters shifted after upstream's new cases. | | `tests/fm-timeout-lib.test.sh` | 9e8b923 | Fork's no-`BASHPID` test kept on top of upstream's tests. | ## Decision: Lavish list-form parser (captain chose option A) Both sides fixed the same bug: Lavish emits queued feedback as a TOON list (not a table) when items carry nested content, and the adapter read it as an empty, complete result. - Fork (#7): one parser that flattens and presents every nested field (table-cell `target:`, `attachments:`, other `fields:`, message uid/selector/text), adds `unpresented_items:`, and refuses `complete: yes` when nested content cannot be parsed. - Upstream (fc8972c, kunchenguid#5404): one parser that skips nested targets and attachments; its tests assert nested content is absent from `read`. It also adds stricter refusals (unrecognized header keeps its declared count and counts as malformed; `answers`/`reconciles` exit 3 when not fully accounted for), and 228b27d renames the message count to `captain_message_count`. Options: - **A (chosen):** keep the fork's presenting parser, port upstream's strictness onto it (declared count + malformed on an unrecognized header, `answers`/`reconciles` exit 3, `captain_message_count`), keep both test sets, and adapt upstream's three "absent" assertions to check nested content appears only under its own labelled section and never replaces the item's own text. Cost: this region will likely conflict again on the next upstream sync. - **B:** take upstream's parser and tests wholesale and drop the fork's nested presentation. Cost: Lavish reads lose table-cell location, text-selection range, and image attachment paths.
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's overnight instruction was: "do not merge anything but any PRs are welcome that are created ... please open PRs but do not merge them. build upon each PRs state expecting that it will be merged. (rebase from the prev PR) you can continue on any project roadmap you find and are set up." Nothing merges tonight; the captain reviews everything tomorrow.
This defect was found by a worker on another task, cp-fe-audit-b2, which hit it while trying to close out completed work. That worker diagnosed it precisely and then deliberately stopped rather than hand-editing firstmate's own data to get past the refusal. That was the correct call, and it is why this task exists instead of a silently corrupted record.
What it hit, in its own words:
complete cp-fe-audit-b2andverifyboth refuse with "no captain-held task cp-admin-portal-brandable and no migrated hold for it". The mechanism it traced:command_completeunions the agent's supplied inventory with the previously attesteddecision_keysrecorded instate/<id>.meta, then re-resolves EVERY entry throughresolve_entryat bin/fm-captain-hold.sh:1554-1565.I verified the premise independently before filing this.
state/cp-fe-audit-b2.metacarriesdecision_keys=cp-admin-portal-brandable,cp-role-delete-semantics. Both captain calls were genuinely answered and closed - cp-admin-portal-brandable on 2026-09-08, cp-role-delete-semantics on 2026-09-09 - and both are recorded[x]done indata/done-archive.mdwith the captain's recorded answers intact. They have since been pruned out ofdata/backlog.md, which is normal retention, sotasks-axi shownow returns NOT_FOUND for each.So the gate wedges on a completely normal lifecycle: answer a captain call, let retention archive it, and every future completion attempt for that origin fails forever. No supported command reaches it -
answerandholdboth require the task to exist, andreconcilerequires a pending board request that does not exist. The blocked worker is a real, current cost: its work is finished and delivered but it cannot attest completion.What Changed
bin/fm-captain-hold.sh: the completion gate (completeandverify) now resolves an inventory entry from the live backlog first and from the markdown done archive second, via newresolve_attested_entry/task_show_durable. An answered captain call that retention pruned out of the backlog no longer refuses with "no captain-held task ... and no migrated hold for it". Only the lookup widens: an archived row closed without a recorded captain answer, or a key naming no row in either place, still refuses with the original message, and a read-bound hit (124) still propagates. Mutating subcommands (hold,answer,reconcile) keep resolving from the live backlog alone.## Archived <date>headings to## Doneand keeps only the newest row block for a reused id, so an older answered row never vouches for a later unanswered close and vice versa.bin/fm-tasks-axi-lib.shaddsfm_tasks_axi_markdown_archive_resolve, which finds the archive with tasks-axi's own precedence:[markdown] archivein the root.tasks.toml, then$HOME/.tasks-axi/config.toml, elsedone-archive.mdbeside the backlog file.tests/fm-captain-hold-lifecycle.test.shadds an archived-answer family driven by tasks-axi's real retention (answered call before and after pruning,--nonere-attestation, bare-doneand unknown-key refusals, archived + live key union, homes with no root.tasks.toml, and reused keys in both directions);docs/captain-hold-lifecycle.mddocuments the archive lookup and its limits.Risk Assessment
✅ Low: The change widens only the read-only completion-gate lookup to the done archive, keeps verify_hold_durable's rule unchanged so unanswered or absent keys still refuse, propagates the 124 read bound, leaves mutating paths on the live backlog, and its archive precedence, newest-row dedup, and heading rename traced correctly against a real tasks-axi archive.
Testing
No baseline commands ran before this step. I ran only the seven archive-related completion-gate tests from the captain-hold lifecycle suite against real tasks-axi 0.2.5 retention, and all passed. I then replayed the intent's scenario end to end with HOME pinned to an empty directory: two answered captain calls pruned into data/done-archive.md, with an origin whose meta carries both decision_keys. On base 259a669,
verifyandcomplete --nonerefuse with the exact reported message. On target 04d802b both succeed, an unknown key is still refused, and the archive file is unchanged after the gate reads it. There is no UI surface, so the evidence is CLI transcripts. The worktree is clean, but a denied cleanup command left two scratch items in /tmp.Evidence: E2E transcript BEFORE fix (base 259a669) - wedge reproduced
Source: E2E transcript BEFORE fix (base 259a669) - wedge reproduced
$ cap verify cp-fe-audit-b2 fm-captain-hold: no captain-held task cp-admin-portal-brandable and no migrated hold for it in this home's configured backlog (data directory <tmp>~); the nearest legacy identity cp-fe-audit-b2-decision-cp-admin-portal-brandable also resolves to nothing [exit 1] $ cap complete cp-fe-audit-b2 --none fm-captain-hold: no captain-held task cp-admin-portal-brandable and no migrated hold for it ... [exit 1]Evidence: E2E transcript AFTER fix (target 04d802b) - archived answered calls resolve
Source: E2E transcript AFTER fix (target 04d802b) - archived answered calls resolve
$ t show cp-admin-portal-brandable error: "Task "cp-admin-portal-brandable" not found in this backlog" code: NOT_FOUND [exit 1] $ grep -n '^- [x] cp-' <tmp>~/done-archive.md 4:- [x] cp-role-delete-semantics - ... (kind: captain) (done 2026-09-21) ... 12:- [x] cp-admin-portal-brandable - ... (kind: captain) (done 2026-09-21) ... $ cap verify cp-fe-audit-b2 verified: cp-fe-audit-b2 captain-call inventory [exit 0] $ cap complete cp-fe-audit-b2 --none complete: cp-fe-audit-b2 captain-call inventory reviewed (cp-admin-portal-brandable,cp-role-delete-semantics) [exit 0] $ cap complete cp-fe-audit-b2 cp-never-existed fm-captain-hold: no captain-held task cp-never-existed and no migrated hold for it ... [exit 1] archive checksum unchangedEvidence: Targeted archive gate tests (7 cases, all ok)
Source: Targeted archive gate tests (7 cases, all ok)
ok - the completion gate accepts an answered captain call pruned into the archive ok - the gate still refuses an archived call with no recorded answer and an unknown key ok - the completion gate unions archived and live inventory and keeps a held call open ok - the gate reads tasks-axi's default archive in a home that configures none ok - the gate reads the archive the user's tasks-axi config names ok - the gate refuses a reused key whose newest archived close recorded no answer ok - the gate accepts a reused key whose newest archived close is answeredPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-captain-hold-lifecycle.test.shrestricted to the 7 archive cases (test_completion_gate_accepts_an_archived_answered_call, _refuses_an_archived_call_with_no_recorded_answer, _unions_archived_and_live_inventory, _accepts_an_archived_answer_without_a_tasks_toml, _reads_the_archive_named_by_the_user_config, _refuses_a_reused_key_whose_newest_archived_close_is_unanswered, _accepts_a_reused_key_whose_newest_archived_close_is_answered) - all ok, against real tasks-axi 0.2.5Manual E2E on base 259a669 (extracted withgit archive): hold + answer cp-admin-portal-brandable and cp-role-delete-semantics,complete cp-fe-audit-b2 <keys>, prune withtasks-axi done filler --keep 0, thenfm-captain-hold.sh verify cp-fe-audit-b2andcomplete cp-fe-audit-b2 --none- both refuse with the exact reported message 'no captain-held task cp-admin-portal-brandable and no migrated hold for it'Same manual E2E on target 04d802b:verifyprints 'verified: cp-fe-audit-b2 captain-call inventory' (exit 0),complete --nonere-attests both archived keys (exit 0), decision_keys preserved in state metaOn target:complete cp-fe-audit-b2 cp-never-existedstill refuses (exit 1) and the done-archive.md checksum is unchanged after the gate reads it✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Observed failures against the unfixed code
The new user-config archive test was run against the code before the fix and failed with the original wedge:
With the fix, the full
tests/fm-captain-hold-lifecycle.test.shsuite passes locally.The original live reproduction (
state/cp-fe-audit-b2.meta) had already been cleaned up from the home by the time this branch was resumed, so it could not be re-run; the synthetic fixtures driven by tasks-axi's own retention stand as the evidence.Failure output from the earlier archived-key tests on this branch was not preserved across the worker restart.