Repository navigation
test: isolate provider-home env vars so developer shells cannot leak sessions - #1064
Merged
iamtoruk merged 2 commits intoAug 21, 2026
Merged
Conversation
…sessions HERMES_HOME and eight sibling PROVIDER_ENV_VARS data-dir overrides were fingerprinted for cache invalidation but never CLEARED by the vitest setup file, so a Hermes-shell laptop parsed real sessions in fixtures. A static guard fails closed when the map grows another undeclared home.
Extra High MERGE AFTER FIX: source-scraping the setup file treated a comment containing 'HERMES_HOME' as isolation. The lists now live in a side-effect-free module that applyIsolation and the declaration test both import. Comment-only sabotage fails with hermes:HERMES_HOME.
iamtoruk
added a commit
to kelchm/codeburn
that referenced
this pull request
Aug 22, 2026
Resolves the conflicts getagentseal#946 accumulated while it was in validation. Eight files conflicted; the session-store accounting is unchanged. src/daily-cache.ts — version collision. This PR minted 25 when main was at 24; getagentseal#1056 (`codex-auto-review` pricing) then spent 25 on main. The bump moves to 26/MIN 26 and daily-cache.v26.json, with main's full comment ladder kept as the foundation and this PR's paragraph rewritten to name 26 and record the collision. PENDING_REDERIVE_PROVIDERS and the B1 migration semantics from b6481c1 carry over intact, retargeted at 26. src/models.ts, src/parser.ts, src/audit-report.ts, src/models-report.ts — getagentseal#1075/getagentseal#1078 replaced the per-site "reasoning is already inside output" tests with billableOutputTokens() and REASONING_INCLUDED_IN_OUTPUT. This PR had added copilot to that case at three sites independently. Union: all three sites take main's helper call verbatim, and copilot joins claude and codex in the set — same accounting this PR shipped, now through main's single source of truth. It also reaches parser.ts activeGeneratedTokens (a fourth site, from getagentseal#1079), which is the same correction: a copilot supplementary call carries reasoning with output 0, so counting it as generated repeats the per-turn output. The audit legend already said so on this side. src/providers/copilot.ts — comment-only. getagentseal#1054's lastEventTimestamp-first shutdown fallback was derived from this branch, so the code was already identical on both sides: the `shutdownTimestamp` expression and the `copilot:<sid>:shutdown:<model>:<n>` key are byte-for-byte main's. Both rationales are kept (leg-collapse on date, and residual anchoring). src/session-cache.ts — PROVIDER_PARSE_VERSIONS.copilot takes this PR's `-session-store-v3` suffix; main's getagentseal#1051 note about why a fingerprint change is expensive is kept above it. Codex keeps main's getagentseal#1092 suffix chain untouched. src/main.ts — getagentseal#1067 deleted the unreachable live dailyMap fallback that this PR had taught behavioral weight. Main's deletion wins; the now-unused isBehavioralTurn import goes with it. tests/parser.test.ts — import union. Also: scripts/upgrade-path/run.mjs NEW_DAILY_CACHE -> daily-cache.v26.json, CODEBURN_COPILOT_SESSION_STORE_DB added to the getagentseal#1064 env-isolation CLEARED list, and the CHANGELOG entry's stale "v21" corrected to v26. Verified: tsc clean; 3132 tests pass across 223 files; test:locks 26/26; verify:upgrade PASSED, re-deriving daily-cache.v26.json and holding durable copilot history across the bump. getagentseal#1054's regression ("keeps three stampless shutdown legs as :n keys with lastEventTimestamp") passes on the merged tree. Real-corpus A/B against origin/main over 2026-07-01..2026-08-22: codex, grok, kimicode and opencode byte-identical in export, audit and models; claude drifts only monotonically with run order (a live session writing transcripts, confirmed by interleaving four runs). This machine has no copilot data, so the copilot recovery semantics rest on the suites and the upgrade-path corpus.
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.
Problem
Fixture-based tests parse the developer's real provider sessions whenever a data-dir override is set in the shell. The named hole is
HERMES_HOME: vitest setup redirectsHOMEinto a sandbox but leftHERMES_HOMEintact, sosrc/providers/hermes.ts(override ?? process.env['HERMES_HOME'] ?? ~/.hermes) reads the live Hermes DB. That is green on CI (noHERMES_HOME) and red on a Hermes-shell laptop — 50 local failures in one wave, all pre-existing, none from product code.This is not a Hermes-only spelling.
PROVIDER_ENV_VARSalready fingerprints the override for cache invalidation; eight other entries in that map were equally missing from the test CLEARED list.Root cause
tests/setup/env-isolation.tsclaims to delete every provider's explicit override. The list was maintained by hand and drifted fromPROVIDER_ENV_VARS. There was no guard that a new*_HOME/CODEBURN_*_DIRin the fingerprint map also has to be isolated.Change
HERMES_HOME,DSH_HOME,KIMI_CODE_HOME,LINGTAI_HOME,LINGTAI_TUI_HOME,LINGTAI_TUI_GLOBAL_DIR,QUICKWORK_HOME,CODEBURN_OPEN_DESIGN_DIR,CODEBURN_OPENCLAUDE_DIR.CODEBURN_COPILOT_GLOBAL_STORAGE_DIRnext to the other Copilot dir overrides already on the list (Copilot stays undeclared inPROVIDER_ENV_VARSon purpose).tests/env-isolation-declarations.test.ts: everyPROVIDER_ENV_VARSentry must appear inCLEARED∪REDIRECTED. Sabotage: dropHERMES_HOMEfromCLEARED→ the new test fails withhermes:HERMES_HOME.User impact
None for
codeburn status/ caches / pricing. Developers running the suite inside a Hermes (or Lingtai / DSH / …) shell no longer ingest live session DBs into fixture parses.Preservation
No
src/change. NoCACHE_VERSION/ parse-version bump.CODEBURN_PRICING_SNAPSHOT_ONLYandCODEBURN_FX_NO_FETCHstay forced-on (not cleared). Copilot remains undeclared inPROVIDER_ENV_VARS. No Keychain / Buzz / #868 / #916 / #998. Does not invent rates.Testing
tests/provider-env-declarations.test.ts(3)tests/providers/hermes.test.ts(26) +tests/hermes-pr-links-pipeline.test.ts(1)/tmp/codeburn-xhigh-review/VERDICT-1064.md): source-scrape treated a comment containing'HERMES_HOME'as isolation. Follow-up094f9f1moves CLEARED/REDIRECTED to a side-effect-free module that applyIsolation and the guard both import. Comment-only sabotage now fails withhermes:HERMES_HOME.tsc --noEmitclean