Repository navigation
fix(desktop): pin the dev sidecar build channel so sessions persist - #344
Merged
Merged
Conversation
The node-sidecar build bakes Script.channel into the server bundle, and with CODEV_CHANNEL unset packages/script falls back to `git branch --show-current`. Core's Database.path() suffixes the session database with that channel (opencode-<channel>.db), so every branch's dev runs landed in a fresh database and the previous branch's sessions seemed to vanish. Default CODEV_CHANNEL to "dev" in predev and prebuild (`??=`, so CI's explicit value passes through) so local builds always use opencode-dev.db. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx
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
Every
bun dev:desktoprun on a different git branch appeared to lose all previous sessions. Nothing was deleted — the sessions were stranded in per-branch database files:predev.ts/prebuild.tsrunpackages/opencode/script/build-node.ts, which bakesScript.channelinto the server bundle.CODEV_CHANNELunset,packages/script/src/index.tsfalls back togit branch --show-current(upstream's preview-release logic leaking into local builds).Database.path()suffixes the session database with the channel:opencode-<branch>.db.~/.local/share/codev/accordingly holdsopencode-main.db(6 sessions),opencode-feat-sidebar-account.db(1),opencode-feat-account-probe.db(1),opencode-local.db(206), etc. — one per branch dev-run. The desktop's own electron-vite define already defaulted its channel todev; the sidecar build was the inconsistent one.Fix
Default
CODEV_CHANNELtodev(??=) inpackages/desktop/scripts/predev.tsandprebuild.tsbefore the sidecar build. An explicitly set value (CI) passes through untouched, so release packaging is unaffected. Local dev runs now always useopencode-dev.db. DIVERGENCES rows for both scripts amended.Existing per-branch DBs are left in place; recovering those sessions (merging them into
opencode-dev.db) is a separate task if wanted.Testing
bun ./scripts/predev.tswithCODEV_CHANNELunset on branchfix/dev-db-channel: the bundle now containsInstallationChannel = "dev"and version0.0.0-dev-…, with zero occurrences of the branch name (previously the branch was baked in).Database.path()'s template (opencode-${InstallationChannel}.db) therefore resolves toopencode-dev.dbon every branch.🤖 Generated with Claude Code
https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx