mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-12-03 12:32:02 +00:00
fix(cache): declare the provider env overrides that must invalidate the cache
Nine providers honor an env var that relocates where discovery looks, but the var was never declared in PROVIDER_ENV_VARS, so computeEnvFingerprint() did not hash it and the provider's cache section survived the change: sessions parsed from the old root kept being reported and the new root was never read, with no diagnostic anywhere (#920, same silent-wrong-numbers family as #874). Declare every env var that changes what a provider discovers or how its sessions parse, including the platform path vars that resolve a discovery root on Windows and Linux, and the CodeBurn-side directory overrides. Ambient platform vars (APPDATA, LOCALAPPDATA, XDG_CONFIG_HOME, XDG_DATA_HOME) are set by the OS or the desktop session for everyone, so doctor must not name them as a deliberate override: without the guard every Windows user would be told Claude and Copilot discovery runs under an override. They stay in the fingerprint - a change to them does move the discovery root - but doctor skips them when collecting overrides, and the probed paths it already prints show where CodeBurn looked.
This commit is contained in:
parent
45d98a373f
commit
36004080a6
2 changed files with 33 additions and 5 deletions
|
|
@ -104,12 +104,20 @@ const PARSE_SPAWNS = new Set(['antigravity'])
|
|||
// in a NOTHING FOUND hint.
|
||||
const NON_DISCOVERY_ENV_VARS = new Set(['CODEBURN_CACHE_DIR'])
|
||||
|
||||
// Ambient platform paths (set by the OS or desktop session for everyone), not
|
||||
// deliberate user overrides: they are fingerprinted (a change to them does
|
||||
// move the discovery root, so the cache must invalidate) but doctor must not
|
||||
// name them as an override, because the probed paths it already prints show
|
||||
// exactly where CodeBurn looked.
|
||||
const AMBIENT_ENV_VARS = new Set(['APPDATA', 'LOCALAPPDATA', 'XDG_CONFIG_HOME', 'XDG_DATA_HOME'])
|
||||
|
||||
// ── Collect (pure, testable) ─────────────────────────────────────────────
|
||||
|
||||
function collectEnvOverrides(providerName: string): DoctorEnvOverride[] {
|
||||
const vars = PROVIDER_ENV_VARS[providerName] ?? []
|
||||
const out: DoctorEnvOverride[] = []
|
||||
for (const name of vars) {
|
||||
if (AMBIENT_ENV_VARS.has(name)) continue
|
||||
const value = process.env[name]
|
||||
if (value !== undefined && value !== '') out.push({ name, value })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,25 +171,45 @@ const CACHE_FILE = `session-cache.v${CACHE_VERSION}.json`
|
|||
const LEGACY_CACHE_FILE = 'session-cache.json'
|
||||
const TEMP_FILE_MAX_AGE_MS = 5 * 60 * 1000
|
||||
|
||||
// Env vars that change what a provider discovers or how its sessions parse.
|
||||
// computeEnvFingerprint hashes exactly these to decide when a provider's cache
|
||||
// section is stale; a var read by the provider but missing here means changing
|
||||
// it serves the old section silently, reporting nothing from the new root.
|
||||
// Two reads in src/providers/ are deliberately absent: CODEBURN_VERBOSE
|
||||
// (sqlite-session-parser.ts) only changes logging verbosity, never parsed
|
||||
// output, and AI_GATEWAY_API_KEY / VERCEL_OIDC_TOKEN (vercel-gateway.ts) are
|
||||
// network credentials — vercel-gateway is network:true, and parser.ts:2888
|
||||
// short-circuits it past the fingerprint compare, re-fetching its synthetic
|
||||
// source every run, so no cached section of it can go stale.
|
||||
export const PROVIDER_ENV_VARS: Record<string, string[]> = {
|
||||
claude: ['CLAUDE_CONFIG_DIRS', 'CLAUDE_CONFIG_DIR'],
|
||||
claude: ['CLAUDE_CONFIG_DIRS', 'CLAUDE_CONFIG_DIR', 'CODEBURN_DESKTOP_SESSIONS_DIR', 'APPDATA', 'LOCALAPPDATA'],
|
||||
'cline-cli': ['CLINE_SESSION_DATA_DIR', 'CLINE_DATA_DIR', 'CLINE_DIR'],
|
||||
codebuff: ['CODEBUFF_DATA_DIR'],
|
||||
codewhale: ['CODEWHALE_HOME'],
|
||||
codex: ['CODEX_HOME'],
|
||||
copilot: ['CODEBURN_COPILOT_SESSION_STATE_DIR', 'CODEBURN_COPILOT_OTEL_DB', 'CODEBURN_COPILOT_JETBRAINS_DIR', 'CODEBURN_COPILOT_WS_STORAGE_DIR', 'CODEBURN_COPILOT_GLOBAL_STORAGE_DIR', 'CODEBURN_COPILOT_DISABLE_OTEL', 'APPDATA', 'LOCALAPPDATA', 'XDG_CONFIG_HOME'],
|
||||
hermes: ['HERMES_HOME'],
|
||||
'lingtai-tui': ['LINGTAI_HOME', 'LINGTAI_TUI_HOME', 'LINGTAI_TUI_GLOBAL_DIR'],
|
||||
droid: ['FACTORY_DIR'],
|
||||
cursor: ['XDG_DATA_HOME'],
|
||||
cursor: ['XDG_DATA_HOME', 'CODEBURN_CURSOR_MAX_BUBBLES'],
|
||||
'cursor-agent': ['XDG_DATA_HOME'],
|
||||
'open-design': ['CODEBURN_OPEN_DESIGN_DIR', 'APPDATA'],
|
||||
opencode: ['XDG_DATA_HOME', 'OPENCODE_DATA_DIR', 'OPENCODE_DB_PREFIX'],
|
||||
goose: ['XDG_DATA_HOME'],
|
||||
crush: ['XDG_DATA_HOME'],
|
||||
goose: ['XDG_DATA_HOME', 'GOOSE_PATH_ROOT'],
|
||||
grok: ['GROK_HOME'],
|
||||
crush: ['XDG_DATA_HOME', 'CRUSH_GLOBAL_DATA', 'LOCALAPPDATA'],
|
||||
warp: ['WARP_DB_PATH'],
|
||||
antigravity: ['CODEBURN_CACHE_DIR'],
|
||||
'kilo-code': ['XDG_DATA_HOME'],
|
||||
kimi: ['KIMI_SHARE_DIR', 'KIMI_MODEL_NAME'],
|
||||
kiro: ['KIRO_HOME'],
|
||||
'mistral-vibe': ['VIBE_HOME'],
|
||||
mux: ['MUX_ROOT', 'CODEBURN_MUX_DIR'],
|
||||
qwen: ['QWEN_DATA_DIR'],
|
||||
'ibm-bob': ['XDG_CONFIG_HOME'],
|
||||
'ibm-bob': ['XDG_CONFIG_HOME', 'APPDATA'],
|
||||
quickdesk: ['QUICKWORK_HOME'],
|
||||
kimicode: ['KIMI_CODE_HOME'],
|
||||
zerostack: ['ZS_DATA_DIR', 'XDG_DATA_HOME'],
|
||||
}
|
||||
|
||||
// Names of providers whose cache entries are never evicted when source files
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue