Repository navigation
feat(router): summarize compaction on the default provider when no canonical openai route exists - #3201
Conversation
…nonical openai route exists Codex selects a bare OpenAI-family model for compaction even when the operator routes every ordinary turn to another provider (GitHub Copilot, OpenRouter, ...). routeModel reserves bare native ids for the canonical openai provider and threw NoEnabledOpenAiProviderError, so such users hit 404 on every compaction while the routedCompaction summarizer bridge in core.ts was already able to serve them. Add routeCompactionModel: identical to routeModel except that, when the bare-native branch has no enabled canonical openai provider, it may land on config.defaultProvider (own provider, enabled, not an OpenAI-family entry) with routeReason compaction-default-provider. Wire it into both compaction entrypoints: v1 handleResponsesCompact and the initial v2 compaction_trigger route in handleResponsesInner. Combo attempts, fallback and recovery re-routes, ordinary turns, and account-qualified selectors (side/gpt-*) keep today behaviour. One console notice per provider, no request content. Closes #2901
|
✅ Deterministic PR hygiene checks passed. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ebfc784ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /v1/responses/compact` and a `POST /v1/responses` turn carrying a `compaction_trigger` — a bare | ||
| native model with no enabled canonical `openai` provider falls back to the configured | ||
| `defaultProvider` as the summarizer instead of returning 404. The fallback applies only when the | ||
| default provider is enabled and is not itself an OpenAI-family entry; account-qualified selectors |
There was a problem hiding this comment.
Describe the OpenAI API-key fallback accurately
When defaultProvider is openai-apikey and no canonical openai row is enabled, routeCompactionModel permits the fallback because it excludes only openai, chatgpt, and openai-multi; for v1 compact requests, this can then call the official OpenAI /responses/compact endpoint. The statement that the default cannot itself be an OpenAI-family entry is therefore incorrect and may mislead operators about which provider receives and bills the request. Either document that openai-apikey is eligible or exclude it in the router if the stated restriction is intentional.
AGENTS.md reference: docs-site/AGENTS.md:L7-L10
Useful? React with 👍 / 👎.
…nonical openai route exists (lidge-jun#3201) Codex selects a bare OpenAI-family model for compaction even when the operator routes every ordinary turn to another provider (GitHub Copilot, OpenRouter, ...). routeModel reserves bare native ids for the canonical openai provider and threw NoEnabledOpenAiProviderError, so such users hit 404 on every compaction while the routedCompaction summarizer bridge in core.ts was already able to serve them. Add routeCompactionModel: identical to routeModel except that, when the bare-native branch has no enabled canonical openai provider, it may land on config.defaultProvider (own provider, enabled, not an OpenAI-family entry) with routeReason compaction-default-provider. Wire it into both compaction entrypoints: v1 handleResponsesCompact and the initial v2 compaction_trigger route in handleResponsesInner. Combo attempts, fallback and recovery re-routes, ordinary turns, and account-qualified selectors (side/gpt-*) keep today behaviour. One console notice per provider, no request content. Closes lidge-jun#2901 Co-authored-by: jun <[email protected]>
…nonical openai route exists (lidge-jun#3201) Codex selects a bare OpenAI-family model for compaction even when the operator routes every ordinary turn to another provider (GitHub Copilot, OpenRouter, ...). routeModel reserves bare native ids for the canonical openai provider and threw NoEnabledOpenAiProviderError, so such users hit 404 on every compaction while the routedCompaction summarizer bridge in core.ts was already able to serve them. Add routeCompactionModel: identical to routeModel except that, when the bare-native branch has no enabled canonical openai provider, it may land on config.defaultProvider (own provider, enabled, not an OpenAI-family entry) with routeReason compaction-default-provider. Wire it into both compaction entrypoints: v1 handleResponsesCompact and the initial v2 compaction_trigger route in handleResponsesInner. Combo attempts, fallback and recovery re-routes, ordinary turns, and account-qualified selectors (side/gpt-*) keep today behaviour. One console notice per provider, no request content. Closes lidge-jun#2901 Co-authored-by: jun <[email protected]>
Summary
gpt-5.6-sol, ...) for its compaction turns regardless of which provider the operator routes ordinary turns to.routeModelreserves those ids for the canonicalopenaiprovider, so a GitHub Copilot-only (or any non-OpenAI-only) operator received 404 on every compaction even though theroutedCompactionsummarizer bridge incore.tscould already serve them.routeCompactionModelinsrc/router.ts: identical torouteModelexcept that, when the bare-native branch has no enabled canonicalopenaiprovider, it may land onconfig.defaultProvider(own provider, enabled, not an OpenAI-family entry) withrouteReason: "compaction-default-provider". OrdinaryrouteModelis untouched.POST /v1/responses/compact(compact.ts) and the initial v2compaction_triggerroute inhandleResponsesInner(core.ts). Combo attempts, later fallback/recovery re-routes, ordinary turns, and account-qualified selectors (side/gpt-*) keep today's behaviour. No new config key; configurations with an enabled canonicalopenaiprovider are byte-for-byte unchanged.console.warnper provider id when the fallback engages; the message carries only the operator-configured provider id, no request content or model strings from the caller.docs-site/src/content/docs/reference/proxy-formats.mdcompaction section documents the fallback and its limits. Plan/audit notes underdevlog/_plan/260902_nonbug_adoption_backlog/.Verification
bun x tsc --noEmit— clean.bun test tests/router.test.ts tests/responses-compaction-routing.test.ts tests/responses-compaction.test.ts— 107 pass / 0 fail. New coverage:routeCompactionModel (#2901)(fallback only via the helper;side/gpt-5.6-solstill throws; disabled/missing/legacy default still throws; canonical-openai config identical torouteModel) andbare native compaction model without canonical openai (#2901)(v2 trigger → 200 with summarizer prompt and no trigger leaked to the gateway; v1 compact → 200; ordinary turn on the same config still 404; account-qualified selector still 404).bun run privacy:scan— passed.Checklist