Skip to content

fix(server): honor a project's disabled provider during text generation - #41172

Open
only21mil wants to merge 2 commits into
pingdotgg:mainfrom
only21mil:fix/textgen-honor-project-disabled-provider
Open

only21mil wants to merge 2 commits into
pingdotgg:mainfrom
only21mil:fix/textgen-honor-project-disabled-provider

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When a project turns off its text generation provider under the project's provider settings, T3 Code still runs that provider for the project's thread titles, commit messages, PR text, branch names and review guides. Expected: a provider the project turns off is never called for that project.

TextGeneration.generate decided whether the selected provider could run from its snapshot's machine-wide enabled flag only. The project setting was checked only for fallback candidates. When the project turns off the only enabled provider, resolveProjectSettings has nothing to swap in and keeps the selection, and generate then runs it. The snapshot flag is also not the machine-wide setting: a snapshot stays enabled while any project turns its instance on (ProviderInstanceRegistryHydration.ts), so calls with no project relied on it too.

Change

generate reads settings once for every agent-provider call and treats the selected provider as disabled when its snapshot says so or resolveProjectProviderInstanceEnabled(settings, projectId ?? null, id) is false. A disabled selection then goes through the existing fallback, which uses the same settings, and returns the existing "No text generation provider is available" error when nothing qualifies. Text generators (model APIs) return before this check and keep their own enabled setting. A failed settings read now returns a typed TextGenerationError instead of calling the provider.

Scope

One problem, two files (TextGeneration.ts and its existing preflight test table). It needs no issue because it is a small fix for an obvious bug: a provider the project turned off still runs for that project.

Verification

An AI agent (T3 Code Nightly) ran each check below.

  • apps/server/src/textGeneration/CodexTextGeneration.test.ts: three new rows in the existing preflight table:

    • a primary the project turns off falls back to another provider
    • with every provider turned off for the project, it returns the no-provider error and calls nothing
    • a primary that is off machine-wide but on for another project, called with no project, falls back

    On 83119ae8bd they fail (3 failed, 36 passed); on this branch all 39 pass. vp run check:changed passes.

  • To reproduce without any provider account (Linux, any checkout of this branch):

    vp i
    git show 83119ae8bd:apps/server/src/textGeneration/TextGeneration.ts > apps/server/src/textGeneration/TextGeneration.ts
    vp test run apps/server/src/textGeneration/CodexTextGeneration.test.ts   # 3 failed | 36 passed
    git checkout -- apps/server/src/textGeneration/TextGeneration.ts
    vp test run apps/server/src/textGeneration/CodexTextGeneration.test.ts   # 39 passed

    The free Replay (dev) provider cannot generate text, so a real-app run needs a signed-in provider.

  • Real server, Linux, real Codex CLI 0.171.0 (gpt-6-luna), fresh isolated data for each run, free Replay (dev) agent for the thread turn.

    Setup:

    • Machine-wide, Codex is the only enabled agent provider, and the text generation model is Codex gpt-6-luna.
    • The project's provider settings turn Codex off.

    Steps: start a thread in that project, send the first message, read the thread title and the server trace after the turn settles.

    Before (83119ae8bd), from the run transcript and server trace:

      Initial title:  "New thread"
      Final title:    "Bearer Token Validation and 401 Mapping"
      Outcome:        SUCCEEDED (title generated)
      All CODEX_HOME files created/modified during turn: 6
    {"type":"effect-span","name":"runCodexJson.runCodexCommand", ... "durationMs":4028.593541, ... "exit":{"_tag":"Success"}}
    

    After (this branch):

      Initial title:  "New thread"
      Final title:    "New thread"
      Outcome:        FAILED / UNCHANGED (kept default title)
      All CODEX_HOME files created/modified during turn: 0
    WARN (#1763): Thread title generation failed
        cause: 'TextGenerationError: Text generation failed in generateThreadTitle: No text generation provider is available. Enable a provider that can generate text in Settings → Providers.
    

    The trace has no Codex span on this branch.

    Control on this branch, same setup without the project setting: Codex runs (runCodexJson.runCodexCommand 2649 ms) and the title becomes "Bearer Token Authentication Pipeline".

    Not shown: other agent providers. The changed check is provider-independent and runs before any provider is called.

Generated with Gemini 4 Neon in T3 Code Nightly

Text generation checked only the environment-wide enabled flag for the
selected provider, so a provider a project disables still ran for that
project. Check the project setting too, fall back to another eligible
provider, and fail with the no-provider error when none is left.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Text generation now checks project-specific provider settings when evaluating the selected provider and fallback. Settings-read failures use a provider-settings error, and tests cover project-disabled and cross-project provider cases.

Changes: Project-aware provider availability

Layer / File(s) Summary
Provider availability and fallback
apps/server/src/textGeneration/TextGeneration.ts, apps/server/src/textGeneration/CodexTextGeneration.test.ts
make loads provider settings before evaluating fallback. It treats a selected provider as disabled if its snapshot is disabled or project settings do not enable it. Selection and review-guide checks compare against the originally selected instance ID. Tests cover project-specific enablement, disabled providers, settings-read errors, and no-provider errors.

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

Change: Bug fix

Possibly related PRs

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · up to d1e19

Merge Risk: ⚪ Minimal · up to d1e19

Text generation now respects project-level provider disablement. It falls back to another eligible provider, or returns the existing "No text generation provider is available" error, without calling a disabled provider. The change is narrow and covered by targeted tests, so no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): honor a project's disabled provider during text generation" matches the main change. The raw summary and objectives show that TextGeneration.generate now checks project-level p…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the bug and expected behavior. The Change section explains the fix in TextG…
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 "fix(server): honor a project's disabled provider during text generation" matches the main change. The raw summary and objectives show that TextGeneration.generate now checks project-level provider enablement, so a provider disabled for a project is not called for that project. The title is conventional, specific, and under 72 characters.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the bug and expected behavior. The Change section explains the fix in TextGeneration.ts. The Scope section states one problem, two files, and why no issue is linked. The Verification section gives focused test results, a reproduction procedure, and a real-server Linux run with before and after traces. It also states that other agent providers were not tested. The template's trailing agent-model line is present (Gemini 4 Neon in T3 Code Nightly). The description is complete and specific.

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 2808e87 and cc04ff7.

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 23, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

the fix is written and reviewed, but proving it needs something no worker has:

  • Permanent blocker: authenticated Codex text generation requires first-party ChatGPT OAuth, which the VM brief lists as unavailable on every worker. Replay cannot establish whether Codex was invoked. Both the project-disabled-provider scenario and the no-project machine-wide-disabled-provider scenario remain unverified.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 23, 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:M 30-99 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body 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