Skip to content

Session import fails on different machine but same path & doesn't update on same session id #15588

@noamzbr

Description

@noamzbr

Description

Session import is done with this line
Database.use((db) => db.insert(SessionTable).values(Session.toRow(exportData.info)).onConflictDoNothing().run())

This means 2 things, one of which I think is a bug, and the 2nd is more of "I think this should work differently"

The bug

  1. You have 2 projects on the exact same path, but different machines, both running opencode
  2. You export a session in machine A
  3. You import it in machine B
  4. The path matches but project ID doesn't. Import crashes.

I think this is a pretty common pattern for sandboxed envs so worth addressing

The "not quite a bug but..."

Same sandboxed envs scenario

  1. You have session A in machine 1
  2. You import it in machine 2. Now you have session A there as well (Same session ID)
  3. You work on it in machine 2
  4. Now you export it in machine 2 and import it in machine 1.

Expected - will update the session in machine 1 to state of machine 2

Actual - Noop because onConflictDoNothing

Plugins

No response

OpenCode version

v1.2.10

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Macos 15.7.3

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions