fix(catalog): keep failover combos when live discovery omits members - #1331
Conversation
Authoritative /models responses no longer drop model ids that a combo still targets, so failover combos stay in the Codex catalog (OCX-111 / lidge-jun#1308).
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughConfigured combo targets are grouped by provider and passed into provider discovery. Discovery retains them across live, cached, stale, and failure paths. Shared merging preserves configured aliases and defaults. Tests cover failover synthesis, warm-cache behavior, and concurrent retention sets. ChangesConfigured combo target retention
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/codex/catalog/provider-fetch.ts`:
- Around line 1287-1291: Update the live-discovery logic around the
provider-model candidate construction in
src/codex/catalog/provider-fetch.ts#L1287-L1291 to create CatalogModel rows for
IDs in captured.retainConfiguredModelIds, not only entries from prov.models,
applying the available provider configuration hints; in
tests/codex-catalog.test.ts#L1552-L1573, remove a configured target from its
provider models, preserve its metadata through provider hints, and assert both
the provider row and combo/failover remain present.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 249397c5-47a5-47a5-879c-11cd3002ed45
📒 Files selected for processing (3)
src/codex/catalog.tssrc/codex/catalog/provider-fetch.tstests/codex-catalog.test.ts
Seed live-discovery candidates from combo target ids as well as providers.*.models so failover members defined only under combos stay catalogued.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/codex/catalog/provider-fetch.ts (2)
463-471: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winAdd combo retention to the provider collect-flight key.
gatherRoutedModelsWithAuthreuses a pending collect flight whenproviderGraphIdentitymatches, butcaptureGatherFlightbuilds that identity fromomitProviderTransportExecutor(provider.provider)and omits the per-providerretainConfiguredModelIdsset. When the same config is issued again with a different combo target for the same provider, the flight can return cached provider rows built without the new retention IDs. Include a deterministic, sorted copy ofprov.retainConfiguredModelIdsin the provider collect-flight identity.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/codex/catalog/provider-fetch.ts` around lines 463 - 471, Update captureGatherFlight’s provider collect-flight identity to include a deterministic sorted copy of prov.retainConfiguredModelIds alongside omitProviderTransportExecutor(prov.provider). Ensure differing retention sets produce distinct providerGraphIdentity values while identical sets remain reusable.
1297-1301: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftApply combo model retention before every cached or failed result is returned.
configuredComboTargetModelsByProviderpasses combo targets intocaptureProviderGather, and the live/modelsretain rule usescaptured.retainConfiguredModelIdsatsrc/codex/catalog/provider-fetch.ts:1297-1301. The Cursor cache returns atsrc/codex/catalog/provider-fetch.ts:1093-1095and stale returns atsrc/codex/catalog/provider-fetch.ts:1098-1101, while Google stale returns atsrc/codex/catalog/provider-fetch.ts:1146-1150and discovery fallbacks atsrc/codex/catalog/provider-fetch.ts:1162andsrc/codex/catalog/provider-fetch.ts:1177all skip that rule. Add a shared retention helper for cached/stale/failure returns, or invalidate model cache when combo retention changes, and cover this with a warm-cache regression case.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/codex/catalog/provider-fetch.ts` around lines 1297 - 1301, Ensure combo-target model retention is applied before every cached, stale, or discovery-fallback result is returned, not only in the live `/models` path around `shouldRetainConfiguredProviderModel` and `captured.retainConfiguredModelIds`. Add a shared retention helper for the Cursor cache returns, Google stale returns, and discovery fallbacks, or invalidate the model cache whenever combo retention changes; include a warm-cache regression case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/codex/catalog/provider-fetch.ts`:
- Around line 463-471: Update captureGatherFlight’s provider collect-flight
identity to include a deterministic sorted copy of prov.retainConfiguredModelIds
alongside omitProviderTransportExecutor(prov.provider). Ensure differing
retention sets produce distinct providerGraphIdentity values while identical
sets remain reusable.
- Around line 1297-1301: Ensure combo-target model retention is applied before
every cached, stale, or discovery-fallback result is returned, not only in the
live `/models` path around `shouldRetainConfiguredProviderModel` and
`captured.retainConfiguredModelIds`. Add a shared retention helper for the
Cursor cache returns, Google stale returns, and discovery fallbacks, or
invalidate the model cache whenever combo retention changes; include a
warm-cache regression case.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7245acb8-e6cf-4ae5-a047-4980aa7e80cc
📒 Files selected for processing (2)
src/codex/catalog/provider-fetch.tstests/codex-catalog.test.ts
Keep combo-only ids on the lidge-jun#1305 synthesis path instead of seeding them into providers.*.models retention, and pin the OCX-111 regression to non-registry provider names.
Dismissed only to correct malformed newline escaping in the review body; the technical findings are unchanged.
Ingwannu
left a comment
There was a problem hiding this comment.
The direction is valuable and much closer to the right fix than #1310, but I am requesting changes because the retention policy is not yet part of every catalog reuse boundary.
Two blockers remain on the current head:
-
captureGatherFlighthashes the provider row intoproviderGraphIdentitybut omitsretainConfiguredModelIds. Two concurrent gathers with the same provider config and different combo targets can therefore share a flight built for the wrong retention set. Add a deterministic sorted retention list to that identity and test that different sets do not coalesce. -
The retention rule runs only after a successful live
/modelsresponse. Fresh cache, stale cache, cooldown, and discovery-failure returns happen earlier and can return a catalog captured before the combo target existed. Apply one shared configured-target retention helper to every cached/fallback return, or make the relevant cache identity/invalidation include the retention set. Add a warm-cache regression that gathers once without the combo and again with it inside the TTL.
I do not require exposing combo-only IDs as standalone provider rows: the existing #1305 synthesis path intentionally keeps those scoped to combo derivation, and the new test correctly asserts no standalone leak. The configured models[] members do need consistent retention across live, cached, stale, and in-flight paths.
Once these two cache/flight boundaries are fixed and exact-head CI is green, this should remain a strong merge candidate for #1308.
Include retainConfiguredModelIds in providerGraphIdentity and merge configured combo targets on every cached/stale/fallback return so a warm cache captured before a combo still surfaces OCX-111 members.
Ingwannu
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 516850518acc. Both requested catalog reuse boundaries are now covered:
- the sorted combo-retention set participates in
providerGraphIdentity, with a concurrent-flight regression; - one shared retention helper is applied across live, fresh-cache, stale/cooldown, and discovery-fallback returns, while cache writes deliberately avoid freezing combo-only state.
Local exact-head validation passed: TypeScript typecheck and 173 focused catalog/gather tests. GitHub CI, macOS, all Linux shards, packaging smoke checks, hygiene, and CodeRabbit are green. Approved for dev.
Summary
/modelsomits configured ids that a combo still targets, retain those rows instead of dropping them from the live catalog.ocx syncfrom omitting failover combos as "member capabilities are incomplete" (OCX-111 / [Bug]: ocx sync drops configured combo members and omits failover catalog entry #1308), including the openrouter + opencode-go + command-code repro.Closes #1308
Verification
bun test ./tests/codex-catalog.test.ts -t "OCX-111|successful live discovery|managed Kimi|combo catalog"bun run typecheckChecklist
Summary by CodeRabbit