Skip to content

fix(server): use configured custom model only on broken one-shot text-gen fallback - #81

Closed
macodev00 wants to merge 1 commit into
mainfrom
cursor/text-gen-fallback-model-redo2-4b80
Closed

macodev00 wants to merge 1 commit into
mainfrom
cursor/text-gen-fallback-model-redo2-4b80

Conversation

@macodev00

@macodev00 macodev00 commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Problem

One-shot text generation (commit, PR, branch, and title) uses the product slug when textGenerationModelSelection is unset and the stored instance is disabled. For Claude that slug is claude-haiku-4-5. A backend that refuses that slug, such as an OpenRouter workspace whose guardrails block Anthropic models, fails the spawn even when the Claude instance has a working custom model.

The product slug is still the right default when that model works. Selecting a configured custom model in its place changes commit, PR, branch, and title generation for healthy setups.

Change

fallbackTextGenerationProvider still writes the product text-generation slug. Settings, and the first one-shot attempt, stay on that slug when a custom model is configured and when the thread default is a custom model.

Claude one-shot generation retries once with the instance's first configured custom model only after the product-slug attempt exits non-zero and the CLI output reports that the model is unavailable (guardrail block, unknown model, no matching endpoints, and the same class of failure). A successful product-slug attempt is unchanged. A non-model failure, an explicit non-product model, and an instance with no other custom model do not retry.

Commit, PR, branch, and title generation share runClaudeJson, so the same rule covers all four.

Fixes pingdotgg#12651

Supersedes pingdotgg#14568. That PR selected configured custom models instead of the product slug on the fallback path, which changed the effective product default. This version keeps the product slug whenever that attempt can run.

Scope and approval

pingdotgg#12651 is an accepted server bug. Julius confirmed the fallback sends claude-haiku-4-5 and does not consult the instance's configured custom model: pingdotgg#12651 (comment)

The accepted direction is to keep the cheap product slug when it is available, and not to send it when that slug is what the backend refuses. This PR does the second half only after the product attempt reports the model is unavailable, so healthy defaults stay on the product slug.

Verification

From /workspace at 673296536, Node v24.13.1:

vp test run apps/server/src/textGeneration/TextGenerationModelFallback.test.ts apps/server/src/textGeneration/ClaudeTextGeneration.test.ts apps/server/src/serverSettings.test.ts

Result: 3 files passed, 79 tests passed (4.90s). Coverage includes a healthy product-slug success while a custom model is configured (one spawn, product slug only), a guardrail rejection of claude-haiku-4-5 followed by one retry on z-ai/glm-5.3-flash, a non-model product-slug failure that does not retry, an explicit non-product model that does not retry, and settings resolution that still returns the Claude product slug when a custom model and a custom thread default are configured.

cd apps/server && pnpm exec tsc --noEmit

Result: exit 0.

vp lint apps/server/src/textGeneration/TextGenerationModelFallback.ts apps/server/src/textGeneration/TextGenerationModelFallback.test.ts apps/server/src/textGeneration/ClaudeTextGeneration.ts apps/server/src/textGeneration/ClaudeTextGeneration.test.ts apps/server/src/serverSettings.ts apps/server/src/serverSettings.test.ts

Result: exit 0. The only output was two existing no-inline-schema-compile warnings in serverSettings.test.ts around the pre-existing inline schema helpers, not in this diff.

vp fmt apps/server/src/textGeneration/TextGenerationModelFallback.ts apps/server/src/textGeneration/TextGenerationModelFallback.test.ts apps/server/src/textGeneration/ClaudeTextGeneration.ts apps/server/src/textGeneration/ClaudeTextGeneration.test.ts apps/server/src/serverSettings.ts apps/server/src/serverSettings.test.ts

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

Limitations

Linux only. The unavailable product slug is attempted once before the custom model, so a broken fallback pays for one failed CLI spawn. The substitute is the first configured custom model on that Claude instance other than the product slug; a built-in thread default is not used. Codex, Cursor, Grok, OpenCode, and Antigravity still send their product slug and do not retry. When the custom-model retry also fails, or when the failure is not a model-unavailable error, the surfaced CLI error still prefers stderr over the stdout API error. A live OpenRouter spawn was not run.

UI Changes

None. This only changes server-side model selection for one-shot commit, PR, branch, and title generation.

Open in Web Open in Cursor 

…-gen fallback

One-shot commit, PR, branch, and title generation still send the product
text-generation slug first. A configured custom model is used only after
that attempt reports the model is unavailable.

Fixes pingdotgg#12651
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 2, 2026
@macodev00

Copy link
Copy Markdown
Owner Author

Not opening upstream: redo cap reached for pingdotgg#12651.

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

Labels

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

Projects

None yet

1 participant