Skip to content

fix(bin): substitute parentheses in decision-hold reasons - #16

Merged
Hozzy02 merged 2 commits into
mainfrom
fm/fm-decision-hold-parens
Sep 25, 2026
Merged

Hozzy02 merged 2 commits into
mainfrom
fm/fm-decision-hold-parens

Conversation

@Hozzy02

@Hozzy02 Hozzy02 commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Intent

Bug seen 2026-09-25: bin/fm-decision-hold.sh hold ... --reason "...(merged PRs 5, 6)..." failed with 'reason must not contain parentheses (tasks-axi hold contract)', forcing callers to rephrase. Make the script safely encode or substitute parentheses (e.g. to square brackets) before handing the reason to tasks-axi, so natural wording works, and say so in the script's help. Add colocated tests. Do not change tasks-axi. Decisions: substitute ( -> [ and ) -> ] in the reason only (tasks-axi reserves parentheses for markdown hold tags; verified tasks-axi accepts square brackets in --reason); the title is out of scope. Help is the script header comment printed by --help. The regression test lives in tests/fm-decision-hold-lifecycle.test.sh and exercises real tasks-axi; it deliberately does not assert the help text because help is printed from source comment bytes and repo rules forbid asserting source bytes. Repo rules: never add an agent name as a commit co-author; commit subject plus at most 3 body lines; PR description at most 5 lines plus footer.

What Changed

  • bin/fm-decision-hold.sh hold no longer rejects a --reason that contains parentheses. It now turns ( into [ and ) into ] in the reason only, before passing it to tasks-axi. The --help header describes the substitution, and tasks-axi is unchanged.
  • Added a regression test, test_parenthesized_reason_is_substituted_for_tasks_axi, to tests/fm-decision-hold-lifecycle.test.sh. It runs against the real tasks-axi and checks that the reason is stored with square brackets and that an exact retry is idempotent.
  • docs/decision-hold-lifecycle.md records this verification and its test output line.

Risk Assessment

✅ Low: This is a small, bounded change. The script now turns ( and ) into [ and ] in the hold reason instead of rejecting them. The title and tasks-axi are unchanged. The help text documents the change, and a colocated test runs it against real tasks-axi, including an idempotent retry.

Testing

I ran the decision-hold lifecycle test file against the real tasks-axi and all 13 cases passed. That includes the new regression case: a reason like "(merged PRs 5, 6)" is now accepted and stored as "[merged PRs 5, 6]", and retrying the same hold works. The existing cases for hold, resolve, completion and teardown also still pass. I checked by hand that --help prints the new explanation, and saved the test log and the help output as evidence. This is a CLI change with no UI, so there are no screenshots. The working tree is clean.

Evidence: Lifecycle test transcript (real tasks-axi)

ok - hold substitutes reason parentheses with square brackets for tasks-axi

ok - report-only unresolved decision is reproduced and completion refuses before loss
ok - non-forced scout teardown always requires durable inventory verification
ok - a declined decision closes with a recorded answer and no routed work
ok - a decision closed outside the script is repairable and then clears teardown
ok - an unanswered decision still blocks completion and resists both unrouted close paths
ok - captain holds are idempotent, distinct, teardown-safe, Bearings-visible, and durably routed before close
ok - completion and verification validate origins before constructing paths
ok - ended visual review follows the same decision-hold completion owner
ok - resolved findings and decision-like prose do not create false holds
ok - terminal single-owner stale status decisions do not block empty inventory
ok - main-home and secondmate-home captain holds remain correctly routed
ok - resolve matches first/middle/last in quoted blocked_by and rejects a genuinely absent id
ok - hold substitutes reason parentheses with square brackets for tasks-axi
Evidence: fm-decision-hold.sh --help output

hold accepts natural --reason wording: because tasks-axi reserves parentheses for markdown hold tags, it substitutes ( and ) with [ and ] before handing the reason over, so "(merged PRs 5, 6)" is stored as "[merged PRs 5, 6]".

fm-decision-hold.sh - deterministic mechanics for durable captain decisions.

