Skip to content

fix(native-retry): retry transient Zen throttle-403 on the native client path - #23

Merged
MotionDevLab merged 1 commit into
mainfrom
fix/native-zen-403-retry
Oct 10, 2026
Merged

MotionDevLab merged 1 commit into
mainfrom
fix/native-zen-403-retry

Conversation

@MotionDevLab

Copy link
Copy Markdown
Owner

Summary

  • Native-path mirror of fix(openai-shim): retry transient throttle-403 with backoff countdown #22: one additive shouldRetry branch 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 session 31a0ec35.
  • Reuses isTransientThrottleMessage (now exported, not forked); Zen-URL gate over x-opencode-request-url + OPENAI_BASE_URL + ANTHROPIC_BASE_URL; Go-quota / quota-exhausted excluded; everything else falls through unchanged.

Impact

  • user-facing impact: Zen-lane transient 403s now back off with the existing retry countdown instead of killing the turn with generic "Authentication failed (status 403)".
  • developer/maintainer impact: +58 src lines in withRetry.ts (two helpers + branch), one-word export change in openaiErrorClassification.ts, 9 new mirror tests; single cherry-pickable commit.

Testing

  • I ran the required local preflight.
  • exact commands and results: bun run build green; bun run smoke green; focused 3-file suite 173 pass / 0 fail; 11-file related net 452 tests → 451 pass / 1 fail; bun run typecheck:type-tests pass; bunx eslint clean on all three changed files.
  • focused tests: withRetry.test.ts (9 new: 3 retry-with-countdown, 5 terminal-attempts===1, 401 unchanged), openaiErrorClassification.test.ts, errors.openaiCompatibility.test.ts.
  • documented skipped checks, platform limitations, or verified pre-existing failures: bun run typecheck output byte-identical to pristine main (12 pre-existing src/ink/* errors, verified via stash). Full-suite local failures all verified identical on a built pristine-main worktree (54 pass / 8 fail, same set): 4× openclaude-bin-compile-cache launcher spawns, 3× openclaude-bin-heap launcher timeouts, 1× bughunter non-git-dir timeout, plus the openaiShim pre-header-timeout test — all spawn/timing-environmental, none touch retry code.

Notes

…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).
@MotionDevLab
MotionDevLab merged commit a4222ce into main Oct 10, 2026
5 checks passed
@MotionDevLab
MotionDevLab deleted the fix/native-zen-403-retry branch October 10, 2026 22:55
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.

1 participant