mirror of
https://github.com/yigitkonur/cli-continues.git
synced 2026-04-26 00:36:02 +03:00
[PR #28] [MERGED] fix: respect CLAUDE_CONFIG_DIR by invalidating stale index cache #28
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cli-continues#28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/yigitkonur/cli-continues/pull/28
Author: @yigitkonur
Created: 3/2/2026
Status: ✅ Merged
Merged: 3/2/2026
Merged by: @yigitkonur
Base:
main← Head:fix/env-var-cache-invalidation📝 Commits (2)
0ce9046fix: deduplicate env vars and hash fingerprint for privacy6c238f9fix: update tests for dedup+hash fingerprint📊 Changes
4 files changed (+87 additions, -85 deletions)
View changed files
📝
src/__tests__/env-cache-invalidation.test.ts(+13 -5)📝
src/parsers/qwen-code.ts(+56 -71)📝
src/utils/index.ts(+6 -2)📝
src/utils/resume.ts(+12 -7)📄 Description
closes #18
hey @yondifon — tracked this down to the session index cache at
~/.continues/sessions.jsonl. it has a 5-min ttl but never checked whether env vars likeCLAUDE_CONFIG_DIRchanged between runs. so when you ran with a custom config dir, it just served the old cached sessions from~/.claude/and never actually scanned your~/.claude-work/directory.what this fixes:
indexNeedsRebuild()now compares that fingerprint against the current envCLAUDE_CONFIG_DIR,GEMINI_CLI_HOME,XDG_DATA_HOME, etc.), the cache is invalidated and a fresh scan runsfiles changed:
src/utils/index.ts— core fix (fingerprint compute + check + store)src/__tests__/env-cache-invalidation.test.ts— regression testbuild passes, all 598 relevant tests pass.
Review all of them with eye of John Carmack-like simplicity with elegeance approach and apply the one only if required
Greptile Summary
Fixes issue #18 by adding an env fingerprint as the first line of the session index (
sessions.jsonl).indexNeedsRebuild()now reads the stored fingerprint and compares it against the current env vars from the adapter registry — if they differ, the cache is invalidated. The change is architecturally sound: it correctly derives tracked env vars from the registry rather than a hardcoded list.Issues found:
readStoredFingerprint(line 38–52): the rawopenSync/readSync/closeSyncpattern leaks the file descriptor ifreadSyncthrows beforecloseSyncis reached.readFileSyncis simpler, handles cleanup automatically, and is already the idiom used everywhere else in this file.opencodeandampboth declareenvVar: 'XDG_DATA_HOME';geminiandantigravityboth declareenvVar: 'GEMINI_CLI_HOME'. Without deduplication, each shared var appears twice in the fingerprint string. Cache invalidation still triggers correctly (symmetric duplicates), but the fingerprint is misleading and will silently accumulate more duplicates as new adapters are added.env-cache-invalidation.test.ts): the key "different fingerprints" test reimplementscomputeEnvFingerprintwith a hardcoded 3-adapter subset instead of importing the real function.indexNeedsRebuild()is never called. The regression from issue #18 could be reintroduced and all tests would still pass.Confidence Score: 3/5
Important Files Changed
Flowchart
Last reviewed commit: edad1d1
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.