The semantic policy is owned once by
.agents/skills/decision-hold-lifecycle/SKILL.md. This script never reads report,
visual-review, chat, or terminal prose to guess whether a decision exists.
The invoking agent inventories unresolved decisions, assigns stable keys, and
routes dependent work. This script supplies deterministic identities, creates
and verifies structured tasks-axi captain holds, records completion attestation
in the originating task's metadata, and requires a durable captain decision
record before it closes or repairs a hold.

A hold identity is <origin-id>-decision-<decision-key>. Origin ids and decision
keys must already be privacy-safe slugs. Repeating `hold` with the same identity
is idempotent. A different decision key creates a different backlog identity.
All backlog mutations run in the active FM_HOME, which keeps main-home and
secondmate-home ownership aligned with the work that discovered the decision.

Usage:
  fm-decision-hold.sh id <origin-id> <decision-key>
  fm-decision-hold.sh hold <origin-id> <decision-key> \
    --title <title> --reason <reason> [--repo <repo>]
  fm-decision-hold.sh complete <origin-id> (--none | <decision-key>...)
  fm-decision-hold.sh verify <origin-id>
  fm-decision-hold.sh resolve <origin-id> <decision-key> \
    --decision-file <path> --routed-to <task-id> [--routed-to <task-id>...]
  fm-decision-hold.sh decline <origin-id> <decision-key> --decision-file <path>
  fm-decision-hold.sh repair <origin-id> <decision-key> --decision-file <path>

`hold` accepts natural --reason wording: because tasks-axi reserves parentheses
for markdown hold tags, it substitutes `(` and `)` with `[` and `]` before
handing the reason over, so "(merged PRs 5, 6)" is stored as "[merged PRs 5, 6]".

`complete` is the shared investigation and visual-review completion gate.
`--none` is an explicit semantic attestation that the just-reviewed surface has
no unresolved captain decision. Later review passes may add keys; a live task's
metadata inventory is unioned idempotently. A post-teardown visual review can
complete against the surviving report and holds without recreating task state.
`verify` is read-only and is called by scout teardown so teardown cannot erase a
source before this gate has succeeded.

`resolve` and `decline` close active holds; `repair` attests a hold already closed
outside this script. All three paths require a non-empty captain decision file of
at most 8192 bytes, record the same durable resolution block in the hold body, and
store the decision digest plus routed identities so an exact retry is idempotent
while a changed decision or, for `resolve`, routed set is rejected. New records
include a `Resolution mode:` naming their path; older routed records remain valid.

`resolve` is the routed path. It requires every --routed-to task to exist and to
be blocked by the hold. It writes the captain decision and routed identities into
the hold body, clears those dependency edges, and only then marks the hold Done.
A failure before the final step leaves the captain hold open.

`decline` is the unrouted path for a decision the captain answered with no
follow-up work. It takes no --routed-to task, records `(none)` as the routed
identities, and closes an actively held hold. It refuses while any task is still
blocked by the hold, because releasing routed work without recording it is
`resolve`'s job.

`repair` records the missing resolution block on a hold that was already closed
outside this script, so `verify` stops failing on an origin whose decision was
genuinely answered. It never reopens a hold, never clears a dependency edge, and
refuses a hold that is still actively held, so an unanswered decision keeps
blocking teardown until `resolve` or `decline` closes it with the captain's word.
It also refuses an identity that does not carry surviving captain-hold
provenance, so an ordinary captain-kind task cannot be repaired into a decision.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-decision-hold-lifecycle.test.sh (all 13 lifecycle cases pass with exit 0, including the new test_parenthesized_reason_is_substituted_for_tasks_axi)
  • Checked that the new test runs a hold with the reason "captain follow-up (merged PRs 5, 6) pending" through the real /opt/homebrew/bin/tasks-axi and that tasks-axi show reports hold_reason: &#34;captain follow-up [merged PRs 5, 6] pending&#34;, including an idempotent retry
  • bin/fm-decision-hold.sh --help (checked by hand that the header now describes the ( → [ and ) → ] substitution)
  • Reviewed git diff a0c8f92 d24ccd6: only bin/fm-decision-hold.sh and its colocated test changed, tasks-axi was not touched, and the substitution applies to the reason only
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@Hozzy02
Hozzy02 merged commit 1525c5c into main Sep 25, 2026
13 checks passed
@Hozzy02
Hozzy02 deleted the fm/fm-decision-hold-parens branch September 26, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant