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 — fix(desktop): Path mismatches cause sessions missing + strong ID + existing data fix by Hona · Pull Request #25013 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Apr 29, 2026

Copy link
Copy Markdown
Member

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Hona
fix(desktop): Path mismatches cause sessions missing + strong ID + ex…
94a8134
…isting data fix
@Hona
Hona requested a review from adamdotdevin as a code owner April 29, 2026 21:51
Copilot AI review requested due to automatic review settings April 29, 2026 21:51
Copilot started reviewing on behalf of Hona April 29, 2026 21:52
View session
Copilot AI reviewed Apr 29, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to eliminate directory/path normalization mismatches (especially Windows \ vs / and root/trailing-slash cases) that can cause persisted workspace/session state and global-sync child stores to “miss” existing data, by introducing a canonical directory key and adding migration fallbacks for legacy storage locations.

Changes:

  • Added pathKey() (and directoryKey re-export) as the canonical directory normalization function and replaced workspaceKey() usages across layout/global-sync codepaths.
  • Enhanced persistence to support migrating values across legacy storage names (e.g., old workspace storage filenames derived from raw paths).
  • Added/updated tests to cover the new normalization rules and legacy workspace storage fallback behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/app/src/utils/persist.ts Adds legacyStorage support and refactors legacy/current read/migrate logic.
packages/app/src/utils/persist.test.ts Adds test asserting workspace persistence target includes legacy raw-path storage fallback.
packages/app/src/utils/path-key.ts Introduces normalized path key function used as canonical directory identifier.
packages/app/src/pages/layout/sidebar-workspace.tsx Switches active-workspace comparison from workspaceKey to pathKey.
packages/app/src/pages/layout/helpers.ts Removes workspaceKey and replaces comparisons/order logic with pathKey.
packages/app/src/pages/layout/helpers.test.ts Updates tests for normalization/root handling using pathKey.
packages/app/src/pages/layout.tsx Replaces many workspace comparisons and map keys with pathKey.
packages/app/src/context/global-sync/utils.ts Re-exports pathKey as directoryKey + branded type alias.
packages/app/src/context/global-sync/utils.test.ts Adds tests for directoryKey normalization and root/trailing-slash behavior.
packages/app/src/context/global-sync/child-store.ts Keys child stores/caches by normalized DirectoryKey and uses it through bootstrap/query paths.
packages/app/src/context/global-sync.tsx Shifts boot/load/dispose bookkeeping and SDK client creation toward normalized DirectoryKey usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/app/src/utils/persist.ts

