Skip to content

feat(router): summarize compaction on the default provider when no canonical openai route exists - #3201

Merged
lidge-jun merged 1 commit into
devfrom
codex/compact-provider-2901
Sep 1, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/compact-provider-2901

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

  • Closes No way to set compaction provider. #2901. Codex names a bare OpenAI-family model (gpt-5.6-sol, ...) for its compaction turns regardless of which provider the operator routes ordinary turns to. routeModel reserves those ids for the canonical openai provider, so a GitHub Copilot-only (or any non-OpenAI-only) operator received 404 on every compaction even though the routedCompaction summarizer bridge in core.ts could already serve them.
  • Adds routeCompactionModel in src/router.ts: 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". Ordinary routeModel is untouched.
  • Wires it into both compaction entrypoints: v1 POST /v1/responses/compact (compact.ts) and the initial v2 compaction_trigger route in handleResponsesInner (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 canonical openai provider are byte-for-byte unchanged.
  • One console.warn per 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: docs-site/src/content/docs/reference/proxy-formats.md compaction section documents the fallback and its limits. Plan/audit notes under devlog/_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-sol still throws; disabled/missing/legacy default still throws; canonical-openai config identical to routeModel) and bare 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.
  • Full suite intentionally left to CI per maintainer instruction (no local full suite this campaign).

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. (No credential path touched; account-qualified native selectors remain fail-closed; the new log line contains only the operator-configured provider id.)

…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
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 1, 2026 18:44
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T18:48:19.658344Z 6ebfc78 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the enhancement New feature or request label Sep 1, 2026
@lidge-jun
lidge-jun merged commit c7f3f6f into dev Sep 1, 2026
20 of 22 checks passed
@lidge-jun
lidge-jun deleted the codex/compact-provider-2901 branch September 1, 2026 18:45
@lidge-jun lidge-jun mentioned this pull request Sep 1, 2026
2 tasks done

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

tarunravi pushed a commit to tarunravi/opencodex that referenced this pull request Sep 14, 2026
…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]>
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant