Description
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 sameerror/result/messageset, and against the CLI's measured output. For a genuine auth failure specifically,resultcannot 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:
- A test pinning the recognised set against measured CLI output, so a schema change breaks a test rather than a user's capture.
- 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.
- 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
fix(#320): a marker outside the scanned field set no longer reads as …