Skip to content

fix(server): Codex text generation falls back to a model the account can run - #15272

Open
AatmanAJ wants to merge 1 commit into
pingdotgg:mainfrom
AatmanAJ:fix/codex-text-generation-model-fallback
Open

AatmanAJ wants to merge 1 commit into
pingdotgg:mainfrom
AatmanAJ:fix/codex-text-generation-model-fallback

Conversation

@AatmanAJ

@AatmanAJ AatmanAJ commented Oct 3, 2026

Copy link
Copy Markdown

Problem

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:

  1. the requested slug, if listed (custom models included)
  2. a non-custom model in the same family (unchanged)
  3. the instance's default model
  4. the first current (non-legacy) listed model, then any listed model
  5. 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: #15230 (comment) (I claimed it there before starting).

Out of scope, as the triage notes:

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 codex binary: the snapshot lists gpt-5.6-luna and gpt-6-astra (default), and the selection is gpt-6-luna. The spawned command must receive --model gpt-6-astra and must not receive --model gpt-6-luna. Against current main this test fails on the forbidden --model gpt-6-luna arg, 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.

…can run

The default text-generation model is `gpt-6-luna`. A ChatGPT-login Codex
account's catalog can omit it (Connect with ChatGPT always does), but
`runCodexJson` still passed `--model gpt-6-luna` when the instance snapshot
had neither an exact nor a family match. Thread titles stayed "New thread",
and commit, PR, and branch generation failed the same way.

When the snapshot omits the requested slug, use the instance's default model,
then the first current listed model. The requested slug still wins whenever
the snapshot lists it, and is sent unchanged when there is no snapshot.

Fixes pingdotgg#15230
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Oct 3, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 3, 2026 — with ChatGPT Codex Connector
@macroscopeapp

macroscopeapp Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 854b9f9

Macroscope'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.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
docs/internals/effect-services.md — configured

No 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 77823bd and 854b9f9.

📒 Files selected for processing (2)
  • apps/server/src/textGeneration/CodexTextGeneration.test.ts
  • apps/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.ts
The 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.ts
runCodexJson uses 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: juliusmarminge

Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity>

Merge Risk: ⚪ Minimal · up to 854b9

Codex 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 #15230 requires Codex thread-title generation to use a model the account supports or fail gracefully. resolveCodexTextGenerationModel keeps 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex thread title generation fails with gpt-6-luna when using ChatGPT account

2 participants