Skip to content

Decision-hold gate: a headings-only wiped backlog still reads as a trimmed hold #87

Open

Description

@EvanAgee

The decision-hold completion gate (bin/fm-decision-hold.sh verify/complete) tolerates a hold that is gone from the backlog only when the answer is durably recorded. To avoid trusting a NOT_FOUND that actually means the backlog is destroyed, backlog_is_intact checks that data/backlog.md is present, non-empty, and carries a Done heading before it trusts the "hold was trimmed" verdict.

That check is not strong enough for one residual case, which the shipping PR deliberately left open by decision.

Residual gap

A backlog wiped down to nothing but its section headings still passes backlog_is_intact (present, non-empty, has a Done heading). So the archival tolerance still fires and verify returns success even though every task entry, including the scout origin itself, was lost.

Reproduced against the real script in an isolated FM_HOME (real tasks-axi + jq): create a scout origin, open a keyed decision, register the hold, complete it, record a genuine answered: resolve line, then replace data/backlog.md with just its section headings. Verify passes, which would let teardown delete the source with no durable record of the decision left anywhere.

This is a fail-safe gap on catastrophic backlog loss, not a normal path. It does not affect the accepted behavior (an archived answered hold passes; a genuinely open, unanswered, never-registered, self-closed, or non-answered hold still fails).

Suggested direction

Prove the backlog still contains the origin's own entry (or a real task entry), not just headings, before trusting a NOT_FOUND as a single trimmed hold. A cheap check that data/backlog.md holds at least one real task line under a section, or that the origin id itself still appears, would close it. Judge cost against how reachable a headings-only wipe actually is.

Context

Surfaced during the review loop on PR for the archived-hold verify tolerance. The core fix and the other integrity guards (metadata-membership proof that a hold once existed, the answered: captain-answer marker, last-transition semantics, NOT_FOUND-only absence, non-empty backlog, and a relaxed Done-heading matcher) all shipped. This one edge case was banked by decision to avoid an eighth-plus fix pass.

Activity

  1. EvanAgee commented on Sep 1, 2026

    @EvanAgee
    OwnerAuthor

    Second residual: the answered: status marker is not written on the normal chat-answer flow

    Banked from the same review loop, by decision, to stop the fix loop. This one is more consequential than the headings-only wipe and should be looked at first.

    The gap

    The archival tolerance in verify_reviewed_hold passes an absent hold only when status_key_answered finds a resolved [key=<k>]: answered: ... line in the status log. The review argues that on the documented decision flow this line is never written, so the tolerance is either unreachable or is being satisfied by the metadata-membership gate alone without real answer evidence.

    The documented order is: hold -> complete -> captain answers -> hold Done -> retention trims -> verify.

    • complete appends captain-held [key=<k>]: tracked by <hold-id> for every still-open reviewed key. The fold in bin/fm-classify-lib.sh treats captain-held as closing the key, so after complete the status log no longer owns that key as open.
    • When the captain then answers with fm-send --resolve-key, fm-send splits keys: fm_send_close_resolved_keys writes the resolved [key=X]: answered: ... status line only for keys the status log still OWNS (RESOLVE_STATUS_KEYS); a key that now names an active captain hold instead goes through fm_send_feed_resolved_holds, which closes the hold in the backlog body and writes NO status line.
    • Because complete already fold-closed the key, the answer takes the hold path, so no answered: status line is written. The durable answer lives only in the hold's backlog body ("Resolution recorded by fm-decision-hold."), which is exactly what retention later deletes.

    Why it matters

    Two possibilities, both bad, and this needs a clean end-to-end verification against the real fm-send (not a fixture with a stubbed watcher):

    1. If the tolerance truly never fires, the original bug (archived answered hold blocks scout teardown) is not actually fixed on the real flow, only in tests that hand-write the answered: line.
    2. If verify passes an absent hold anyway (observed in a contaminated local probe where fm-send failed to deliver), then the metadata-membership gate is passing an absent hold WITHOUT the answered: evidence, which would be a fail-open.

    Every regression test that passes today hand-writes the answered: line into the status log and does not run complete before the answer, so the suite does not exercise the real hold -> complete -> fm-send answer -> archive order.

    Suggested direction

    Verify the real order end-to-end against the actual fm-send. Then either:

    • make the durable answer proof survive archival on the real path (e.g. complete's captain-held transfer, or the hold-close path, records an answer marker in the status log that status_key_answered recognizes), or
    • have status_key_answered recognize the captain-held transfer plus a subsequent real hold-close as answer proof in a way that cannot be forged by a scout self-close, or
    • accept that the direct-answer/archived case must use the existing repair path and document that the chat-answer path needs the status marker to be written at answer time.

    Confirm with a test that runs the true production order, not a hand-written answered: line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions