Skip to content

desktop: Home hides subdirectory sessions and mixes unrelated global projects #65362

Open

Description

@RDuomer

Description

Summary

The Desktop Home project filter can both hide sessions whose working directory is a normal subdirectory of the selected project and display sessions from an unrelated project when the selected non-Git project uses a shared global worktree inventory.

This makes existing conversations appear lost and undermines separation between work and personal projects. The affected session metadata and messages remain available through the local API.

Environment

  • opencode version: opencode v2.3.0 (verified on the reporting machine). The same symptoms were previously observed on Desktop 2.2.5.
  • OS: Windows 11, Microsoft Windows NT 10.0.26200.0, x64.
  • Terminal: Desktop UI; diagnostic shell has TERM=xterm-256color; TERM_PROGRAM and COLORTERM are unset.
  • Shell: PowerShell 7.6.2; ComSpec=C:\WINDOWS\system32\cmd.exe.
  • Install/channel: packaged Windows Desktop, standard release installation. No prerelease suffix in the reported version; the exact updater channel was not independently verified.
  • Active plugins: configured globally: opencode-supermemory, opencode-firecrawl, opencode-tavily, opencode-daytona, opencode-background-agents, opencode-vibeguard, opencode-notificator, and a local whatsapp-notify.ts plugin. This lists configuration, not independently verified plugin runtime state. A plugin-disabled/clean-profile reproduction has not been performed.

Reproduction

The following paths and names are sanitized examples, not the reporter's real project data.

A. A child-directory session disappears from its own project filter

  1. Add an existing Git project at C:\work\personal.
  2. Create a conversation whose working directory is C:\work\personal\android-app.
  3. Verify that the session still has the personal project's projectID, is not archived, and has readable message history.
  4. Open Home and select the personal project.
  5. Observe that a root-directory session is listed, but the normal child-directory session is omitted.

The real affected Android-app session was confirmed through the session API with the correct project ID, a child working directory, and readable history. The corresponding folder and APK were also still present.

B. A shared global worktree inventory mixes unrelated projects

  1. Have a non-Git project rooted at C:\work\work represented by id: "global", plus a separate Git project at C:\work\personal.

  2. Reach a saved inventory state in which GET /api/worktree?projectID=global returns both directories:

    [
      {"directory":"C:\\work\\personal"},
      {"directory":"C:\\work\\work"}
    ]
  3. Have separate root-directory conversations for those projects.

  4. In Home, select the non-Git work project.

  5. Observe personal conversations appearing in the work project's list.

The inventory state above was observed through the local API. The precise minimal sequence that first populated the shared inventory with both directories has not been isolated.

Expected Behavior

  • Selecting a project should include its own ordinary subdirectory sessions, not only sessions whose directory exactly equals a root/worktree path.
  • Selecting a non-Git project should not implicitly include every unrelated directory present in a shared global inventory.
  • Separately added nested projects and normal Git worktrees should retain their correct grouping.
  • Showing a conversation should not require changing its working directory or moving its files.

Actual Behavior

  • The Android-app conversation was absent from the personal Home list even though its session, project association, files, and messages still existed.
  • The non-Git work project's Home list included personal conversations.
  • There was no API deletion or archive operation associated with the missing conversation.

The shipped 2.3.0 renderer source map contains this exact-match filter in home/sessions/records.ts:

const selected = input.projectDirectories()
const directories = selected ? new Set(selected.map(pathKey)) : undefined

const sessions = directories
  ? input.sessions().filter((session) => directories.has(pathKey(session.location.directory)))
  : input.sessions()

The corresponding helper in home/sessions/controller.tsx returns:

function directories(project: LocalProject) {
  return [project.worktree, ...(project.sandboxes ?? [])]
}

The exact-match filter excludes ordinary child directories. When a shared global inventory supplies unrelated entries as sandboxes, returning all of them also allows cross-project root-directory matches.

Additional Context

  • Both symptoms were observed on this installation before applying a local workaround. They reappeared after upgrading from 2.2.5 to 2.3.0, which replaced the locally modified renderer with the official one. This is not a request for the updater to preserve unsupported package modifications.
  • A local renderer-only workaround limits a global selection to its selected canonical directory and allows segment-aware descendant matching for the selected project's own sessions, while excluding separately added nested projects and preserving Git worktree behavior.
  • The workaround was tested against extracted packaged functions: 21 regression checks passed, including the real child session metadata; six additional repair-tool safety checks passed.
  • After applying it, the Android-app session was observed in the personal Home UI tree. The final 2.3.0 work-project UI verification was interrupted by the machine locking and is not claimed as completed. Earlier 2.2.5 verification had confirmed the analogous work-child conversation visible and separate from personal conversations.
  • Session IDs, project associations, parent relationships, and working directories were not changed by the workaround. Local checks preserved all 145 inventoried sessions, all preexisting messages in the two specifically checked conversations, and all 101 checked project files.
  • A local workaround is not a durable fix because an official application update replaces the renderer. Please address the filtering/grouping behavior upstream.
  • No private conversation content, account credentials, full user configuration, or private screenshots are attached.

