Skip to content

fix(claude-sdk-oauth): classify successful error results - #1223

Open
Altairpaca wants to merge 1 commit into
code-yeongyu:mainfrom
Altairpaca:campaign/1169-sdk-result-error
Open

fix(claude-sdk-oauth): classify successful error results#1223
Altairpaca wants to merge 1 commit into
code-yeongyu:mainfrom
Altairpaca:campaign/1169-sdk-result-error

Conversation

@Altairpaca

@Altairpaca Altairpaca commented Aug 31, 2026

Copy link
Copy Markdown

Problem

Claude SDK terminal results may report subtype: success while is_error: true; ambient streams then surface a successful assistant response and managed OAuth fallback is bypassed.

Root cause

The result boundary classified success only by subtype and did not share one failure classifier across ambient, managed, and resident paths.

Invariant

Any SDK result with is_error: true must be terminal failure regardless of subtype. Ordinary success must remain successful, and rate-limit metadata must remain available to account failover.

Changes

  • Centralized SDK result failure classification with HTTP status and terminal-reason details.
  • Applied it to ambient streaming, managed OAuth failover, and resident session settlement.
  • Preserved resident retry checkpoints without synchronizing failed turns.

RED -> GREEN

RED: the injected success + is_error: true regression was emitted with stopReason: stop.
GREEN: the regression and affected OAuth suites pass; 83 tests passed in the final focused wave.

Real-surface verification

The real SDK stream boundary is exercised through the repository SDK boundary override with a documented terminal-result payload; no credentials or network calls are used.

Regression coverage

Added test/suite/regressions/1169-claude-sdk-oauth-result-error.test.ts and exact managed failover coverage for HTTP 429 plus blocking_limit.

Risks / residuals

Provider-specific terminal prose remains classified by the existing failover policy. Full repository build typecheck is host-limited because this machine runs Node 22 while the repository requires Node 24 and exposes unrelated workspace export-resolution failures.

Non-goals

No changes to provider credentials, SDK versioning, retry budgets, or ordinary successful-result rendering.

Fixes #1169

Fixes code-yeongyu#1169

Ultraworked with [omo](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
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.

Claude SDK ambient 429 result with success subtype bypasses model fallback

1 participant