Skip to content

fix(cache): declare the provider env overrides on the extraction layout - #942

Open
ozymandiashh wants to merge 1 commit into
getagentseal:feat/core-extractionfrom
ozymandiashh:fix/port-env-fingerprints
Open

fix(cache): declare the provider env overrides on the extraction layout#942
ozymandiashh wants to merge 1 commit into
getagentseal:feat/core-extractionfrom
ozymandiashh:fix/port-env-fingerprints

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

Re-ports #927 onto this branch's layout, because merging the extraction to main without it regresses #920.

Why this exists

#927 is open against main and lives on the pre-extraction src/ layout. This branch moved the CLI to packages/cli/. Two independent cross-PR reviewers concluded, by different routes, that the extraction merge would drop that fix — and because the file moved, rename detection may not carry it.

I verified the gap rather than trusting the conclusion: PROVIDER_ENV_VARS here declares strictly fewer providers than #927 does, and #927 has nothing this branch lacks.

What the gap actually costs

That map feeds computeEnvFingerprint. A provider absent from it means its session cache is not invalidated when the user changes the env var that relocates its data — so codeburn keeps serving cached sessions from a directory the user has since pointed somewhere else. That is precisely what #920 fixed.

Scope is larger than first estimated

My own count was nine providers, taken from a partial comparison. The ported guard test finds twelve undeclared, including claude, cursor, ibm-bob and vercel-gateway — which my list missed. The guard is what found them, which is the argument for porting the guard and not just the map.

One declaration deliberately not ported

cline-cli does not exist on this branch — it arrives with #940. Its CLINE_* declaration has nothing to attach to here, so it is left out. When #940 lands, the ported guard will fail loudly demanding that declaration, which is the behaviour you want rather than a silent hole.

No cache version bump, on purpose

computeEnvFingerprint hashes the map at runtime, and getOrCreateProviderSection compares computed against stored — so a changed map already invalidates exactly the affected providers' sections and forces their one-time re-parse. A CACHE_VERSION bump would re-parse every provider for no reason. Verified against the code, not assumed.

Verification

Before the port, against the current map: 10 failures in session-cache.test.ts, 4 in doctor.test.ts, and 24 guard findings across 12 providers. After: 109/109 on the three CLI files, core 509/509.

…ns onto the extraction layout

The env-fingerprint fix ships on main via PR getagentseal#927, but merging the
extraction branch as-is would silently drop it: the CLI moved from src/ to
packages/cli/ and rename detection does not carry the declaration change
across, so PROVIDER_ENV_VARS here declares fewer providers than main. A
provider absent from that map is never cache-invalidated when the user
changes the env var that relocates its data — codeburn keeps serving
cached sessions from a directory the user has since pointed elsewhere,
which is the exact defect getagentseal#920 fixed. The extraction side had nothing getagentseal#927
lacks, so this is a strict-superset port of the end state.

Port the full end state of fork/fix/920-provider-env-fingerprints, not
just the nine headline providers: the follow-up commits changed existing
declarations too (claude, cursor, goose, crush, ibm-bob gained vars;
cursor's entry was corrected from XDG_DATA_HOME to
CODEBURN_CURSOR_MAX_BUBBLES), added the vercel-gateway credential
declaration with the read-only-refresh rationale, and reworked doctor to
skip ambient Windows paths (APPDATA/LOCALAPPDATA) and redact credential
values.

Declarations added or extended for: codebuff, claude, crush, cursor,
goose, grok, ibm-bob, kilo-code, kimi, kiro, mistral-vibe, mux,
open-design, vercel-gateway, zerostack. Copilot stays deliberately
undeclared (declaring it would force the durable re-parse that loses
pruned OTel history); the guard test pins that intent.

cline-cli has no counterpart on this branch: the provider file exists only
on the sibling fix/rehome-new-files branch, and this branch's cline is a
bridged scanner with zero process.env reads, so the CLINE_* vars getagentseal#927
declared have nothing to attach to here. The ported guard test will fail
loudly if/when cline-cli lands, exactly as intended.

Tests ported and adapted (paths only): the provider-env-declarations
static guard (every process.env read in src/providers must be declared or
allowlisted, file-scoped), the getagentseal#920 fingerprint cases, and the doctor
override/redaction/ambient cases. The CODEBURN_VERBOSE allowlist moved
from sqlite-session-parser.ts (original) to opencode.ts and kilo-code.ts,
where that read lives on this branch. Each test was confirmed FAILING
against the pre-port map: 10 fingerprint cases, 4 doctor cases, and 24
guard findings across 12 providers.

No cache version bump: computeEnvFingerprint hashes the map at runtime,
so the changed map already changes the fingerprint for exactly the
affected providers and forces their one-time re-parse; a version bump
would re-parse every provider globally for no reason.

Verify: npx vitest run tests/session-cache.test.ts tests/doctor.test.ts
tests/provider-env-declarations.test.ts --root packages/cli (109 pass);
npm test --workspace=@codeburn/core (509 pass).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant