Repository navigation
fix(source-control): let Pi use its configured default model - #15649
brennanb2025 wants to merge 11 commits into
Conversation
📝 WalkthroughWalkthroughPi now uses Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to Pi configured-default settings can still ignore an explicit model choice or fail while loading persisted settings, and the intended runtime validation may be skipped for relevant changes. These should be resolved before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 32 functions across 32 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
…default Orca seeded selectedModelByAgent.pi = github-copilot/gpt-5.4-mini the first time a user picked Pi on a pre-fix build, and pi --list-models still lists that id, so the resolution chain honoured it and STA-4249 kept reproducing for every upgrading user. Every prior test started from an empty selection.
|
Codex revision complete. What I kept:
What I changed:
Verification:
Non-vacuity proof (temporary mutations restored afterward):
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/shared/pi-configured-default-model-state.ts (1)
155-158: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDocument that this function mutates
args.next.
applyPiConfiguredDefaultSelectionUpdatereturns the new provenance state and also rewrites the caller'snextsettings object in place throughnormalizeChoice.settings-update.tsdepends on that side effect, because it passessanitizedUpdates.sourceControlAiand then persists it. A future caller that passes a live settings object would mutate it without noticing.Add one short comment stating the in-place rewrite, or return the normalized settings alongside the state.
src/main/persistence-source-control-ai-migration.test.ts (1)
170-201: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the second half of the test name.
The test name says "without reinterpreting later concrete writes", but the body only asserts the seeding case. Add a case where the persisted state already exists and the selection is an explicit
github-copilot/gpt-5.4-mini, then assertdefaultsByHost.localstays absent. That case is the migration behavior most likely to regress, because it separates an automatic seed from an explicit user choice.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bb87856a-b28b-483a-a9ee-9bd4ac06ad9f
📒 Files selected for processing (17)
src/main/persistence-source-control-ai-migration.test.tssrc/main/persistence/applying-settings/settings-update.tssrc/main/persistence/loading-store/store.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/text-generation/commit-message-text-generation-model-discovery.test.tssrc/main/text-generation/commit-message-text-generation.tssrc/renderer/src/components/right-sidebar/SourceControlTextGenerationDialog.test.tssrc/renderer/src/components/right-sidebar/source-control/ai/text-generation-params.tssrc/shared/commit-message-agent-spec.tssrc/shared/commit-message-plan-model.tssrc/shared/commit-message-plan.test.tssrc/shared/commit-message-plan.tssrc/shared/constants.tssrc/shared/global-settings-types.tssrc/shared/pi-configured-default-model-state.tssrc/shared/source-control-ai-pi-default.test.tssrc/shared/source-control-ai.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
| sanitizedUpdates.piConfiguredDefaultModelState = applyPiConfiguredDefaultSelectionUpdate({ | ||
| previous: previousSourceControlAi, | ||
| next: sanitizedUpdates.sourceControlAi!, | ||
| state: operations.state.settings.piConfiguredDefaultModelState | ||
| }) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Resolve the nullability of sanitizedUpdates.sourceControlAi at this call site.
set -euo pipefail
# 1) Signature of the function that produces the value assigned just above.
rg -nP -C 12 'function\s+retireLegacyInstructionsForClearedTextActionRecipes' --type=ts
# 2) Writers that pass sourceControlAi into updateSettings / settings RPC.
rg -nP -C 4 '\bsourceControlAi\s*:' --type=ts --type=tsx -g '!**/*.test.*' | rg -n -C 4 'updateSettings|setSettings|settings:update'Repository: stablyai/orca
Length of output: 151
🏁 Script executed:
#!/bin/bash
set -u
printf '%s\n' '--- target file context ---'
sed -n '150,255p' src/main/persistence/applying-settings/settings-update.ts
printf '%s\n' '--- function and symbol locations ---'
rg -n -F 'retireLegacyInstructionsForClearedTextActionRecipes' .
rg -n -F 'applyPiConfiguredDefaultSelectionUpdate' .
rg -n -F 'sourceControlAi' src/main src/renderer src/shared 2>/dev/null || true
printf '%s\n' '--- settings update APIs ---'
rg -n -C 4 'updateSettings|setSettings|settings:update' src/main src/renderer src/shared 2>/dev/null || trueRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -u
log=/tmp/coderabbit-shell-logs/shell-output-HOUx4l
printf '%s\n' '--- target-file excerpts from saved output ---'
rg -n -C 25 'settings-update\.ts|retireLegacyInstructionsForClearedTextActionRecipes|applyPiConfiguredDefaultSelectionUpdate' "$log" | head -n 240
printf '%s\n' '--- exact function locations in tracked source ---'
rg -n -F 'retireLegacyInstructionsForClearedTextActionRecipes' --glob '!**/*.test.*' --glob '!**/*.spec.*' .
rg -n -F 'applyPiConfiguredDefaultSelectionUpdate' --glob '!**/*.test.*' --glob '!**/*.spec.*' .
printf '%s\n' '--- sourceControlAi object writers, excluding tests ---'
rg -n -C 3 '\bsourceControlAi\s*:' src --glob '*.{ts,tsx,js,jsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | head -n 500
printf '%s\n' '--- sourceControlAi type declarations and normalizers ---'
rg -n -C 5 'type .*SourceControlAi|interface .*SourceControlAi|SourceControlAi|normalizeSourceControlAiSettings|readSourceControlAiSettings' src --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | head -n 500Repository: stablyai/orca
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -u
printf '%s\n' '--- settings update imports, types, and call site ---'
sed -n '1,245p' src/main/persistence/applying-settings/settings-update.ts
printf '%s\n' '--- legacy retirement helper ---'
cat -n src/main/persistence/applying-settings/source-control-settings.ts
printf '%s\n' '--- selection update implementation ---'
cat -n src/shared/pi-configured-default-model-state.ts | sed -n '1,190p'
printf '%s\n' '--- GlobalSettings declarations ---'
rg -n -C 8 'GlobalSettings\s*=' src --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*'
rg -n -C 5 'sourceControlAi\??\s*:' src --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*'
printf '%s\n' '--- updateSettings entry points and schemas ---'
rg -n -C 10 'updateSettings\s*\(|update-settings|settings.*update|GlobalSettingsPatch|Partial<GlobalSettings>' src/main src/preload src/shared --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | head -n 800
printf '%s\n' '--- global recipe-save result flow ---'
cat -n src/shared/source-control-ai-recipe-save.ts | sed -n '1,235p'Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -u
printf '%s\n' '--- GlobalSettings sourceControlAi property ---'
rg -n -C 12 'sourceControlAi' src/shared/global-settings-types.ts
printf '%s\n' '--- settings IPC update handlers ---'
rg -n -C 18 "settings:update|settings:.*update|updateSettings" src/main/ipc/settings.ts src/main --glob '*.ts' --glob '!**/*.test.*' | head -n 500
printf '%s\n' '--- source-control normalization ---'
rg -n -C 25 'function normalizeSourceControlAiSettings|export function normalizeSourceControlAiSettings' src/shared/source-control-ai.ts
printf '%s\n' '--- all global settings sourceControlAi update call sites ---'
rg -n -C 6 "updateSettings\(\s*\{\s*sourceControlAi|updateSettings\(\{ sourceControlAi" src --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*'
printf '%s\n' '--- updateSettings callers passing generic update objects ---'
rg -n -C 5 'store\.updateSettings|\.updateSettings\(' src/main src/renderer src/preload --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | rg -v 'updateRepo|updateSettings\s*=' | head -n 800Repository: stablyai/orca
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -u
printf '%s\n' '--- settings IPC handler and sanitizer ---'
sed -n '1,215p' src/main/ipc/settings.ts
rg -n -C 20 'function sanitizeRendererSettingsUpdate|sanitizeRendererSettingsUpdate' src/main src/shared --glob '*.ts' --glob '!**/*.test.*'
printf '%s\n' '--- renderer settings update API ---'
rg -n -C 18 'updateSettings\s*:' src/renderer/src/store src/renderer/src --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | head -n 400
rg -n -C 12 "settings:set|updateSettings\(" src/renderer/src/store src/preload --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | head -n 500
printf '%s\n' '--- declarations involving nullish global sourceControlAi writes ---'
rg -n -C 5 'sourceControlAi\s*:\s*(undefined|null)|sourceControlAi\s*\?\?' src --glob '*.{ts,tsx,js,jsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' || true
printf '%s\n' '--- focused behavioral probe ---'
python3 - <<'PY'
def retire(source):
# Exact relevant behavior of retireLegacyInstructionsForClearedTextActionRecipes.
return source if not (source and source.get("actions")) else source
def normalize(value, legacy):
# Exact nullish fallback shape needed by the call-site question.
return value if value is not None else legacy
def apply(next_value):
# Exact first dereference in applyPiConfiguredDefaultSelectionUpdate.
return next_value["selectedModelByAgentByHost"]
for label, value in [
("undefined", None),
("null", None),
("object", {"selectedModelByAgentByHost": {}}),
]:
try:
result = apply(retire(value))
print(label, "call-site next dereference:", "ok", result)
except Exception as exc:
print(label, "call-site next dereference:", type(exc).__name__, str(exc))
PYRepository: stablyai/orca
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -u
printf '%s\n' '--- renderer persistence path ---'
rg -n -C 18 'function persistSettingsUpdates|const persistSettingsUpdates|persistSettingsUpdates' src/renderer/src/store src/renderer/src --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | head -n 240
printf '%s\n' '--- settings IPC/preload contract ---'
rg -n -C 10 "'settings:set'|settings:set|setSettings|updateSettings" src/preload src/renderer/src --glob '*.{ts,tsx}' --glob '!**/*.test.*' --glob '!**/*.spec.*' | head -n 300
printf '%s\n' '--- exact nullish call-site probe ---'
python3 - <<'PY'
UNDEFINED = object()
def retire(source):
# Mirrors `if (!sourceControlAi?.actions) return source`.
if source is UNDEFINED or source is None or not source.get("actions"):
return source
return source
def apply_selection_update(next_value):
# Mirrors the first property access in applyPiConfiguredDefaultSelectionUpdate.
return next_value["selectedModelByAgentByHost"]
def normalize(value, previous):
# Mirrors the nullish fallback used by normalizeSourceControlAiSettings.
return previous if value is UNDEFINED or value is None else value
previous = {"selectedModelByAgentByHost": {}}
for label, incoming in (
("undefined", UNDEFINED),
("null", None),
("object", {"selectedModelByAgentByHost": {}}),
):
retired = retire(incoming)
try:
apply_selection_update(retired)
status = "safe"
except (AttributeError, KeyError, TypeError) as exc:
status = f"crashes with {type(exc).__name__}"
fallback = normalize(retired, previous)
fallback_status = "object" if isinstance(fallback, dict) else type(fallback).__name__
print(f"{label}: {status}; later normalization yields {fallback_status}")
PYRepository: stablyai/orca
Length of output: 42614
Guard nullish sourceControlAi updates before applying Pi selection state. The retirement helper preserves undefined, and the IPC writer does not reject null. Pass sanitizedUpdates.sourceControlAi ?? previousSourceControlAi as next before normalization.
| const state: PiConfiguredDefaultModelState = | ||
| args.persistedState?.version === 1 | ||
| ? structuredClone(args.persistedState) | ||
| : { version: 1, defaultsByHost: {}, commitMessageSeedByHost: {} } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Validate the cloned persisted state shape, not just version.
Both state builders trust version === 1 and clone the persisted object as-is. The persisted payload is parsed from the on-disk JSON file, so defaultsByHost or commitMessageSeedByHost can be missing (hand-edited profile, or a rollback build that wrote only version). In that case structuredClone returns an object without those maps, and the seeding block below is skipped because args.persistedState is truthy.
Two downstream dereferences then throw:
applyPiConfiguredDefaultSelectionUpdateat Line 131 / Line 150 writesstate.defaultsByHost[hostKey] = true.selectPersistedModelinsrc/shared/source-control-ai.tsreadsconfiguredDefaultState?.defaultsByHost[hostKey]andconfiguredDefaultState?.commitMessageSeedByHost[hostKey], which runs on every commit-message, pull-request, and branch-name resolution.
Normalize the maps when you adopt persisted state. The same fix is needed at Lines 115-118.
🛡️ Proposed fix for both state builders
+function adoptPersistedState(
+ persisted: GlobalSettings['piConfiguredDefaultModelState']
+): PiConfiguredDefaultModelState {
+ const cloned = persisted?.version === 1 ? structuredClone(persisted) : undefined
+ return {
+ version: 1,
+ defaultsByHost: cloned?.defaultsByHost ?? {},
+ commitMessageSeedByHost: cloned?.commitMessageSeedByHost ?? {}
+ }
+}- const state: PiConfiguredDefaultModelState =
- args.persistedState?.version === 1
- ? structuredClone(args.persistedState)
- : { version: 1, defaultsByHost: {}, commitMessageSeedByHost: {} }
+ const state = adoptPersistedState(args.persistedState)- const state: PiConfiguredDefaultModelState =
- args.state?.version === 1
- ? structuredClone(args.state)
- : { version: 1, defaultsByHost: {}, commitMessageSeedByHost: {} }
+ const state = adoptPersistedState(args.state)| const markedDefault = | ||
| configuredDefaultState?.defaultsByHost[hostKey] === true && | ||
| repoModel === undefined && | ||
| operationModel === undefined && | ||
| persisted === PI_RETIRED_COPILOT_DEFAULT_MODEL_ID | ||
| const useConfiguredDefaultModel = | ||
| agentId === 'pi' && (persisted === PI_DEFAULT_MODEL_ID || markedOperationSeed || markedDefault) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
An explicit re-selection of github-copilot/gpt-5.4-mini stays treated as the configured default.
markedDefault trusts defaultsByHost[hostKey] whenever the resolved model equals the retired id. Provenance is cleared only by applyPiConfiguredDefaultSelectionUpdate, and that function skips a host when next === previous (Lines 127-129 of src/shared/pi-configured-default-model-state.ts).
Sequence that breaks the stated contract:
- Migration seeds
defaultsByHost.local = truewith the concrete valuegithub-copilot/gpt-5.4-mini. - The user opens the Pi model picker and explicitly selects that same model, which the PR keeps selectable.
- The write produces the identical string, so the diff finds no change and
defaultsByHost.localstaystrue. - Resolution reports
useConfiguredDefaultModel: true, and--modelis omitted.
The user's explicit selection is then ignored on every commit-message, pull-request, and branch-name generation. The PR objectives require that an explicit current selection of github-copilot/gpt-5.4-mini keeps emitting --model.
Fix the root cause in applyPiConfiguredDefaultSelectionUpdate: clear defaultsByHost[hostKey] and commitMessageSeedByHost[hostKey] whenever the incoming update carries a Pi selection for that host, instead of only when the value changes. Presence of the key in the write proves an explicit act; value equality does not.
nwparker
left a comment
There was a problem hiding this comment.
Review for the strict verification pass: this PR now changes persisted settings migration and per-host default tracking as well as CLI model selection. I cannot mark it fully verified from the argument-plan tests alone. The remaining acceptance run must use persisted pre-upgrade settings, distinguish implicit defaults from deliberately selected Copilot models, exercise explicit per-operation/per-host overrides, and actually generate branch/commit/PR text with the configured provider.
The Pi recipe also still includes --no-extensions. I separately reproduced #14951 with the actual Pi CLI: an extension-backed provider remains unavailable with that flag. Those users need the provider-loading fix too; do not count their configured-provider flow as verified by omitting --model alone. Leaving #14407 open and this PR unmerged for that complete integration pass.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/pi-default-runtime.yml (1)
4-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtend the
pathsfilter to the modules the smoke test exercises.The smoke test bundles and asserts against
src/shared/commit-message-plan.ts,src/shared/source-control-ai.ts,src/shared/constants.ts, and the Pi configured-default modules. The filter only triggers onsrc/shared/commit-message-agent-specs-primary.tsand the workflow/test files. A regression in the planner or the source-control resolver would not run this verification.♻️ Proposed filter extension
paths: - 'src/shared/commit-message-agent-specs-primary.ts' + - 'src/shared/commit-message-agent-spec.ts' + - 'src/shared/commit-message-plan.ts' + - 'src/shared/commit-message-plan-model.ts' + - 'src/shared/source-control-ai.ts' + - 'src/shared/source-control-ai-model-selection.ts' + - 'src/shared/pi-configured-default-model.ts' + - 'src/shared/pi-configured-default-model-state.ts' - 'tests/tools/pi-default-runtime-smoke.mjs' - '.github/workflows/pi-default-runtime.yml'
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 651e822e-c302-4327-9fb7-d135c44e7579
📒 Files selected for processing (24)
.github/workflows/pi-default-runtime.ymlsrc/main/persistence-source-control-ai-migration.test.tssrc/main/persistence/applying-settings/settings-update.tssrc/main/persistence/loading-store/normalize-loaded-global-settings.tssrc/main/persistence/loading-store/prepare-loaded-terminal-settings.tssrc/main/text-generation/commit-message-model-discovery-policy.tssrc/main/text-generation/commit-message-text-generation-model-discovery.test.tssrc/renderer/src/components/right-sidebar/SourceControlTextGenerationDialog.test.tssrc/renderer/src/components/right-sidebar/source-control/ai/text-generation-params.tssrc/shared/commit-message-agent-spec.test.tssrc/shared/commit-message-agent-spec.tssrc/shared/commit-message-agent-specs-primary.tssrc/shared/default-global-settings.tssrc/shared/global-settings-types.tssrc/shared/pi-configured-default-discovery.tssrc/shared/pi-configured-default-model-state.tssrc/shared/pi-configured-default-model.tssrc/shared/rpc-contract/git-params.tssrc/shared/source-control-ai-legacy-projection.tssrc/shared/source-control-ai-model-selection.tssrc/shared/source-control-ai-pi-default.test.tssrc/shared/source-control-ai-settings.tssrc/shared/source-control-ai.tstests/tools/pi-default-runtime-smoke.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| const previousSourceControlAi = normalizeSourceControlAiSettings( | ||
| operations.state.settings.sourceControlAi, | ||
| operations.state.settings.commitMessageAi | ||
| ) | ||
| sanitizedUpdates.piConfiguredDefaultModelState = applyPiConfiguredDefaultSelectionUpdate({ | ||
| previous: previousSourceControlAi, | ||
| next: sanitizedUpdates.sourceControlAi!, | ||
| state: operations.state.settings.piConfiguredDefaultModelState | ||
| }) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -B2 -A 40 'function normalizeSettings' src/shared/source-control-ai.tsRepository: stablyai/orca
Length of output: 151
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- candidate files ---'
fd -t f -i 'source-control-ai|settings-update' src
printf '%s\n' '--- settings-update target ---'
sed -n '1,70p;205,255p' src/main/persistence/applying-settings/settings-update.ts
printf '%s\n' '--- normalization and update definitions ---'
rg -n -B8 -A55 'normalizeSourceControlAiSettings|applyPiConfiguredDefaultSelectionUpdate|function normalizeSettings|normalizeSettings' srcRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- settings-update imports and update path ---'
sed -n '1,55p;215,252p' src/main/persistence/applying-settings/settings-update.ts
printf '%s\n' '--- source-control-ai normalization ---'
sed -n '1,180p' src/shared/source-control-ai-settings.ts
printf '%s\n' '--- default-state comparison and model lookup ---'
sed -n '1,130p' src/shared/pi-configured-default-model-state.tsRepository: stablyai/orca
Length of output: 15617
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- sourceControlAi update contract and callers ---'
rg -n -B6 -A12 'sourceControlAi\??:|sourceControlAi\s*[:=]' src/main src/shared src/renderer --glob '*.ts' --glob '*.tsx' \
| rg -n -m 120 'sourceControlAi|settings.update|updateSettings|writeSourceControlAiSettings|Partial<GlobalSettings>'
printf '%s\n' '--- updateSettings caller boundary ---'
rg -n -B12 -A18 'updateSettings\(' src/main --glob '*.ts' | head -n 240
printf '%s\n' '--- normalization entry and null handling ---'
rg -n -B8 -A18 'updateSettings\(|sanitizedUpdates\s*=|sourceControlAi.*undefined|sourceControlAi.*null' src/main/persistence/applying-settings/settings-update.ts src/main/persistence --glob '*.ts'Repository: stablyai/orca
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- retirement helper contract ---'
sed -n '1,90p' src/main/persistence/applying-settings/source-control-settings.ts
printf '%s\n' '--- global settings and IPC update boundary ---'
sed -n '450,480p' src/shared/global-settings-types.ts
rg -n -B12 -A20 'updateSettings.*ipc|settings.*update|updateSettings' src/main --glob '*.ts' \
| rg -n -m 100 'ipc|updateSettings|Partial<GlobalSettings>|sourceControlAi'
printf '%s\n' '--- tests for nullish global sourceControlAi updates ---'
rg -n -B8 -A18 'sourceControlAi:\s*(null|undefined)|sourceControlAi.*null|sourceControlAi.*undefined' src/main --glob '*test.ts'Repository: stablyai/orca
Length of output: 22782
Guard and normalize sourceControlAi before applying Pi state
normalizeSourceControlAiSettings does not merge legacy model fields into a present sourceControlAi value, so reordering normalization does not fix the claimed comparison mismatch.
If an update contains sourceControlAi: undefined or null, applyPiConfiguredDefaultSelectionUpdate receives that value and can throw when it reads selectedModelByAgentByHost. Use the normalized current value for both next and the persisted update:
const normalizedSourceControlAi = normalizeSourceControlAiSettings(
sanitizedUpdates.sourceControlAi ?? operations.state.settings.sourceControlAi,
operations.state.settings.commitMessageAi
)
sanitizedUpdates.piConfiguredDefaultModelState = applyPiConfiguredDefaultSelectionUpdate({
previous: previousSourceControlAi,
next: normalizedSourceControlAi,
state: operations.state.settings.piConfiguredDefaultModelState
})
sanitizedUpdates.sourceControlAi = normalizedSourceControlAi| marks[hostKey] = true | ||
| changed = true |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
Keep the migration idempotent.
When marks[hostKey] is already true, this branch still sets changed = true. Therefore, every startup with the Pi default selected calls markNeedsSave() and rewrites unchanged settings.
Set changed only when this migration adds the mark. Apply the same condition to commitMessageSeedByHost.
Proposed fix
if (modelForHost(choice, hostKey) === PI_DEFAULT_MODEL_ID) {
- marks[hostKey] = true
- changed = true
+ if (marks[hostKey] !== true) {
+ marks[hostKey] = true
+ changed = true
+ }
}There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 0c209310-60f3-446b-b1cb-caf7e4948c35
📒 Files selected for processing (10)
src/renderer/src/components/settings/CommitMessageAiPane.tsxsrc/renderer/src/components/settings/PiConfiguredModelReset.tsxsrc/renderer/src/components/settings/commit-message-ai-search.tssrc/renderer/src/i18n/locales/en.jsonsrc/shared/commit-message-agent-specs-primary.tssrc/shared/commit-message-plan.test.tssrc/shared/pi-source-control-model-reset.test.tssrc/shared/pi-source-control-model-reset.tssrc/shared/source-control-ai-pi-default.test.tstests/tools/pi-default-runtime-smoke.mjs
💤 Files with no reviewable changes (1)
- src/shared/commit-message-agent-specs-primary.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/shared/source-control-ai-pi-default.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| config.enabled && | ||
| matchesSettingsSearch(searchQuery, { | ||
| title: translate('settings.piConfiguredModelReset.title', 'Saved Pi model choices'), | ||
| description: translate('settings.piConfiguredModelReset.action', 'Use Pi’s configured model'), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use the reset description in both search metadata sites.
Searches for terms in the displayed description, such as “pull requests” or “branch names”, do not match this setting. Both sites use the shorter action label instead.
src/renderer/src/components/settings/CommitMessageAiPane.tsx#L229-L229: replacesettings.piConfiguredModelReset.actionwithsettings.piConfiguredModelReset.description.src/renderer/src/components/settings/commit-message-ai-search.ts#L8-L8: replacesettings.piConfiguredModelReset.actionwithsettings.piConfiguredModelReset.description.
📍 Affects 2 files
src/renderer/src/components/settings/CommitMessageAiPane.tsx#L229-L229(this comment)src/renderer/src/components/settings/commit-message-ai-search.ts#L8-L8
|
Closing as superseded: a merged PR already covers this change. Merged #21693 (b0cbb91, 09-19) made Pi's Source Control AI default 'default' and omits --model (src/shared/commit-message-agent-specs-primary.ts:234,239-247 'lets Pi use its configured provider'). The PR's extra reset UI and legacy migration did not (Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.) |
Pi source-control generation currently forces
github-copilot/gpt-5.4-mini, overriding the provider/model configured in Pi. This change adds Pi default, which omits--model; explicit Orca choices continue to override Pi for commit messages, PR details, and branch names.Fixes #14407. Preserves the original contributor history, merged onto current main and adapted to the extracted settings/planner modules.
Behavior and compatibility
Runtime evidence
Actual Pi CLI 0.83.0 on macOS, production operation resolver and command planner, isolated settings/models.json, and a local OpenAI-compatible HTTP fixture:
locallocallocaloverrideAll successful cases return
fixture-generated-commit. No real account credentials or paid model calls were needed. Reproduce withORCA_BACKGROUND_LAUNCH=1 node tests/tools/pi-default-runtime-smoke.mjs /path/to/pi/dist/cli.js.The added Pi configured default verification workflow repeats this actual CLI proof on Windows, Linux, and macOS with Pi 0.84.2. Its checks must pass before merging.
Compared against the checked-out Pi source:
packages/coding-agent/src/core/model-resolver.ts,findInitialModel, explicitly gives CLI overrides precedence over saved defaults.Validation
1cdf8bb, as did Windows packaging. Final test-only correctionacbc136942b97b49d55016d38cd4272519981abaconsolidates a duplicate test import caught by CI's native-plugin rule. Full native/type-aware audits, 17 affected tests, RPC catalog and max-lines checks pass locally; localization extraction/catalog/runtime/coverage and changed-code checks also passed. The final configured-default matrix, provider matrix, and full PR CI are pending. Merge remains blocked until all pass.Current rendered proof
Hidden Electron instance identity verified as
pi-default-provider-verify @ review/pi-default-provider, CDP 9339. No window activation. Inspected dark and light themes.Three actual reset clicks passed: saved Copilot choices disappear, success toast renders, and settings retain the other agent, another SSH host’s Pi model, and recipe arguments. Reloaded the renderer and verified persisted settings. Then the real Pi CLI smoke test loaded the app’s saved settings and successfully generated through branch-name, commit-message, and PR-detail resolution.
Before reset (settings search finds the host-scoped control):
After reset (saved override removed and success shown):
Agent skill upstream boundary
Not applicable; no skill source or bundle changes.