Skip to content

fix: surface fallback/quota failures to prevent opencode from hanging indefinitely#139

Open
win0na wants to merge 7 commits intogriffinmartin:mainfrom
win0na:fix/visible-fallback-on-limits
Open

fix: surface fallback/quota failures to prevent opencode from hanging indefinitely#139
win0na wants to merge 7 commits intogriffinmartin:mainfrom
win0na:fix/visible-fallback-on-limits

Conversation

@win0na
Copy link
Copy Markdown

@win0na win0na commented Apr 6, 2026

Summary

  • fixes Show quota limit #115 & Hangs when limits have been reached #168
  • surface generic 429, 503, and 529 Anthropic API failures immediately so upstream fallback can take over instead of the plugin masking those failures and hanging behind its own retry path
  • keep plugin-owned recovery bounded by retrying a 401 credential refresh only once, adding request timeouts for hung outbound auth and metadata fetches, and aborting stalled successful SSE streams after the idle timeout
  • add and update coverage for fallback handling, request timeout behavior, and stalled stream handling, and update the README plus changelog to document the timeout and fallback behavior

Related issue

N/A.

Testing

  • make all
  • CI=true pnpm test
  • pnpm test
  • pnpm run build
  • CI=true pnpm exec node --test --experimental-strip-types --test-name-pattern "auth loader aborts hung outbound fetch within request timeout|auth loader preserves caller abort signal over request timeout" src/index.test.ts
  • node --test --experimental-strip-types src/index.test.ts --test-name-pattern "auth loader surfaces generic 429 immediately for upstream fallback|auth loader surfaces 503 immediately for upstream fallback|auth loader surfaces 529 immediately for upstream fallback|auth loader retries once on 401 before surfacing terminal failure"
  • node --test --experimental-strip-types src/transforms.test.ts --test-name-pattern "transformResponseStream errors stalled SSE stream after idle timeout|transformResponseStream continues streaming when boundaries arrive before timeout|transformResponseStream passes 429 errors through intact"

Checklist

  • PR title follows Conventional Commits (feat:, fix:, docs:, chore:, etc.)
  • make all passes locally (runs lint, build, and test)
  • Tests added or updated where applicable
  • README or docs updated where applicable

@win0na win0na force-pushed the fix/visible-fallback-on-limits branch from e735749 to 36a0bf9 Compare April 6, 2026 21:17
@win0na win0na changed the title feat: surface fallback failures and bound stalled requests fix: surface fallback/quota failures to prevent opencode from hanging indefinitely Apr 7, 2026
@win0na
Copy link
Copy Markdown
Author

win0na commented Apr 9, 2026

The above commits fix the linting & CI build issues that were present, & update the CHANGELOG.md to reflect the latest version.

@tim-hilde
Copy link
Copy Markdown

Would solve #115 and #168

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.

Show quota limit

2 participants