Fix OpenCode session cache source paths#348
Open
ozymandiashh wants to merge 1 commit into
Open
Conversation
7 tasks
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.
Summary
Fixes OpenCode session-cache keying by discovering one source per real
opencode*.dbfile instead of one synthetic<dbPath>:<sessionId>source per root session.The parser now opens the database source, iterates unarchived root sessions inside it, and keeps the recursive child-session parsing added in #343.
Root cause
OpenCode discovery used paths like:
The shared session cache fingerprints source paths with
stat(). That synthetic path is not a real file, so OpenCode cache entries could be treated as changed or stale on every run.What changed
path: dbPathfor eachopencode*.db.<dbPath>:<sessionId>source paths are still accepted.Validation
origin/mainvs this branch.npx vitest run tests/providers/opencode-cache.test.ts tests/providers/opencode.test.ts tests/provider-registry.test.ts- 54/54 tests passed.npx tsc --noEmit --pretty false- passed.npx vitest run- 876/876 tests passed.npm run build- passed.git diff --check origin/main...HEAD- passed.Cache proof
Synthetic OpenCode DB fixture:
Same fixture parsed on
origin/mainand this branch.origin/maincache keys:This branch cache keys:
Behavior stayed equivalent:
Scope and privacy notes
Validation uses synthetic SQLite fixtures only. No real local OpenCode history, prompts, paths, session IDs, usage values, or private project data are included.