Repository navigation
fix(settings): older clients connect again after idle compaction modes #23454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
c734c56
d7ff637
169bd47
e60df3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ import { useEffect, useRef, useState } from "react"; | |
| import { | ||
| type DesktopUpdateChannel, | ||
| IDLE_COMPACTION_MODES, | ||
| globalIdleCompaction, | ||
| readsIdleCompactionModes, | ||
| ProviderDriverKind, | ||
| type ProviderInstanceId, | ||
| type SidebarProjectGroupingMode, | ||
|
|
@@ -996,40 +998,45 @@ export function GeneralSettingsPanel() { | |
|
|
||
| <SettingsRow | ||
| serverScoped | ||
| settingKeys={["compactIdleThreads"]} | ||
| settingKeys={["idleCompaction", "compactIdleThreads"]} | ||
| {...searchableSetting("compact-idle-threads")} | ||
| description="When to compact an idle Claude thread over 200,000 tokens: after you return, just before its prompt cache expires, or never. Each Claude provider can override this." | ||
| resetAction={ | ||
| settings.compactIdleThreads !== DEFAULT_UNIFIED_SETTINGS.compactIdleThreads ? ( | ||
| globalIdleCompaction(settings) !== globalIdleCompaction(DEFAULT_UNIFIED_SETTINGS) ? ( | ||
| <SettingResetButton | ||
| label="compact idle threads" | ||
| onClick={() => | ||
| updateSettings({ | ||
| compactIdleThreads: DEFAULT_UNIFIED_SETTINGS.compactIdleThreads, | ||
| }) | ||
| updateSettings({ idleCompaction: globalIdleCompaction(DEFAULT_UNIFIED_SETTINGS) }) | ||
| } | ||
| /> | ||
| ) : null | ||
| } | ||
| control={ | ||
| <Select | ||
| value={settings.compactIdleThreads} | ||
| value={globalIdleCompaction(settings)} | ||
| onValueChange={(value) => { | ||
| const mode = IDLE_COMPACTION_MODES.find((candidate) => candidate.value === value); | ||
| if (mode) updateSettings({ compactIdleThreads: mode.value }); | ||
| if (mode) updateSettings({ idleCompaction: mode.value }); | ||
| }} | ||
| > | ||
| <SelectTrigger size="sm" className="w-full sm:w-56" aria-label="Compact idle threads"> | ||
| <SelectValue> | ||
| { | ||
| IDLE_COMPACTION_MODES.find((mode) => mode.value === settings.compactIdleThreads) | ||
| ?.label | ||
| IDLE_COMPACTION_MODES.find( | ||
| (mode) => mode.value === globalIdleCompaction(settings), | ||
| )?.label | ||
| } | ||
| </SelectValue> | ||
| </SelectTrigger> | ||
| <SelectPopup align="end" alignItemWithTrigger={false}> | ||
| {IDLE_COMPACTION_MODES.map((mode) => ( | ||
| <SelectItem hideIndicator key={mode.value} value={mode.value}> | ||
| <SelectItem | ||
| hideIndicator | ||
| key={mode.value} | ||
| value={mode.value} | ||
| // A server from before modes has only the on/off switch, so it cannot store "Never". | ||
| disabled={mode.value === "off" && !readsIdleCompactionModes(settings)} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
rg -n -C 5 --glob '*.ts' --glob '*.tsx' \
'function useScopedSettings\b|const useScopedSettings\b|function useSettingsScope\b|const useSettingsScope\b' \
apps/web/srcRepository: pingdotgg/t3code Length of output: 2125 🏁 Script executed: set -o pipefail
printf '%s\n' '--- useScopedSettings.ts ---'
nl -ba apps/web/src/components/settings/useScopedSettings.ts | sed -n '1,120p'
printf '%s\n' '--- SettingsScopeContext.tsx ---'
nl -ba apps/web/src/components/settings/SettingsScopeContext.tsx | sed -n '1,190p'
printf '%s\n' '--- scopedSettings.ts relevant declarations ---'
nl -ba apps/web/src/components/settings/scopedSettings.ts | sed -n '1,380p'
printf '%s\n' '--- SettingsPanels.tsx control context ---'
nl -ba apps/web/src/components/settings/SettingsPanels.tsx | sed -n '960,1085p'
printf '%s\n' '--- references to provider/target/all-environment scope ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'SettingsScopeProvider' -e 'target:' -e 'all-environments' -e 'allEnvironments' -e 'planScopedSettingsPatch' apps/web/src packages/contracts/srcRepository: pingdotgg/t3code Length of output: 42443 🏁 Script executed: set -o pipefail
printf '%s\n' '--- SettingsPanels.tsx exact control ---'
nl -ba apps/web/src/components/settings/SettingsPanels.tsx | sed -n '990,1065p'
printf '%s\n' '--- SettingsPanels idle-compaction references ---'
rg -n -C 8 -F -- 'readsIdleCompactionModes' apps/web/src/components/settings/SettingsPanels.tsx apps/web/src
printf '%s\n' '--- scopedSettings planner exact branch ---'
nl -ba apps/web/src/components/settings/scopedSettings.ts | sed -n '205,330p'
printf '%s\n' '--- settings scope kinds and all selection ---'
nl -ba apps/web/src/components/settings/settingsScope.ts | sed -n '1,260p'
printf '%s\n' '--- settings route provider ---'
nl -ba apps/web/src/routes/settings.tsx | sed -n '130,180p'Repository: pingdotgg/t3code Length of output: 25167 🏁 Script executed: set -o pipefail
printf '%s\n' '--- idle compaction contract declarations ---'
rg -n -C 12 -F -- 'readsIdleCompactionModes' packages apps
rg -n -C 16 -F -- 'function idleCompactionPatch' packages apps
rg -n -C 10 -F -- 'idleCompactionPatch' packages/contracts/src apps/web/src/components/settings
printf '%s\n' '--- idle compaction compatibility tests ---'
rg -n -C 12 -F -- 'Never' apps/web/src/components/settings packages/contracts/src
rg -n -C 12 -F -- 'compactIdleThreads: false' apps/web/src/components/settings packages/contracts/srcRepository: pingdotgg/t3code Length of output: 37336 🏁 Script executed: set -o pipefail
printf '%s\n' '--- SettingsPanels imports and component setup ---'
nl -ba apps/web/src/components/settings/SettingsPanels.tsx | sed -n '1,90p'
rg -n -C 8 -F -- 'useScopedSettings(' apps/web/src/components/settings/SettingsPanels.tsx
rg -n -C 8 -F -- 'useScopedSettingsMixed' apps/web/src/components/settings/SettingsPanels.tsx apps/web/src/components/settings
rg -n -C 8 -F -- 'useScopedSettingSource' apps/web/src/components/settings/SettingsPanels.tsx apps/web/src/components/settingsRepository: pingdotgg/t3code Length of output: 41665 Disable “Never” unless every selected destination supports modes.
🐛 Suggested fix const hasServerTargets = connectedEnvironments.length > 0;
+const allConnectedEnvironmentsReadIdleCompactionModes = connectedEnvironments.every(
+ (environment) =>
+ environment.serverConfig !== null &&
+ readsIdleCompactionModes(environment.serverConfig.settings),
+);
...
- disabled={mode.value === "off" && !readsIdleCompactionModes(settings)}
+ disabled={
+ mode.value === "off" && !allConnectedEnvironmentsReadIdleCompactionModes
+ }🤖 Prompt for AI Agents |
||
| > | ||
| {mode.label} | ||
| </SelectItem> | ||
| ))} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.