Skip to content

_failure_haystack's recognised field set is assumed exhaustive, and the fallback that would cover a new one cannot fire #320

Closed

Description

@fdaviddpt

The assumption

_failure_haystack (added in #318) scans the fields the CLI authors — error / result / message, the errors list, plus stderr — and falls back to the raw stdout scan when nothing structured was found.

That fallback is guarded by if not authored:, which requires every recognised field to be empty. So the failure mode is narrower than the guard suggests: if the CLI ever reports an auth failure in some new diagnostic field while result or errors holds something benign and unrelated, authored is non-empty, the fallback never fires, and the auth text is invisible.

The consequence is the one this whole area keeps producing: the un-isolated retry does not happen, capture fails permanently, and nothing says why. #316 exactly.

What is and is not established

  • Not a present defect. Found by an adversarial review of _AUTH_FAILURE_MARKERS is substring-scanned over the child's stdout, so summarized session content can decide when hook isolation is dropped #318's own commit. Every input that reproduces it uses a fictional field name (hint, error.detail, raw_stderr_capture). The real terminal-record schema has no such field — cross-checked against _failure_detail (haiku.py:222), which independently arrived at the same error/result/message set, and against the CLI's measured output. For a genuine auth failure specifically, result cannot carry model-authored text at all, because auth fails before any model turn runs.
  • Nothing guards the assumption. No test asserts the field set is exhaustive, and no comment records that it is an assumption rather than a fact. If it stops being true, it stops silently.

The same review found no fail-open path (authored is always a subset of what the old scan read), no crash across bare JSON scalars, empty lists, null last elements, depth-2000 nesting, a 5 MB string field, non-list errors and NaN tokens, and no overclaim in the docstring.

Direction

This is _AUTH_FAILURE_MARKERS' own caveat one layer down — "a list of spellings is never finished" — now applying to a list of field names. Options, in the order I would try them:

  1. A test pinning the recognised set against measured CLI output, so a schema change breaks a test rather than a user's capture.
  2. Widen the fallback: scan the raw blob in addition to the authored fields whenever the authored text contains no marker. That restores the old sensitivity while keeping the conversation out of the decision — the un-isolated retry would once again be reachable from arbitrary content, so this needs thought rather than a reflex.
  3. Leave it and note it. Defensible, given the schema is verified today.

Not urgent. Filed so the assumption is written down somewhere other than a reviewer's memory.

Activity

  1. added
    priority:low
    on Aug 7, 2026
  2. added a commit that references this issue on Aug 8, 2026
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

    priority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions