Repository navigation
Conversation
Follow-up to agent-of-empires#2650 (fix agent-of-empires#2605). Reviewer Seluj78 flagged an acknowledged trade-off in the merged fix: emptying clean_files for the opencode data-dir mount also drops the container-image-update reset the struct doc originally described. If a future image bump ships an opencode release whose drizzle migrations are not forward-compatible with the pre-existing sandbox DB, opencode aborts on boot. This is not hypothetical - the same failure class is observed upstream on standalone opencode CLI upgrades (anomalyco/opencode#31119, #16678). Add a Troubleshooting entry to docs/guides/sandbox.md following the existing Symptoms/Cause/Fix shape (matches the OOM entry), with: - The failing scenario symptoms - Root cause chain: sandbox DB persists (agent-of-empires#2605) -> drizzle forward-only -> incompatible migration on old DB -> boot abort - One-line remediation: rm -f ~/.local/share/opencode/sandbox/opencode.db{,-wal,-shm} - Reactive framing (rare event, most upgrades migrate cleanly) - Upstream anomalyco/opencode issue references so the entry ages with evidence rather than speculation Docs-only, no code impact, no test impact.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a troubleshooting subsection to the sandbox guide documentation explaining why sandboxed OpenCode may fail to start after a container image upgrade, describing the symptom, cause (stale SQLite DB schema), and the manual fix of deleting sandbox DB files before restarting. ChangesSandbox Troubleshooting Documentation
Estimated code review effort: 1 (Trivial) | ~3 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Two micro-fixes surfaced by a self-review pass on PR agent-of-empires#2663: - Fix code block: replace bash-only brace expansion `opencode.db{,-wal,-shm}` with POSIX-portable glob `opencode.db*`. Brace expansion fails in dash/sh (Debian /bin/sh, cron, Alpine) and fish; the glob works on all POSIX shells and is safe here because skip_entries guarantees no unrelated file matches that prefix in the sandbox subdir. - Escalation note: drop backticks around `anomalyco/opencode` and turn it into an explicit Markdown link. It's an org/repo path, not a code identifier; the link maximizes affordance for users who actually hit the failure and need to escalate upstream. Zero content change beyond usability.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2663 +/- ##
==========================================
- Coverage 85.04% 85.02% -0.02%
==========================================
Files 272 272
Lines 16451 16451
Branches 4872 4872
==========================================
- Hits 13990 13988 -2
- Misses 2083 2084 +1
- Partials 378 379 +1 see 2 files with indirect coverage changes
Continue to review full report in Codecov by Harness.
|
Description
Follow-up to #2650 (which fixed #2605). Adds a Troubleshooting entry to
docs/guides/sandbox.mddocumenting how to recover when a sandbox container-image upgrade ships an OpenCode release with a schema change that is not forward-compatible with the persisted sandbox DB.Context
Reviewer @Seluj78 flagged this as an acknowledged trade-off on #2650:
This PR does not change the trade-off; it just makes the recovery path discoverable in the docs.
Cross-validation
Before writing, I ran an Oracle cross-validation pass on the claim (opencode uses drizzle → drizzle migrations forward-only → sandbox DB path is
~/.local/share/opencode/sandbox/opencode.db*→ failure mode is real). All six substantive points came back VALID, including that the exact same failure class is already observed upstream on standalone OpenCode CLI upgrades (anomalyco/opencode#31119 documents remediation viarm ~/.local/share/opencode/opencode.db; anomalyco/opencode#16678 documents the drizzle name-vs-hash migration cutover breaking pre-existing DBs). The sandbox-image bump is mechanically the same migrator hitting the same problem, just via a different version-change vector.Shape
New Troubleshooting subsection follows the existing
Symptoms / Cause / Fixlayout of the OOM entry directly above it:no such column,CREATE TABLE ... already exists,Failed to run the query).~/.local/share/opencode/sandbox/opencode.db*persists post-bug(session): sandboxed opencode --session resume fails; opencode.db wiped on every launch by unconditional clean_files #2605 forses_*resume identity → drizzle is forward-only → incompatible new migrations abort boot. Upstream issue refs for evidence.rm -fon the three DB files. Scoped to the sandbox subdir, host OpenCode state untouched.PR Type
Checklist
Test Coverage Analysis
Web dashboard / structured view (Playwright user story)
TUI / CLI (e2e test)
AI Usage
AI Model/Tool used: claude-opus-4-7
Any Additional AI Details you'd like to share:
Drafting, cross-validation, and wording were assisted by claude-opus-4-7. The follow-up direction (docs vs. code change) was proposed by @Seluj78's review of #2650 explicitly acknowledging the trade-off as-is. An Oracle cross-validation pass verified six substantive points (opencode uses drizzle-orm/bun-sqlite, drizzle migrations are forward-only, the sandbox DB path is correct, the failure class is observed upstream, no pre-fix behavior would have handled schema bumps more gracefully than auto-wipe, and this codebase's docs style supports documenting observed failures reactively) before any file was written.
Added a new troubleshooting entry to
docs/guides/sandbox.mdfor a rare sandbox startup failure after an OpenCode container image upgrade.The update:
Benefit: this helps users quickly recover from upgrade-related schema incompatibilities without losing their main OpenCode state.