You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
workerd: let embedders prefix OpenCode's SQLite tables #53577
OpenCodeWorkerd.create({ storage }) puts OpenCode's tables in the Durable Object's SQLite database without a prefix: session_v2, session_message, event, kv, project, permission, workspace, and so on. That causes two problems when the object also stores its own data:
Bootstrap fails.DatabaseMigration.apply stops with Database is not empty and has no session table if any table exists whose name doesn't start with _. Most objects create their tables before OpenCode boots. The Cloudflare Agents SDK, for example, keeps its scheduler and streams in cf_agents_* tables. So in practice, embedding OpenCode means it has to boot first, or the embedder has to hide its tables from OpenCode's discovery query.
Names can collide. Names like session, message, event, kv and project are common, so an object's own tables can clash with OpenCode's.
Workerd is where this shows up most, because the database belongs to the Durable Object, not to OpenCode. The same applies to anyone sharing a database through database.path.
Proposal
Add a table prefix option to the database layer, and expose it from OpenCodeWorkerd.create and OpenCode.create:
every table and index in schema.gen.ts and the migrations is created as <prefix><name>
the bootstrap check only looks at tables that start with the prefix, so tables outside it are ignored, as underscore-prefixed tables are today
the migration journal is prefixed too
Drizzle table definitions already go through sqliteTable(name, ...), so a prefixed table builder plus prefixed DDL in the generated schema and migrations would cover most of it.
What we do for now
cloudflare/agents is adding an OpenCodeHarness built on @opencode/sdk/workerd. Until there is a prefix option, it hands OpenCode a view of DurableObjectStorage that rewrites the SQL OpenCode sends: table names get an opencode_ prefix, and the bootstrap discovery query only sees opencode_* tables. This relies on the shape of OpenCode's SQL, which is why we'd like to replace it with a supported option.
Related: #53221, the same bootstrap check failing on a shared database.
Activity
github-actions commentedon Oct 6, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:and the issue must include the required verification checkbox.Please edit this issue to address the above within 72 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
feat(agents): experimental OpenCodeHarness and agents/models/opencode…
github-actions commentedon Oct 9, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.
Feel free to open a new issue that follows our issue templates.