feat(extension): channel-flip guard for the chat session DB - #295
Draft
aarontrowbridge wants to merge 1 commit into
Draft
feat(extension): channel-flip guard for the chat session DB#295aarontrowbridge wants to merge 1 commit into
aarontrowbridge wants to merge 1 commit into
Conversation
opencode resolves its chat DB by build channel (dev -> opencode-dev.db, unbranded/local -> opencode-local.db, ...). A vendored-binary refresh can therefore boot a HEALTHY server on a FRESH database: panels show an empty history while the real one sits untouched on disk (fleet incident 2026-08-08, diagnosed by hand over hours). Two cheap, never-blocking additions to ServerManager: - log the spawned binary's sha256 at start (provenance for post-mortems, complements #292) - warnIfServingFreshDb: after health, if /session serves < 10 sessions while a sibling opencode-*.db on disk exceeds 32 MB, append a WARNING to the output channel and toast with an 'Open Output' action False-positive analysis: fresh installs have no large sibling DB (silent); a fork serving its own large DB serves a high session count (silent); the client-tunnel path serves the canonical count through the tunnel (silent). Any probe failure is silent by construction.
6 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.
Motivation
2026-08-08 fleet incident: the extension update refreshed the vendored opencode binary, swapping a
dev-channel build for a local-channel one. opencode picks its chat DB by build channel (dev→opencode-dev.db, unbranded/local →opencode-local.db), so launchd restarted a healthy server on a fresh, empty database — every fleet panel showed an empty history while the 650-sessionopencode-dev.dbsat untouched on disk. Diagnosis required reading minified bundle strings; total silent-failure window was hours.What this does
Two never-blocking additions to
ServerManager:warnIfServingFreshDb— after the health probe, if/session?limit=1000serves < 10 sessions while a siblingopencode-*.dbon disk exceeds 32 MB, the extension appends a WARNING and toasts with an "Open Output" action. The silent-empty-panel symptom becomes an explicit, actionable error.False-positive analysis
.catch(() => {})).Validation
tsc --noEmitclean.vitest: 905 passed; the 3 failures intest/server_auth.test.ts(buildServerSpawnEnvkey-exactness) reproduce identically on unmodifiedmain(0944b3b) — pre-existing, unrelated. Worth its own issue.Follow-ups (not in this PR)
OPENCODE_DBpin, frozen server binary, 5-min watchdog) already applied to the fleet server.