Repository navigation
fix(native-retry): retry transient Zen throttle-403 on the native client path - #23
Merged
Merged
Conversation
…ent path Unmarked 403s from the Zen lane travel the native Anthropic client, so the shim-only marker branch never fires for them. Add one additive shouldRetry branch (after the marker branch, before the CCR bypass): status 403, no marker, not Go-quota, not quota-exhausted, Zen-URL gated (x-opencode-request-url, OPENAI_BASE_URL, ANTHROPIC_BASE_URL), and the SDK-unwrapped body matches the reused isTransientThrottleMessage. All else falls through unchanged: isRetryableRoutedModelError, 401, Go-quota suites, analytics mapping untouched. Design + DoD: docs/openclaude/issues/2026-10-10-zen-403-audit.md (Second-patch implementation record). Tests: 9 new mirror tests in withRetry.test.ts (3 retry w/ countdown, 5 terminal attempts===1, 401 unchanged); focused 173 pass / 0 fail; typecheck byte-identical to pristine main; build green; related net 451 pass / 1 pre-existing fail (also fails on pristine main).
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.
Summary
shouldRetrybranch retrying transient Zen throttle-403s that arrive via the native Anthropic client (unmarked, SDK-prefixed bodies), which the shim-only marker branch never sees — zero retry POSTs around the 20:29:52Z turn-death of session31a0ec35.isTransientThrottleMessage(now exported, not forked); Zen-URL gate overx-opencode-request-url+OPENAI_BASE_URL+ANTHROPIC_BASE_URL; Go-quota / quota-exhausted excluded; everything else falls through unchanged.Impact
withRetry.ts(two helpers + branch), one-word export change inopenaiErrorClassification.ts, 9 new mirror tests; single cherry-pickable commit.Testing
bun run buildgreen;bun run smokegreen; focused 3-file suite 173 pass / 0 fail; 11-file related net 452 tests → 451 pass / 1 fail;bun run typecheck:type-testspass;bunx eslintclean on all three changed files.withRetry.test.ts(9 new: 3 retry-with-countdown, 5 terminal-attempts===1, 401 unchanged),openaiErrorClassification.test.ts,errors.openaiCompatibility.test.ts.bun run typecheckoutput byte-identical to pristine main (12 pre-existingsrc/ink/*errors, verified via stash). Full-suite local failures all verified identical on a built pristine-mainworktree (54 pass / 8 fail, same set): 4×openclaude-bin-compile-cachelauncher spawns, 3×openclaude-bin-heaplauncher timeouts, 1× bughunter non-git-dir timeout, plus theopenaiShimpre-header-timeout test — all spawn/timing-environmental, none touch retry code.Notes
muse-spark-1.3-contributor-freevia local proxy); tests simulate native SDK error shapes ("403 " + JSON).--debugnative-403 body at the next occurrence to confirm the unwrap logic against the real shape; upstream Empty-body / throttle-phrased HTTP 403 misclassified as fatal auth failure — turn dies without retry Twigpine/openclaude#2266 is shim-only context, untouched.