desktop: Home hides subdirectory sessions and mixes unrelated global projects

未关闭
#65,362 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
70/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
desktop, frontend

调研方向

Start with the two files the report names: home/sessions/records.ts (the pathKey exact-match filter) and home/sessions/controller.tsx (directories(project), which merges project.worktree with project.sandboxes). Reproduce via the local session and worktree APIs, then make matching segment-aware for the selected project while excluding unrelated entries from a shared global inventory, preserving Git worktrees and nested projects. Done when the child session appears under its project and the non-Git project no longer lists unrelated conversations.

由索引模型根据 Issue 内容生成。

描述

area/desktop platform/windows reproduced type/bug version/v2
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)

主要语言
TypeScript
星标
227k
派生
30.7k
平均合并
3 小时 57 分钟
30 天内合并 PR
484

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。