Skip to content

fix(server): text-generation fallback uses a configured custom model - #73

Closed
macodev00 wants to merge 2 commits into
cursor/upstream-main-base-804dfrom
cursor/text-gen-fallback-model-redo1-804d
Closed

macodev00 wants to merge 2 commits into
cursor/upstream-main-base-804dfrom
cursor/text-gen-fallback-model-redo1-804d

Conversation

@macodev00

@macodev00 macodev00 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Problem

One-shot text generation (commit, PR, branch, and title) ignores a provider instance's configured custom model when textGenerationModelSelection is unset and the stored instance is disabled. Fallback then sends the product slug claude-haiku-4-5, which some backends (OpenRouter guardrails that block Anthropic models) refuse.

Fixes pingdotgg#12651. Supersedes pingdotgg#12905, which Macroscope re-verdicted Not approved on 2026-10-01 because it applied every configured default, including built-in chat models, to those flows.

The branch is cut from upstream pingdotgg/t3code main 148e6deea. This fork PR uses that same commit as its base so the diff is only the fix. Open the upstream PR from cursor/text-gen-fallback-model-redo1-804d against pingdotgg/t3code main.

Change

fallbackTextGenerationProvider still picks the first enabled instance. The model on that instance is now:

  • The product text-generation slug (DEFAULT_TEXT_GENERATION_MODEL_BY_PROVIDER, Claude's claude-haiku-4-5) when the instance has no custom model, when that slug is itself one of the custom models, or when defaultModelSelection for this instance is a built-in slug. Title, branch, and commit generation keep the cheap product default for users who only picked a chat model.
  • On the broken fallback only: a matching defaultModelSelection whose model is one of the instance's custom models (options included), otherwise the first custom slug from providerInstances[id].config.customModels or the legacy providers[driver].customModels list.

An already-enabled textGenerationModelSelection is left unchanged.

Scope and approval

Maintainer triage on pingdotgg#12651 accepted the bug and the intended behavior: do not emit a hardcoded slug the instance is not configured to call; a cheap default is fine when that slug is actually the product fallback. This redo keeps that product slug in every case pingdotgg#12905 changed for built-in thread defaults, and only substitutes a custom model on the fallback path those backends refuse.

Verification

From apps/server at 148eaf0e9, Node v24.13.1:

pnpm exec tsc --noEmit

Result: exit 0. The compiler printed existing suggestion diagnostics and no error TS lines.

pnpm exec vp fmt apps/server/src/serverSettings.ts apps/server/src/serverSettings.test.ts

Result: finished on the touched files with no further edits.

pnpm exec vp test run src/serverSettings.test.ts

Result: 1 file passed, 55 tests passed (4.63s). Coverage includes the unconfigured fallback still using the Claude product slug, a built-in thread default (even alongside a custom model) staying on that slug, a custom thread default with options, an instance customModels entry, and a legacy providers.claudeAgent.customModels entry.

Limitations: Linux only. The fallback choice is covered by settings tests; a live one-shot CLI spawn was not run.

Grok 4.7 via Cursor cloud agent.

Open in Web Open in Cursor 

One-shot commit, PR, branch, and title generation sent claude-haiku-4-5 whenever the stored provider was disabled, even when that instance's custom model was the slug the backend would accept. The product text-generation slug still applies when no custom model is configured, and a built-in thread default does not replace it.

Co-authored-by: maco <macodev00@users.noreply.github.com>
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 1, 2026
@cursor
cursor Bot changed the base branch from main to cursor/upstream-main-base-804d October 1, 2026 08:37
The product slug stays in place for built-in thread defaults. A custom model replaces it only when that slug is not one of the instance's configured models.

Co-authored-by: maco <macodev00@users.noreply.github.com>
@github-actions github-actions Bot added size:M and removed size:XXL labels Oct 1, 2026
@macodev00

Copy link
Copy Markdown
Owner Author

Opened upstream.

@macodev00 macodev00 closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

2 participants