Skip to content

fix(core): isolate opencode2 database - #42389

Closed
dajiaohuang wants to merge 1 commit into
anomalyco:devfrom
dajiaohuang:fix-opencode2-database-isolation
Closed

dajiaohuang wants to merge 1 commit into
anomalyco:devfrom
dajiaohuang:fix-opencode2-database-isolation

Conversation

@dajiaohuang

Copy link
Copy Markdown

Issue for this PR

#42260

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This draft keeps the separately named opencode2 preview from opening the stable opencode.db by default. It derives opencode2.db from the running executable name before applying the existing release-channel fallback.

The patch deliberately does not migrate, copy, or repair an existing database. Explicit OPENCODE_DB and OPENCODE_DISABLE_CHANNEL_DB overrides keep their current behavior, so sharing remains an opt-in escape hatch.

Assumption for review: the opencode2 executable name is the compatibility boundary. A broader alternative would isolate the complete XDG data/state/config namespace or copy stable data into a preview namespace. This draft uses the smaller database-only boundary because it prevents incompatible migrations while leaving unrelated paths unchanged.

How did you verify your code works?

  • bun test test/database-path.test.ts from packages/core: 4 passed
  • bun typecheck from packages/core: passed
  • Full packages/core test run: 1081 passed, 7 skipped, with 6 unrelated Windows failures in existing npm-config and cross-spawn tests

Screenshots / recordings

Not applicable; this changes database path selection.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@dajiaohuang

Copy link
Copy Markdown
Author

I am still working on the compatibility report from #42260, so please reopen this PR if a separate default database for opencode2 is an acceptable scope. In the reported setup opencode2 used the latest channel; current dev still maps latest, beta, and prod to opencode.db, so the stable/V2 collision remains possible. I asked about the coexistence contract on #42260, which was closed without an answer. The related open #44028 reports a separate mixed-generation session visibility problem. This patch isolates the opencode2 database only; it does not change other XDG paths or solve cross-channel migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant