GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sessions: pre-project-row sessions stranded in global project are hidden from session lists · Issue #57629 · anomalyco/opencode

sessions: pre-project-row sessions stranded in global project are hidden from session lists #57629

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
sessions: pre-project-row sessions stranded in global project are hidden from session lists#57629
Copy link
Labels
pending closetriaging

Description

@coolguy565
coolguy565
opened on Oct 21, 2026
Issue body actions

Summary

Sessions created before their directory's project row exists are stored under the global
project (worktree /) and never appear in project-scoped session listings (opencode session list, TUI session list), even when the session's directory matches the current directory
exactly. An entire 120-session history was invisible; only sessions created after the project
row appeared were listed.

Environment

  • opencode version: 2.1.1
  • OS: Linux 6.18.40.1-microsoft-standard-WSL2+ (linux x64)
  • Terminal: TERM=xterm-256color (TERM_PROGRAM/COLORTERM unset)
  • Shell: /usr/bin/zsh
  • Install/channel: latest
  • Active plugins: none found (global/project config declare no plugins; no .opencode/plugin(s)/)

Reproduction

  1. From /home/redacted, create sessions while project has no row for that directory
    (sessions are stored with project_id='global').
  2. Later start opencode in /home/redacted again so a project row for it is created
    (observed: created when a new session started).
  3. Run opencode session list --format json from /home/redacted.
  4. Only sessions created after the row existed are returned; all older sessions — including
    ones whose directory is exactly /home/redacted — are absent even with -n 500.

Expected Behavior

Directory-scoped session listings should include sessions whose directory matches the
current directory regardless of which project bucket stored them, or older sessions should be
re-scoped to the directory's project row when it is first created.

Actual Behavior

opencode session list from /home/redacted returned exactly 1 session while session_v2
contained 141: 120 in project_id='global' (53 with directory=/home/redacted, 67 with
directory=/home/redacted/redacted) and 21 in the /home/redacted project. Listing from
/home/redacted/redacted returned 0 despite 67 sessions with that exact directory, because
that directory has no project row of its own. GET /api/session returns all sessions
regardless of project, so the data exists but is unreachable from directory-scoped views.

Additional Context

  • Frequency: user hit this previously and assumed the history was lost; reproducible whenever
    sessions predate their directory's project row.
  • Evidence: project_directory was empty; re-pointing the 120 rows with
    UPDATE session_v2 SET project_id = '<directory project>' WHERE project_id='global'
    (after an online backup) made session list -n 500 return all 118 top-level sessions — the
    rows were intact; only the bucket was wrong.
  • Workaround requires direct DB editing; session export/import re-creates sessions instead
    of fixing the association.
  • Related quirk: starting opencode in a subdirectory creates a new project row there,
    stranding those sessions from the opposite direction.

Activity

  1. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    opencode-agentBot
    on Oct 21, 2026 – with OpenCode Agent
    Contributor
    More actions

    Thanks for the detailed report and the database analysis. I think this is a duplicate of #49827.

    In v2, a directory that isn't in a git or hg repo always gets its own project when you open it. New sessions are not stored under global. Sessions end up under global when they were imported from V1: V1 kept sessions from non-git directories in that shared project. v2 then creates a separate project for /home/redacted (and for /home/redacted/redacted), and the session list only shows sessions from the current project, so the older sessions are hidden. Your data is intact, as you found.

    Possible duplicates and closely related issues, ordered by likelihood:

    • migrate-v1: non-git sessions in "global" project hidden after V1→V2 upgrade #49827: V1 sessions from non-git directories stay under global after upgrading and are hidden from the project-scoped list (main issue)
    • sessions: V1 sessions from non-git directories hidden from the project session list #53450: the same symptom in opencode session list and the TUI; describes the runtime gap where opening a non-git directory does not take over its global sessions
    • V1→V2 importer keeps project_id='global' for non-git directories, so migrated sessions never appear in the per-directory session picker #50551: the V1→V2 importer keeps project_id='global' for non-git directories
    • sessions: V1 sessions under "global" project hidden after upgrading to 2.0 #56030 / tui: pre-upgrade sessions hidden from session list (stuck under "global" project) #55596 / sessions: non-git directories orphan all pre-upgrade sessions after V1→V2 upgrade #54815: earlier reports already closed as duplicates of migrate-v1: non-git sessions in "global" project hidden after V1→V2 upgrade #49827

    Open PRs that try to fix this: #51935, #54048 and #56322.

    If you fix the rows by hand, note from #54815 and #50551 that path should also be set to '' (not NULL). Otherwise the TUI list can still hide the sessions even when opencode session list shows them.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. For example, if these sessions were created by v2 itself and never imported from V1, please say so.

  2. opencode-agent
    added
    pending close
    triaging
    on Oct 21, 2026
  3. opencode-agent
    closed this as duplicateon Oct 22, 2026
  4. opencode-agent commented on Oct 22, 2026

    @opencode-agent
    opencode-agentBot
    on Oct 22, 2026 – with OpenCode Agent
    Contributor
    More actions

    We haven't heard back, so I'm closing this as a duplicate of #49827. In v2, a directory that isn't in a git or hg repo gets its own project when you open it. Sessions under global in such a directory almost always came from V1. That's why your older sessions in /home/redacted and /home/redacted/redacted don't show up in the project-scoped list, even though the data is intact.

    Please follow #49827 for updates. Open PRs #51935, #54048 and #56322 are attempts to fix it. If you repair the rows by hand in the meantime, set path to '' as well as project_id.

    If these sessions were created by v2 itself and never imported from V1, please reply here with that detail and we can reopen.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closetriaging

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.