Skip to content

fix: keep the OAuth token for the nested call, and report why it failed (#131, #129) - #152

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/129-131-haiku-auth-diagnostics
Jul 25, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/129-131-haiku-auth-diagnostics

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Closes #131 and #129.

Two bugs 70 lines apart in pipeline/haiku.py, one hiding the other. Shipped together deliberately: fixing #131 alone would leave the next auth failure equally undiagnosable, and the reporters could only identify #131 after patching #129.

#131 — the credential shares a prefix with the thing being stripped

_child_env() strips the CLAUDE_CODE_* family as parent-session identity (#95). But that prefix is a proxy, not a definition — and CLAUDE_CODE_OAUTH_TOKEN is the child's credentials. So for anyone who authenticated with claude setup-token, or who runs under a hosted Agent SDK, every nested summarization call went out unauthenticated and failed: nothing ever saved, for the entire install.

Kept via an explicit allowlist; the rest of the family is still stripped, and a test pins both halves.

#129 — the failure was on the other stream

--output-format json makes the CLI report errors as a JSON object on stdout, leaving stderr empty. The error path read only stderr, so every failure logged as:

claude exited 1:

…and stopped. That is what hid a 7-week auth outage from the reporter.

The message is now recovered from stdout — structured field first (error / result / message, including nested .message), raw text as fallback, stderr appended when present, capped at 500 chars so a large payload isn't dumped into the log on every failure. When both streams really are empty it now says (no output on stdout or stderr) rather than trailing off after the colon.

Tests

Six new tests; four of them fail on main. 531 passed.

@fdaviddpt
fdaviddpt force-pushed the fix/129-131-haiku-auth-diagnostics branch from f4a10a0 to fe561bd Compare July 25, 2026 15:17
…ed (#131, #129)

Two bugs 70 lines apart in pipeline/haiku.py, one hiding the other. Shipped
together because fixing #131 alone would leave the next auth failure equally
undiagnosable — the reporters could only identify #131 after patching #129.

(#95), but the prefix is a proxy, not a definition. CLAUDE_CODE_OAUTH_TOKEN is
the child's credentials, so every nested summarization call from a setup-token
or hosted-Agent-SDK install went out unauthenticated and failed — nothing ever
saved. Keep it via an explicit allowlist; the rest of the family is still
stripped.

leave stderr empty, but the error path read only stderr. Every failure logged
as "claude exited 1:" and stopped there, which hid a 7-week auth outage. Recover
the message from stdout — structured field first, raw text as fallback, capped
at 500 chars so a large payload isn't dumped on every failure — and say "no
output on stdout or stderr" outright instead of trailing off.

Four of the six new tests fail on main.

Co-Authored-By: Max <noreply>
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.

_child_env strips CLAUDE_CODE_OAUTH_TOKEN along with session vars, breaking nested claude -p auth for setup-token users

1 participant