You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Astro-Han (via GitHub)" <gi...@apache.org> on 2026/09/14 23:54:36 UTC
[PR] fix(runtime): retry bare rate limits with bounded local backoff [maka]
Astro-Han opened a new pull request, #5318:
URL: https://github.com/apache/maka/pull/5318
## Summary
A 429 with no `Retry-After` failed the Turn immediately. `retryMetadataFromFacts` returned `retryable: false` for `rate_limit` unless the provider named a delay, and did not honor the AI SDK's own `isRetryable`. In an archived Runtime the commandcode gateway answered `429 {code: 'rate_limit_error', message: 'Upstream model provider is temporarily unavailable. Please try again in a moment.'}` with no header, and the Turn ended on the first request with `retry: {decision: 'declined', because: 'policy'}`.
The classifier stays the single authority for retryability; the Turn loop only consumes its decision, and that loop is already bounded (10 provider attempts per step, 1s→32s exponential backoff with jitter, SDK `maxRetries: 0`). A throttle with no named delay now uses the rule `provider_capacity` already uses: retryable, carrying `retryAfterMs` only when the header parses, otherwise the adapter's local backoff. No new retry layer is added in the Turn loop or in `@maka/eval`.
#3115 introduced the "no `Retry-After`, no retry" rule because OpenCode Zen's `FreeUsageLimitError` (HTTP 429, `error.type: 'FreeUsageLimitError'`) was retried ten times. That is an exhausted free allowance, not a throttle. It now joins `PROVIDER_BILLING_PROVIDER_CODES`, classifies as `provider_billing`, and stops on the first attempt regardless of status, the same way `insufficient_quota` does. The visible retry Banner #3115 added still shows every scheduled wait.
The numeric `status === 429` fallback in the retry branch is dropped: the classifier already maps a 429 status or code to `rate_limit` unless stronger structured evidence wins, and keeping the raw status would have overridden `provider_billing`'s fail-fast on a 429.
Unchanged: aborts, Codex edge rejections (transport budget already spent), `provider_billing`, `auth`, and `context_overflow` stay non-retryable; 408 / 409 / 5xx keep their existing rule. No change to eval, automation, models, prompts, or tools.
## Verification
- `npm --workspace @maka/runtime run build`, then in `packages/runtime` `node --test --test-concurrency=4` over the `provider-error-classification`, `model-adapter`, `model-adapter-onerror`, `provider-request-telemetry`, and `ai-sdk-backend` dist suites: 340 passed, 0 failed.
- With the source change reverted, `provider-error-classification.test.js` fails 3 of 19 (bare 429 retryable, malformed `Retry-After` retryable, `FreeUsageLimitError` as billing).
- New backend regression `retries a gateway rate limit that names no retry delay`: the mock model throws the production-shaped bare 429 once, the Turn emits `provider_retry` scheduled/started with reason `rate_limit`, the second request completes with `end_turn`, and no `error` event is emitted.
- `npm run format` and `npm run lint` clean.
- Confirmed the `FreeUsageLimitError` shape against the OpenCode Zen handler source (`error.type`, not `error.code`); `collectStructuredCodes` reads both. No `docs/` or README text described the old rule.
- Not run: repository-wide tests, paid provider calls, benchmark reruns.
## AI use
Select exactly one:
- [ ] No generative tool made a substantive contribution
- [x] Generative tooling made a substantive contribution
Tool(s) and scope: Claude Code diagnosed the archived failure, implemented the classifier change and tests, and ran the verification.
## Checklist
- [x] Tests cover the change and fail without it
- [x] Lint, format, typecheck and the affected suites pass locally
Does this PR entail a change in behavior?
- [x] Yes — described under Summary above
- [ ] No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): derive model retryability from the failure kind alone [maka]
Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #5318:
URL: https://github.com/apache/maka/pull/5318#issuecomment-5673966236
**Retraction of the P3 in my review** (`@kabi-opus`, automated agent review, shared account).
In [my review](https://github.com/apache/maka/pull/5318#pullrequestreview-5204781201) I reported as a P3 that two behaviour changes — 409 no longer being retried, and a malformed `Retry-After` no longer vetoing an otherwise-retryable class — were not disclosed in the description. **That is false, and I withdraw it.**
Both are in the description's "Behavior changes" list, items 2 and 4, and the 409 entry carries a fuller rationale than the test comment I cited: it notes that the upstream AI SDK's `APICallError.isRetryable` treats 409 as retryable, that this repository has no path producing a 409 and no test that pinned the old behaviour, and that it therefore follows the table.
The description's edit history shows its last revision preceded my review by over an hour, so this is not a case of the text arriving late — I asserted that something was missing from a document I had not read. Everything else in my review came from reading the diff, the tests and the built output; this one claim was a negative about the description itself, and a negative claim needs the same verification as a positive one. I did not give it any.
The rest of the review stands as published. With this P3 withdrawn, my scope reports no findings at all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): derive model retryability from the failure kind alone [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han merged PR #5318:
URL: https://github.com/apache/maka/pull/5318
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org