Repository navigation
feat(extension): channel-flip guard for the chat session DB - #295
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.
036840a to
1085e87
Compare
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Hygiene sweep 2026-08-27: green CI but draft since 2026-08-08 and the chat-DB channel code has moved since. @aarontrowbridge — still wanted? Mark ready + rebase, or close. |
|
Closing stale draft — 5 weeks without updates. The channel-flip guard for the chat session DB can be re-opened from a fresh branch if needed. |
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.