Skip to content

fix(server): text generation no longer falls back to a model that cannot generate text - #40699

Open
tiliakoos wants to merge 3 commits into
pingdotgg:mainfrom
tiliakoos:fix/text-generation-fallback-model
Open

tiliakoos wants to merge 3 commits into
pingdotgg:mainfrom
tiliakoos:fix/text-generation-fallback-model

Conversation

@tiliakoos

Copy link
Copy Markdown
Contributor

Problem

When the selected text generation provider is unusable, the fallback can run a model whose provider snapshot reports supportsTextGeneration: false. The selected-instance check already treats such a model as unusable; the fallback predicate in TextGeneration.generate checks only the provider. Pi is a fallback driver and marks models outside its text generation inventory this way (packages/provider-pi/src/server/status.ts).

Change

The fallback predicate now applies the same model check as the selected-instance check, so a candidate model that cannot generate text is skipped and the next candidate (for example the same instance's default text generation model) is used. One condition, server only, no contract change.

Scope

A small fix for an obvious bug, so no issue. The gap was recorded as pre-existing in the merged #39870 ("The fallback candidate check uses provider-level text generation capability only and does not reject a candidate whose chosen model reports supportsTextGeneration: false"), raised there by CodeRabbit and left out of that change.

Verification

  • Added one row, not installed, fallback model cannot generate text, to the existing text generation preflight table in apps/server/src/textGeneration/CodexTextGeneration.test.ts: the primary is not installed and the fallback's thread default model reports supportsTextGeneration: false.

  • Without the fix, vp test run src/textGeneration/CodexTextGeneration.test.ts -t preflight: 1 failed, 11 passed. The fallback ran the model that cannot generate text instead of the instance's default:

    × text generation preflight: not installed, fallback model cannot generate text
    -     "model": "claude-haiku-5-5",
    +     "model": "z-ai/glm-5.3-flash",
    
  • With the fix: that file 35 passed, and vp test run src/textGeneration/ 8 files, 113 tests passed.

  • vp run check:changed upstream/main: format, lint, knip, graphql, typecheck (3 packages) and tests (2 files) all pass.

  • Not checked: the running app and a real Pi instance with a model outside its text generation inventory.

Claude Opus 5.5 via T3 Code

…not generate text

The fallback predicate checked only the provider, so it could pick a model whose
snapshot reports supportsTextGeneration: false; it now applies the same model check
as the selected instance.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between eb6cee8 and ce9062b.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Fallback provider selection now excludes a candidate when its matching model explicitly disables text generation. A preflight test covers selecting the Claude Agent default text-generation model in that case.

Changes: Fallback selection

Layer / File(s) Summary
Filter unsupported fallback models
apps/server/src/textGeneration/TextGeneration.ts
Fallback selection excludes a provider when its matching model has supportsTextGeneration set to false.
Test fallback selection
apps/server/src/textGeneration/CodexTextGeneration.test.ts
A preflight test adds an unsupported fallback model state and expects the Claude Agent default text-generation model.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · previous review eb6ce

Text generation fallback no longer selects a model that cannot generate text, and the next candidate, such as the default model, is used instead. The change is small and server-only, with a regression test, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the server text-generation fallback no longer selects a model that cannot generate text. It follows conventional commit format and matches the summary, the objectives,…
Description check Passed The description follows the template sections (Problem, Change, Scope, Verification). Problem and Change are clear and specific. Scope justifies the fix as a small bug fix and links the prior PR #3987…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the server text-generation fallback no longer selects a model that cannot generate text. It follows conventional commit format and matches the summary, the objectives, and the TextGeneration.ts change that rejects candidates whose model reports supportsTextGeneration false.

Full details: Description check

Explanation

The description follows the template sections (Problem, Change, Scope, Verification). Problem and Change are clear and specific. Scope justifies the fix as a small bug fix and links the prior PR #39870 that recorded the gap. Verification gives focused test commands, failing and passing results, and states what was not checked. The template's comment about the agent model and harness is satisfied by the final line. Minor gap: the Scope section does not link a specific issue, but it explains why no issue is needed, which the template allows.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3b3f880 and eb6cee8.

Files selected for processing: 2

  • apps/server/src/textGeneration/CodexTextGeneration.test.ts
  • apps/server/src/textGeneration/TextGeneration.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.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 22, 2026
juliusmarminge and others added 2 commits November 22, 2026 06:18
…provider

Settings resolution can hand text generation the thread default model when
the configured provider is disabled. When that model cannot generate text
and no other provider qualifies, the fallback skipped the whole instance and
kept the unusable model. It now tries other instances first, then the
instance's other models, such as its default text generation model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Nov 22, 2026

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

size:S 10-29 changed lines (additions + deletions). takeover:in-progress A takeover lead is working on this PR vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants