fix(server): Codex text generation falls back to a model the account can run #15272
main fromrefs/pull/15272/head·opened View on GitHubProblem#
The default text-generation selection is Codex with gpt-6-luna. A ChatGPT-login Codex account's catalog can leave that model out (Connect with ChatGPT always does, see #14321). codex exec then fails with:
The 'gpt-6-luna' model is not supported when using Codex with a ChatGPT account.
New threads keep the "New thread" placeholder, and commit message, PR content, and branch name generation fail the same way because they share runCodexJson.
Change#
apps/server/src/textGeneration/CodexTextGeneration.ts: model resolution moves into resolveCodexTextGenerationModel. The exact-match and family-match behavior is unchanged. When the instance's model snapshot lists neither, it now falls back to a model the snapshot does list:
- the requested slug, if listed (custom models included)
- a non-custom model in the same family (unchanged)
- the instance's default model
- the first current (non-legacy) listed model, then any listed model
- the requested slug, when there is no snapshot at all (unchanged)
This is the fix direction suggested in the triage. gpt-6-luna is still used whenever the account's catalog has it. Nothing changes in settings, contracts, or the picker.
Scope and approval#
Fixes #15230, confirmed in triage: https://github.com/pingdotgg/t3code/issues/15230#issuecomment-5970701947 (I claimed it there before starting).
Out of scope, as the triage notes:
- The settings picker can show a different model from the one that runs (#12651).
- An account whose
model/listincludes a slug that the API still rejects is not covered. There is no catalog signal to act on for that case.
Verification#
Focused tests (33 passed):
vp test run apps/server/src/textGeneration/CodexTextGeneration.test.ts apps/server/src/textGeneration/TextGeneration.test.ts
- New end-to-end case through the fake
codexbinary: the snapshot listsgpt-5.6-lunaandgpt-6-astra(default), and the selection isgpt-6-luna. The spawned command must receive--model gpt-6-astraand must not receive--model gpt-6-luna. Against currentmainthis test fails on the forbidden--model gpt-6-lunaarg, which reproduces the report. With this change it passes. - New unit cases for
resolveCodexTextGenerationModel: a listed request is kept, an empty snapshot passes the request through, the fallback order with no default (legacy skipped), and custom models used only when requested. - The existing family-match tests (
gpt-5.6-luna→openai.gpt-5.6-luna) still pass.
tsc --noEmit for apps/server passes. vp fmt and vp lint on the changed files are clean.
Not checked: a live Connect with ChatGPT account. My Codex login lists gpt-6-luna, so titles already work on it. The fake-binary test covers the failing catalog shape from #14321.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
🧰 Additional context used
📚 Code guidelines (1)
docs/internals/effect-services.md — configuredNo actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
37ec4739-1dfa-4b11-99d4-bb0226fa700b
📥 Commits
Reviewing files that changed from the base of the PR and between 77823bd102ae50430d4acda9a553e5743d2aa5ba and 854b9f9880cb4c4eef7d185905121b314589cba9.
📒 Files selected for processing (2)
apps/server/src/textGeneration/CodexTextGeneration.test.tsapps/server/src/textGeneration/CodexTextGeneration.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
Codex text generation now resolves requested models against the available model catalog. The selection process includes default, non-legacy, and first-listed model fallbacks. New tests cover resolver behavior and fallback to a listed default model.
Changes#
Codex model fallback
Layer / File(s) Summary Model resolution
apps/server/src/textGeneration/CodexTextGeneration.ts,apps/server/src/textGeneration/CodexTextGeneration.test.tsThe exported resolver prefers an exact slug, then a non-custom model from the requested family, a default model, a non-legacy model, or the first non-custom model. Tests cover exact matches, empty catalogs, fallbacks, and custom models. Generation integration
apps/server/src/textGeneration/CodexTextGeneration.ts,apps/server/src/textGeneration/CodexTextGeneration.test.tsrunCodexJsonuses the resolver. The fake catalog can mark a default model, and an integration test checks fallback when the requested model is unavailable.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
juliusmarmingeFixed issue severity: Medium
Merge Risk: ⚪ Minimal · up to
854b9Codex text generation now falls back to a model listed for the account instead of failing on an unsupported default. No concrete merge-blocking risk remains.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and concisely describes the main change: Codex text generation falls back to a model the account can run. Description check ✅ Passed The description covers the problem, change, scope and triage approval, and focused verification. It also states what was not checked and identifies out-of-scope behavior. Linked Issues check ✅ Passed Issue #15230requires Codex thread-title generation to use a model the account supports or fail gracefully.resolveCodexTextGenerationModelkeeps listed requests and family matches, then selects a l…Out of Scope Changes check ✅ Passed The changes are limited to Codex text-generation model resolution and its tests. These changes directly address #15230. They do not change settings, contracts, or the model picker, and they do not add…- Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.Note
Written by
claude-opus-5-5on behalf of MariaHi! We are cleaning up open PRs, and this one appears to have been created with an older model (
gpt-6-luna). If this change is really important, we recommend rebuilding the PR with a newer model if possible.maria-rcks closed this
Sign in to join this conversation.
Approvability#
Verdict: Approved at
854b9f9Macroscope's review found this PR approvable — This is a localized Codex text-generation bug fix that falls back only when the requested model is absent from the account’s catalog, with existing selection behavior preserved and focused runtime tests added. It does not alter product defaults, schemas, deployment behavior, or static-analysis configuration.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).