Repository navigation
Conversation
…no marker `_failure_haystack` scans error/result/message, the errors list and stderr, and falls back to the raw stdout scan only `if not authored` — which needs every recognised field to be empty. A terminal record carrying an auth failure in a field it does not read, while one it does read holds something benign, was scanned, found clean, and reported as "not an isolation problem": the un-isolated retry never runs and nothing says why. #316 through the field set instead of the spelling list. The haystack is deliberately not widened. Scanning the raw blob whenever the authored text holds no marker hands the retry decision back to conversation content for essentially every non-auth failure, which is the whole of what #318 closed. Three states instead of two: a marker in an authored field retries, no marker anywhere is silence, and a marker in the terminal record outside the scanned set declines and says so — naming the token, the field, the set that was read, and what to do. Scoped to the terminal record only, so assistant content cannot make the notice fire on every ordinary network failure. The field set is now a named constant pinned by a test. Co-Authored-By: Max <noreply>
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.
Closes #320
The assumption that was never pinned
_failure_haystackscans a fixed set of fields on the terminal record. The set was three string literals inside a loop — never named, never asserted, and documented as something it is not: the docstring claimed the fallback covers unrecognised payloads, and it does not when a recognised field is non-empty.So a deciding token arriving in a field nobody listed reads as no marker present, which is the same render as a genuinely clean record. The classic shape here: an absence produced by the scan, read as an absence in the world.
Verified before building: the issue's own claim that this is not a present defect holds — today's terminal-record schema has no unrecognised diagnostic field. Fixed anyway, because nothing stopped the next schema addition from reintroducing it silently.
Three states, not a wider net
The issue offered widening the fallback — re-scan the raw payload when the authored text holds no marker. Rejected, and this is the judgment call worth reading:
on a failing call the authored fields hold no marker in the ordinary case. So that branch re-enables the full raw scan for essentially every non-auth failure, and the conversation regains the un-isolated-retry decision — which is the entirety of what #318 closed.
Instead: retry / silence / decline and say so. On "no marker found",
_marker_missed_by_the_scanre-reads only the record's unrecognised keys, and if a deciding token sits there it emits a warning naming the token, the field, the scanned set and the fix — then returnsFalseunchanged. It reports; it does not decide.Scoped to the terminal record's unrecognised keys and deliberately not to the conversation: otherwise the notice fires on every ordinary network failure in a session that happened to discuss a login problem, and a warning that fires on the common case stops carrying information.
unknown optionis covered alongside the auth markers — same scan, same decision, same blindness.Tests
RED, before the implementation:
The four passing are controls that must hold against the unfixed code.
GREEN, full suite:
Platform
Pure
str/json— no paths, no separators, nosubprocess, no platform-divergent exception types.pipeline/haiku.pycarriesfrom __future__ import annotations, so the newtuple[str, str] | Nonereturn annotation is not evaluated on the 3.9 floor, andtests/test_pep604_floor_guard.pypasses.Green on macOS. Windows and the 3.9 leg unverified locally — CI is the check.