Plugins

opencode-supermemory; opencode-firecrawl; opencode-tavily; opencode-daytona; opencode-background-agents; opencode-vibeguard; opencode-notificator; local whatsapp-notify.ts (configured; not independently isolated)

OpenCode version

2.3.0 (also observed on 2.2.5)

Steps to reproduce

The following paths and names are sanitized examples, not the reporter's real project data.

A. A child-directory session disappears from its own project filter

  1. Add an existing Git project at C:\work\personal.
  2. Create a conversation whose working directory is C:\work\personal\android-app.
  3. Verify that the session still has the personal project's projectID, is not archived, and has readable message history.
  4. Open Home and select the personal project.
  5. Observe that a root-directory session is listed, but the normal child-directory session is omitted.

The real affected Android-app session was confirmed through the session API with the correct project ID, a child working directory, and readable history. The corresponding folder and APK were also still present.

B. A shared global worktree inventory mixes unrelated projects

  1. Have a non-Git project rooted at C:\work\work represented by id: "global", plus a separate Git project at C:\work\personal.

  2. Reach a saved inventory state in which GET /api/worktree?projectID=global returns both directories:

    [
      {"directory":"C:\\work\\personal"},
      {"directory":"C:\\work\\work"}
    ]
  3. Have separate root-directory conversations for those projects.

  4. In Home, select the non-Git work project.

  5. Observe personal conversations appearing in the work project's list.

The inventory state above was observed through the local API. The precise minimal sequence that first populated the shared inventory with both directories has not been isolated.

Screenshot

No response

Operating System

Windows 11 x64, Windows NT 10.0.26200.0

Terminal

OpenCode Desktop; diagnostics from PowerShell 7.6.2 (TERM=xterm-256color)

