fix(cache): declare the provider env overrides on the extraction layout - #942
Open
ozymandiashh wants to merge 1 commit into
Open
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
mainand lives on the pre-extractionsrc/layout. This branch moved the CLI topackages/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_VARShere 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-bobandvercel-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-clidoes not exist on this branch — it arrives with #940. ItsCLINE_*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
computeEnvFingerprinthashes the map at runtime, andgetOrCreateProviderSectioncompares computed against stored — so a changed map already invalidates exactly the affected providers' sections and forces their one-time re-parse. ACACHE_VERSIONbump 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 indoctor.test.ts, and 24 guard findings across 12 providers. After: 109/109 on the three CLI files, core 509/509.