fix(server): preserve explicit source control writer - #6087
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 14f1dc4. Configure here.
ApprovabilityVerdict: Approved 65bfe8f This is a targeted bug fix (~10 lines of logic) that handles a race condition where settings can lag behind live provider state. The fix preserves explicit source control writer selections when the provider is healthy. Extensive test coverage is included. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |

What Changed
create_prflow.Why
The Source control writer model picker could visibly show OpenCode while the server resolver rejected that selection using stale persisted provider settings. It then passed the global Codex selection to
generatePrContent, producingFailed to spawn Codex CLI process.The resolver now trusts a matching provider snapshot only when that instance is enabled and available. If it is not usable, the existing fallback behavior remains.
Related: #5359 is background on provider fallback, but does not cover this healthy OpenCode/Create PR routing bug.
Verification: 283 focused tests passed; server/shared typechecks, lint, and formatting passed.
Checklist
Verified with gpt-5.6-luna via the T3 Code harness.
Note
Fix
resolveSourceControlWriterModelSelectionto preserve explicit writer when provider snapshot is healthyresolveSourceControlWriterModelSelectionnow checks the live snapshot rather than persisted settings to determine if a selection is healthy, returning the explicit selection if the provider is enabled and available.textGenerationModelSelection.textGenerationModelSelection, even when the live provider was healthy.Macroscope summarized f7ebeaa.
Note
Medium Risk
Changes model routing for commits/PRs when settings and provider health disagree; fallback paths remain for unavailable writers.
Overview
Fixes a mismatch where the source control writer picker could show OpenCode while the server routed PR generation through the global Codex selection because persisted
providerInstancesstill had OpenCode disabled.resolveSourceControlWriterModelSelectionnow treats a supplied provider snapshot as live routing state: when the explicit writer’s instance is enabled and available in that snapshot, the stored selection is kept even if settings lag. Without a snapshot, behavior is unchanged (settings-based enablement, then fallback totextGenerationModelSelection). Unhealthy or missing snapshots still fall back.Regression tests cover shared resolver behavior, web
resolveAppModelSelectionStatefor the same settings/snapshot lag, and acreate_prGitManager flow that assertsgeneratePrContentreceives the OpenCode writer (model + options) instead of unavailable Codex.Reviewed by Cursor Bugbot for commit f7ebeaa. Bugbot is set up for automated code reviews on this repo. Configure here.