return null
const value = readCurrent({ storage: current, key, defaults, migrate: config.migrate })
if (value !== undefined) return value
Comment thread packages/app/src/context/global-sync/child-store.ts Outdated
Comment on lines 137 to 163
function ensureChild(key: DirectoryKey) {
if (!key) console.error("No directory provided")
if (!children[key]) {
const vcs = runWithOwner(input.owner, () =>
persisted(
Persist.workspace(directory, "vcs", ["vcs.v1"]),
Persist.workspace(key, "vcs", ["vcs.v1"]),
createStore({ value: undefined as VcsInfo | undefined }),
),
)
if (!vcs) throw new Error(input.translate("error.childStore.persistedCacheCreateFailed"))
const vcsStore = vcs[0]
vcsCache.set(directory, { store: vcsStore, setStore: vcs[1], ready: vcs[3] })
vcsCache.set(key, { store: vcsStore, setStore: vcs[1], ready: vcs[3] })

const meta = runWithOwner(input.owner, () =>
persisted(
Persist.workspace(directory, "project", ["project.v1"]),
Persist.workspace(key, "project", ["project.v1"]),
createStore({ value: undefined as ProjectMeta | undefined }),
),
)
if (!meta) throw new Error(input.translate("error.childStore.persistedProjectMetadataCreateFailed"))
metaCache.set(directory, { store: meta[0], setStore: meta[1], ready: meta[3] })
metaCache.set(key, { store: meta[0], setStore: meta[1], ready: meta[3] })

const icon = runWithOwner(input.owner, () =>
persisted(
Persist.workspace(directory, "icon", ["icon.v1"]),
Persist.workspace(key, "icon", ["icon.v1"]),
createStore({ value: undefined as string | undefined }),
),
Comment thread packages/app/src/utils/persist.ts
Comment on lines 502 to 505
const current = currentStorage as SyncStorage
const legacyStore = legacyStorage as SyncStorage
const legacyStores = legacyStorageNames.map(localStorageWithPrefix)

Hona added 4 commits April 30, 2026 08:00
@Hona
.
4933ce0
@Hona
.
36d790c
@Hona
queue refresh
bbcc473
@Hona
race condition
5ce1961
@Hona
Hona enabled auto-merge (squash) April 29, 2026 22:32
@Hona
Hona merged commit d7b7be1 into anomalyco:dev Apr 29, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@oleksii-honchar oleksii-honchar mentioned this pull request Apr 30, 2026
better-opencode: fork with build script, binary renaming & OpenChamber config oleksii-honchar/better-opencode#1
Merged
@Astro-Han Astro-Han mentioned this pull request May 6, 2026
[Task] Track upstream sync after opencode 17701628bd Astro-Han/pawwork#477
Closed
66 tasks
isaacfinnegan pushed a commit to isaacfinnegan/whispercode that referenced this pull request Jun 9, 2026
@Hona
fix(desktop): Path mismatches cause sessions missing + strong ID + ex…
b93a1d5
…isting data fix (anomalyco#25013)
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
@Hona
fix(desktop): Path mismatches cause sessions missing + strong ID + ex…
4a736bb
…isting data fix (anomalyco#25013)
thisxiangyu added a commit to thisxiangyu/opencode-fork that referenced this pull request Jun 15, 2026
@thisxiangyu
merge(upstream): 合并上游 dev 分支并解决冲突,保全本地定制功能
7b1d405
将 upstream/dev (38adc13) 合并到 dev-custom,解决 14 个文件的合并冲突,
同时修复因上游模块迁移导致的构建错误。构建与 Smoke Test 全部通过。

## 上游主要更新

- **HttpApi 后端重构与完整测试覆盖**:authorization middleware、instance context、
  workspace routing、websocket proxy、SDK parity、Effect HttpApi backend parity。
- **桌面端修复**:路径匹配导致 sessions 丢失、强 ID、现有数据修复 (anomalyco#25013)。
- **模型支持**:新增 Mistral Medium 3.5 with reasoning (anomalyco#24996)。
- **参数调整**:Azure/DeepSeek 默认参数优化;系统提示词顺序调整为 Global → Project → Skills。
- **Session 路径**:新增按路径过滤 session 及禁用设置 (anomalyco#24849);数据库新增 session_path、
  icon_url_override 字段。
- **TUI 体验**:粘贴摘要开关更易用 (anomalyco#24869)。
- **内存泄漏修复**:Bash 工具释放解析后的语法树 (anomalyco#24861)。
- **MCP 健壮性**:无效 MCP URL 处理修复 (anomalyco#25019)。
- **核心模块迁移**:global、filesystem、flag、log、npm、effect 等大量底层模块从
  packages/opencode 迁移到 packages/core,建立更清晰的分层。
- **版本同步**:v1.14.30。

## 本地定制功能保全

以下本地特有功能在合并中完全保全,未受上游更新影响:

- **StrategyLoops 轻量框架**:StrategyLoops/ 目录下 PEE/MPEE 模块、Role/Session 管理、
  opencode 适配器等全部保留。
- **可配置存储路径**:database、log、worktree、snapshot 路径支持环境变量与配置文件自定义。
- **日志系统增强**:log-tee 模式(同时输出到文件与控制台)、可配置日志目录。
- **Snapshot 优化**:使用本地 ignore 库替代 git check-ignore,避免 Windows ENAMETOOLONG;
  文件夹级忽略的批量删除逻辑完整保留。
- **MCP 面板项目名提示**:status-popover-body.tsx 中当前项目名展示保留。
- **设置页路径展示**:settings-general.tsx 中 worktree/snapshot/config 路径加载与展示保留。
- **分叉版本构建工作流**、中文贡献文档、定制 i18n 键等全部保留。

## 冲突解决与代码整合

| 文件 | 冲突处理策略 |
|------|-------------|
| dialog-edit-project.tsx | 采用上游提取的 getProjectAvatarSource() 函数,同时保留本地 override/url/color 完整逻辑 |
| sidebar-items.tsx / layout.tsx | 整合上游头像来源逻辑,保留本地 icon override 与 color 判定 |
| settings-general.tsx | 保留本地 loadConfigFiles / loadWorktreeInfo / loadSnapshotInfo 及路径展示 UI;合并上游新增的 shell / displayBackend 等逻辑 |
| status-popover-body.tsx | 保留本地 projectName 提示;去除上游删除的废弃 load 状态 |
| config/config.ts | 采纳上游 Schema 修正(ConfigAgent.Info 替换 AgentRef;MCP 禁用配置改用 Schema.Struct) |
| server/event.ts | 保留本地 ConfigUpdated 事件定义,同时合并上游 Schema 化改造 |
| server/routes/global.ts | 完整保留本地特有的 /storage/* 与 /config/path 路由;合并上游模块导入路径重构 |
| snapshot/index.ts | 修正导入路径到 @opencode-ai/core/*,保留本地 ignore 库、StorageConfig、Flag 等全部定制 |
| worktree/index.ts | 同上,修正模块路径,保留本地 StorageConfig / Flag / resolveDir 等定制 |

## 构建修复(模块迁移适配)

上游将 global、flag 等模块迁移到 packages/core 后,本地定制代码出现模块解析失败:

1. **StorageConfig 跨包迁移**:将 storage-config.ts 从 opencode 包迁移到
   packages/core/src/storage/storage-config.ts,原位置改为重新导出;解除 core → opencode
   的反向依赖,避免循环依赖。
2. **依赖补充**:core/package.json 新增 jsonc-parser 依赖(原仅在 opencode 中声明)。
3. **导入路径修正**:core/src/util/log.ts、snapshot/index.ts、worktree/index.ts 中的
   ../global、../flag/flag、../storage/storage-config 等相对路径统一修正为
   @opencode-ai/core/* 路径。
isaacfinnegan pushed a commit to isaacfinnegan/whispercode that referenced this pull request Jun 15, 2026
@Hona
fix(desktop): Path mismatches cause sessions missing + strong ID + ex…
d3dd8de
…isting data fix (anomalyco#25013)
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
@Hona
fix(desktop): Path mismatches cause sessions missing + strong ID + ex…
faf1fe3
…isting data fix (#25013)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@adamdotdevin adamdotdevin Awaiting requested review from adamdotdevin

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Hona
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.