Fix: Dev server detection bug fixes. Settings sync bug fixes. Cli provider fixes. Terminal background/foreground colors (#791)

* Changes from fix/dev-server-state-bug

* feat: Add configurable max turns setting with user overrides. Address pr comments

* fix: Update default behaviors and improve state management across server and UI

* feat: Extract branch sync logic to separate service. Fix settings sync bug. Address pr comments

* refactor: Extract magic numbers to named constants and improve branch tracking logic

- Add DEFAULT_MAX_TURNS (1000) and MAX_ALLOWED_TURNS (2000) constants to settings-helpers
- Replace hardcoded 1000 values with DEFAULT_MAX_TURNS constant throughout codebase
- Improve max turns validation with explicit Number.isFinite check
- Update getTrackingBranch to split on first slash instead of last for better remote parsing
- Change isBranchCheckedOut return type from boolean to string|null to return worktree path
- Add comments explaining skipFetch parameter in worktree creation
- Fix cleanup order in AgentExecutor finally block to run before logging
```

* feat: Add comment refresh and improve model sync in PR dialog
This commit is contained in:
gsxdsm
2026-02-21 08:57:04 -08:00
committed by GitHub
parent c81ea768a7
commit 3ddf26f666
41 changed files with 2705 additions and 274 deletions

View File

@@ -49,6 +49,8 @@ const SETTINGS_FIELDS_TO_SYNC = [
'fontFamilyMono',
'terminalFontFamily', // Maps to terminalState.fontFamily
'openTerminalMode', // Maps to terminalState.openTerminalMode
'terminalCustomBackgroundColor', // Maps to terminalState.customBackgroundColor
'terminalCustomForegroundColor', // Maps to terminalState.customForegroundColor
'sidebarOpen',
'sidebarStyle',
'collapsedNavSections',
@@ -90,8 +92,14 @@ const SETTINGS_FIELDS_TO_SYNC = [
'editorAutoSave',
'editorAutoSaveDelay',
'defaultTerminalId',
'enableAiCommitMessages',
'enableSkills',
'skillsSources',
'enableSubagents',
'subagentsSources',
'promptCustomization',
'eventHooks',
'claudeCompatibleProviders',
'claudeApiProfiles',
'activeClaudeApiProfileId',
'projects',
@@ -109,6 +117,8 @@ const SETTINGS_FIELDS_TO_SYNC = [
'codexEnableImages',
'codexAdditionalDirs',
'codexThreadId',
// Max Turns Setting
'defaultMaxTurns',
// UI State (previously in localStorage)
'worktreePanelCollapsed',
'lastProjectDir',
@@ -143,6 +153,12 @@ function getSettingsFieldValue(
if (field === 'openTerminalMode') {
return appState.terminalState.openTerminalMode;
}
if (field === 'terminalCustomBackgroundColor') {
return appState.terminalState.customBackgroundColor;
}
if (field === 'terminalCustomForegroundColor') {
return appState.terminalState.customForegroundColor;
}
if (field === 'autoModeByWorktree') {
// Only persist settings (maxConcurrency), not runtime state (isRunning, runningTasks)
const autoModeByWorktree = appState.autoModeByWorktree;
@@ -186,6 +202,16 @@ function hasSettingsFieldChanged(
if (field === 'openTerminalMode') {
return newState.terminalState.openTerminalMode !== prevState.terminalState.openTerminalMode;
}
if (field === 'terminalCustomBackgroundColor') {
return (
newState.terminalState.customBackgroundColor !== prevState.terminalState.customBackgroundColor
);
}
if (field === 'terminalCustomForegroundColor') {
return (
newState.terminalState.customForegroundColor !== prevState.terminalState.customForegroundColor
);
}
const key = field as keyof typeof newState;
return newState[key] !== prevState[key];
}
@@ -731,6 +757,7 @@ export async function refreshSettingsFromServer(): Promise<boolean> {
? migratePhaseModelEntry(serverSettings.defaultFeatureModel)
: { model: 'claude-opus' },
muteDoneSound: serverSettings.muteDoneSound,
defaultMaxTurns: serverSettings.defaultMaxTurns ?? 1000,
disableSplashScreen: serverSettings.disableSplashScreen ?? false,
serverLogLevel: serverSettings.serverLogLevel ?? 'info',
enableRequestLogging: serverSettings.enableRequestLogging ?? true,
@@ -747,7 +774,7 @@ export async function refreshSettingsFromServer(): Promise<boolean> {
copilotDefaultModel: sanitizedCopilotDefaultModel,
enabledDynamicModelIds: sanitizedDynamicModelIds,
disabledProviders: serverSettings.disabledProviders ?? [],
autoLoadClaudeMd: serverSettings.autoLoadClaudeMd ?? false,
autoLoadClaudeMd: serverSettings.autoLoadClaudeMd ?? true,
keyboardShortcuts: {
...currentAppState.keyboardShortcuts,
...(serverSettings.keyboardShortcuts as unknown as Partial<
@@ -786,7 +813,12 @@ export async function refreshSettingsFromServer(): Promise<boolean> {
codexAdditionalDirs: serverSettings.codexAdditionalDirs ?? [],
codexThreadId: serverSettings.codexThreadId,
// Terminal settings (nested in terminalState)
...((serverSettings.terminalFontFamily || serverSettings.openTerminalMode) && {
...((serverSettings.terminalFontFamily ||
serverSettings.openTerminalMode ||
(serverSettings as unknown as Record<string, unknown>).terminalCustomBackgroundColor !==
undefined ||
(serverSettings as unknown as Record<string, unknown>).terminalCustomForegroundColor !==
undefined) && {
terminalState: {
...currentAppState.terminalState,
...(serverSettings.terminalFontFamily && {
@@ -795,6 +827,16 @@ export async function refreshSettingsFromServer(): Promise<boolean> {
...(serverSettings.openTerminalMode && {
openTerminalMode: serverSettings.openTerminalMode,
}),
...((serverSettings as unknown as Record<string, unknown>)
.terminalCustomBackgroundColor !== undefined && {
customBackgroundColor: (serverSettings as unknown as Record<string, unknown>)
.terminalCustomBackgroundColor as string | null,
}),
...((serverSettings as unknown as Record<string, unknown>)
.terminalCustomForegroundColor !== undefined && {
customForegroundColor: (serverSettings as unknown as Record<string, unknown>)
.terminalCustomForegroundColor as string | null,
}),
},
}),
});