feat: quota-aware subagent model fallback chain (#374)#391
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Ingwannu
left a comment
There was a problem hiding this comment.
The requested fallback behavior is valuable, but the current implementation can repeatedly select an exhausted model or select against the wrong account. The unresolved findings are substantive: 429/402 are not classified, routed failures are cached under a different key than the configured slug, selection runs before pool account resolution and uses the main plan for pool accounts, native health is not account-scoped, the normal SSE path does not record failures, and combo/encrypted child paths can be rewritten incorrectly. Please rebuild the selection at the resolved routing/account boundary, validate configuration atomically, make the tests independent, resolve the current dev conflict, and re-request review.
4fc8a1d to
d4d5b1a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Ensure fallback selection skips stale provider-prefixed entries while still allowing valid raw vendor/model slugs, and cache native slug lookups so selection no longer times out under test load.
🔒 Under maintainer review — detailed feedback incoming@lidge-jun (maintainer) has this PR in an active review pass. Please do not merge or close This PR is not part of the current integration batch. It is held back deliberately — Heads-up on rebasing: No action needed from you until then. Thanks for the contribution and for your patience. Review tracker: |
|
Thank you for the substantial quota-aware subagent fallback work. I found three correctness blockers that need to be resolved before merge.
I appreciate the scope of this feature. The refresh must be truly awaited, settings updates must be atomic, and generic rate limits must participate in the same health block before the fallback chain is reliable. Please also rebase onto current Reviewed as part of a maintainer integration pass. |
Ensure fallback selection skips stale provider-prefixed entries while still allowing valid raw vendor/model slugs, and cache native slug lookups so selection no longer times out under test load.
…imit health Make maybePrimeSubagentQuota return an awaitable refresh promise, reject invalid fallback-chain entries without truncating config, and route health blocks through the shared rate-limit/quota classifier.
ed1ee20 to
8f467d2
Compare
Release abandoned Codex probe leases on pre-upstream fallback reroutes, run virtual-model/effort/service-tier normalization only against the final route, allow encrypted children to reach native fallbacks, and coalesce concurrent quota primes with success-only TTL.
…verage Avoid gpt-5.5 in native-only encrypted spawn tests: with an isolated CODEX_HOME, nativeOpenAiSlugs() can resolve to DOCUMENTED_NATIVE_OPENAI_ADDITIONS only, which omits gpt-5.5 and made CI reject before native fallback.
Avoid leasing primary Codex auth before routed fallback selection, clamp effort from the final native route, and always invoke passthrough terminal callbacks for non-quota stream failures.
Use routeModel and canonical/pool route metadata for encrypted eligibility and Codex quota checks instead of slug-only nativeSlugSet matching.
Drop the global explicit-pool config probe. Pool candidates now require a usable preview account based on each candidate routeModel result, including default openai pool mode.
Summary
Implements quota-aware subagent model fallback for
thread_spawnchild turns (issue #374).subagentModelFallbackandsubagentModelFallbackPollMsconfigmodel_fallbackmerge/api/subagent-model-fallbackmanagement routeVerification
bun run typecheckbun test tests/subagent-model-fallback.test.ts tests/multi-agent-compat.test.tsCloses #374
Summary by CodeRabbit
{{fallback}}placeholder in multi-agent guidance.