Activity

  1. added
    area/desktop
    type/bug
    version/v2
    on Nov 21, 2026
  2. opencodejr commented on Nov 21, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I reproduced the cause of the first problem (part A) on 2.3.0, at the server API level. It still happens on the latest dev (844a6aa).

    The script below:

    1. Makes a git repo personal with one commit and a subfolder personal/android-app.
    2. Creates one session at the root and one in android-app. Both get the same project ID.
    3. Asks for the project's sessions by its root directory, which is the request Home makes for a selected project. Only the root session comes back. The android-app session only appears when you ask for that folder.

    The server matches the directory exactly, and Home's own filter (in home/sessions/records.ts, as you found) matches exactly too, so subfolder sessions of the selected project never appear in Home. I could not open the Home screen itself in my sandbox, so that last step is from reading the code, not from seeing the UI.

    I did not try the second problem (the non-git global project showing other projects' sessions). It looks like the same problem tracked in #55133, where unrelated folders end up in one shared global project; related: #50979.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # #65362 (A): the server's project session list for the project root includes a session
    # whose directory is a child folder, with the same projectID. Home's filter in
    # packages/app/src/home/sessions/records.ts then keeps only sessions whose directory
    # exactly equals the project's worktree/sandboxes, so the child session is dropped.
    set -euo pipefail
    OC=${OC:-opencode}
    CONN=${CONN:---standalone}   # or CONN="--server http://127.0.0.1:PORT"
    ROOT=$(mktemp -d /tmp/opencode/repro65362.XXXX)
    export HOME=$ROOT/home XDG_DATA_HOME=$ROOT/home/.local/share XDG_CONFIG_HOME=$ROOT/home/.config XDG_STATE_HOME=$ROOT/home/.local/state XDG_CACHE_HOME=$ROOT/home/.cache
    mkdir -p "$HOME" "$ROOT/personal/android-app"
    $OC --version
    git -C "$ROOT/personal" init -q
    git -C "$ROOT/personal" -c user.email=a@b -c user.name=a commit -q --allow-empty -m init
    cd "$ROOT/personal"
    for d in "$ROOT/personal" "$ROOT/personal/android-app"; do
      $OC api $CONN POST /api/session -d "{\"title\":\"session in $(basename $d)\",\"location\":{\"directory\":\"$d\"}}" >/dev/null
    done
    echo "=== GET /api/session?directory=<project root>  (what Home fetches for the selected project)"
    $OC api $CONN GET "/api/session?directory=$ROOT/personal" | python3 -c '
    import json,sys
    d=json.load(sys.stdin); d=d.get("data",d) if isinstance(d,dict) else d
    for s in d: print(" ", s["title"], "| projectID:", s.get("projectID"), "| directory:", s["location"]["directory"])'
    echo "=== GET /api/session?directory=<project root>/android-app  (the child session exists, same projectID)"
    $OC api $CONN GET "/api/session?directory=$ROOT/personal/android-app" | python3 -c '
    import json,sys
    d=json.load(sys.stdin); d=d.get("data",d) if isinstance(d,dict) else d
    for s in d: print(" ", s["title"], "| projectID:", s.get("projectID"), "| directory:", s["location"]["directory"])'
    echo "=== Home keeps only sessions whose directory is exactly one of the project directories:"
    echo "  $ROOT/personal  -> 'session in android-app' is filtered out"

    Run it: bash repro.sh

  3. MykolaBiron commented on Nov 21, 2026

    @MykolaBiron

    I'd like to work on part A (child-directory sessions missing from their own project in Home). Here is my plan: in home/sessions/records.ts, match sessions whose directory is the selected project's worktree/sandbox or a path-segment descendant of it, while excluding descendants that belong to a separately added nested project. So nested projects and git worktrees keep their own grouping. I'll add regression tests for a child dir, a sibling with a shared prefix (personal2), and a nested project. Part B looks like #55133, so I'll leave it out of this PR unless a maintainer prefers otherwise.

  4. roberto-ajolfi commented on Nov 28, 2026

    @roberto-ajolfi

    Still reproduces on 2.4.2 (macOS) — API evidence and a renamed-directory variant

    Confirming part A on the latest v2 channel release, and adding one case the current fix approach should account for.

    Environment

    • opencode version: 2.4.2 (desktop app + bundled service; updater reports up to date)
    • Client: Desktop app
    • OS: macOS (Darwin 25.6.0, arm64)
    • Shell: /bin/zsh
    • Active plugins: none configured (all loaded plugins are builtin)

    Confirmation (sanitized paths)

    Project root ~/dev/proj (projectID P); recent sessions run in ~/dev/proj/sub and carry location.directory = "~/dev/proj/sub", subpath = "sub", same projectID P.

    • GET /api/session?limit=114&order=desc&parentID=null&directory=<abs project root> returns 30 sessions; the three sub sessions (including the most recent two, created on consecutive days) are absent.
    • GET /api/session?...&directory=<abs project root>/sub returns exactly those three.
    • GET /api/session?limit=500&order=desc&parentID=null (global) includes all 40 sessions of project P.

    The API documents directory as "Only sessions whose directory is exactly this absolute path", so the server matches its spec; the Home project list consumes this exact-match query and drops child-directory sessions. Symptom from the user side: the project list looks permanently stale ("the same old session" stays on top) while the global search box finds everything, since search is not directory-scoped. Deleting the desktop app's HTTP caches and relaunching does not change it.

    Additional variant: renamed project directory

    After the project folder was renamed (~/dev/oldname → ~/dev/proj), 7 older sessions keep location.directory = "~/dev/oldname" with the same projectID P, and are hidden the same way. A path-descendant match alone (as in #65443's records.ts change) does not recover these, since the old path is not a descendant of the new root. The project-ID fetch added in #65443's queries.ts change would return them, so the client-side filter likely needs session.projectID matching (as also suggested in the review) rather than path containment only — this covers both subfolder and renamed-path sessions.

    Workarounds that work today

    • Use the session search box (global scope).
    • Add the working subfolder (e.g. ~/dev/proj/sub) as its own project folder.

    Secondary observation (separate issue candidate)

    The service's JSON API responses (e.g. GET /api/session) carry no Cache-Control/ETag/Last-Modified headers. The desktop app's Chromium HTTP cache stores them (observed list responses cached for months). Cache-Control: no-store on API responses would prevent stale-cache rendering paths.

  5. epicwhale commented on Nov 30, 2026

    @epicwhale

    +1, this hits me hard. Almost all of my sessions start in a subfolder of the repository. When I select the project on Home, it lists only the few sessions I opened at the repository root. Hundreds of my sessions in that project are missing. The sessions are fine: GET /api/session?project= returns all of them. Only the Home list drops them, because it matches the session's folder exactly. it looks like #65443 fixes this for me locally. Could someone help bump up thie priority of this papercut?

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

    area/desktopplatform/windowsreproducedtype/bugversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions