Repository navigation
fix(world): give isolated headless worlds their own OpenCode sessions database - #4372
Conversation
… database The isolated headless world inherited HOME and no OPENCODE_DB, so its managed engine opened ~/.local/share/opencode/opencode.db alongside the installed desktop app. Two long-lived engines then contended for SQLite's single writer (every journal write in one was a busy_timeout wait in the other) and world sessions landed in the person's history. Only installed-production worlds isolated this. - resolveHeadlessWorldRuntimePaths exposes opencodeDbPath (tmp/dev-headless-opencode.db, or <runtime dir>/opencode.db for named worlds). - isolatedHeadlessEngineEnv sets exactly OPENCODE_DB for the isolated branch; HOME/XDG stay untouched so the person's provider auth.json still resolves. An explicit OPENCODE_DB wins. - AGENTS.md documents the location.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Test evidence — an-isolated-headless-world-gives-its-engine-a-private-sessions-database — ✅ passed✅ passed · 2 expectations passed · 0 failed · 0 pending verdict passed · 0 user observations · 0 probes · steps 0/0 ℹ️ ASSERTION — 1. The isolated world's engine opens tmp/dev-headless-opencode.dbresolveHeadlessWorldRuntimePaths yields a world-owned database path and isolatedHeadlessEngineEnv sets exactly OPENCODE_DB to it, leaving HOME and XDG_DATA_HOME untouched so provider credentials still resolve.
ℹ️ ASSERTION — 2. Explicit overrides and the installed-production world are unchangedAn explicit OPENCODE_DB still wins, and the installed-production env test keeps pointing at the installed database.
Test run created 2026-09-03T21:45:23.785Z · Source: |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (8481eba7921852ec9ff514f76084c7b2dbd87928). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Why
pnpm world up dev-headless(stateisolated) spawned its managedopencode servewith the person'sHOMEand noOPENCODE_DB, so it opened the same~/.local/share/opencode/opencode.dbas the installed desktop app. Two long-lived engines on one SQLite file means every journal write in one is abusy_timeoutwait in the other, and world sessions land in the person's history. On the reporting machine a headless engine from Sep 1 was still holding the desktop's 1.5 GB database open while the desktop engine was timing out. Onlyinstalled-productionworlds isolated engine data (installedProductionHeadlessEnv).What
resolveHeadlessWorldRuntimePathsexposesopencodeDbPath:tmp/dev-headless-opencode.dbfor the compatibility world,tmp/worlds/runtime/<name>/opencode.dbfor named worlds.isolatedHeadlessEngineEnv(runtimePaths, env)sets exactlyOPENCODE_DBfor the isolated branch.HOME/XDG_*are deliberately untouched so the world keeps the person's providerauth.jsonand engine log; an explicitOPENCODE_DBstill wins.process.env(managed-opencode.ts), so the variable reachesopencode servewithout further plumbing.Behavior change: the isolated world no longer sees desktop sessions — which is what "isolated" means.
installed-productionis unchanged.Verification
Lane: local (pure path/env resolution; no Daytona prerequisite applies).
Verdict: Passed.
Related: #4371 (server log file). Follow-ups: engine-rollover fingerprint, engine-stall UX.