Skip to content

project load failed when use "Open project" from the UI after "opencode web" command. #27996

Closed as not planned

Description

@shifttttttt

Description

In the UI generated by "opencode web" command, the project sessions was unreachable when open a project already exit by "Open project" button with project dir.

Plugins

omo

OpenCode version

1.14.25

Steps to reproduce

  1. On Windows, run opencode in a project directory and create some sessions via CLI
  2. Start opencode web
  3. Click the "+" (Open Project) button and manually type the same project path
  4. Observe no historical sessions shown
  5. Click the project from the sidebar recent projects list → sessions appear correctly

Screenshot and/or share link

No response

Operating System

windows

Terminal

window terminal

Activity

  1. github-actions commented on May 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct from these (e.g., specific to the opencode web flow or the "+" button path entry), please clarify what makes it different so maintainers can triage it correctly.

  2. shifttttttt commented on May 17, 2026

    @shifttttttt
    Author

    File: packages/opencode/src/session/session.ts

    Three changes:

    1. Add a platform-aware normalize helper:
    const normalizeDirectory = (path: string): string => {
      if (path.length > 1 && (path[1] === ":" || path.startsWith("\\\\"))) {
        return path.replaceAll("\\", "/")
      }
      return path
    }
    1. Normalize on write in createNext (~line 539):
    // Before:
    directory: input.directory,
    // After:
    directory: normalizeDirectory(input.directory),
    1. Normalize on read in listByProject (~line 911) and listGlobal (~line 952):
    // Before:
    conditions.push(eq(SessionTable.directory, input.directory))
    // After:
    conditions.push(
      sql`replace(${SessionTable.directory}, ${"\\"}, ${"/"}) = ${normalizeDirectory(input.directory)}`
    )

    Import sql from drizzle-orm if not already present.

    Backward Compatibility

    • Old sessions (stored with \) are matched via SQL replace
    • New sessions are stored with consistent /
    • Linux/macOS: no \ in paths, replace is a no-op
    • All other operations (get/remove/update/fork) use session_id, not directory, so unaffected

    Impact

    Windows users. Anyone using web UI "Open Project" by typing a path.

  3. github-actions commented on Jul 17, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions