Skip to content

fix(web): retain migrated Desktop project groups - #797

Open
Felen-Ng wants to merge 1 commit into
BytePioneer-AI:mainfrom
Felen-Ng:fix/web-migrated-projects-20261111
Open

Felen-Ng wants to merge 1 commit into
BytePioneer-AI:mainfrom
Felen-Ng:fix/web-migrated-projects-20261111

Conversation

@Felen-Ng

Copy link
Copy Markdown

Desktop projects that have native migration mappings can be absent from the legacy project-order list. Web treats that list as a complete visibility allowlist and omits those registered local projects.

Include ordered projects plus explicitly migrated projects in the current local Codex scope. Keep unmapped hidden entries and other-host mappings excluded. A bounded, read-only Web compatibility reader supplements project definitions when the running Host predates the fix; membership, projectless state and pins remain owned by Host.

Validation on the independent Windows branch:

  • Two focused Host workspace suites: 15 passed.
  • Web project completion, projectless and Host-client suites: nine passed.
  • Full TypeScript build and test typecheck, ESLint/package boundaries and changed-file formatting passed.
  • Fixtures verify host scoping, malformed/missing metadata fallback, no duplicate definitions, and unchanged metadata bytes/memberships.

No Desktop project file, execution directory or remote connection configuration is rewritten.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 功能改进
    • 工作区快照现在可以补充符合条件的桌面项目,包括通过迁移映射关联的项目,并保留已有项目及快照内容。
    • 桌面状态文件缺失或无效时,仍返回原始工作区快照。

本次变更新增共享桌面项目定义逻辑,并将其用于原生工作区快照和服务端工作区快照,以补入当前本地作用域对应的迁移项目。

Changes: 桌面项目定义与原生快照

Layer / File(s) Summary
共享定义与原生快照
packages/shared-contracts/src/desktop-project-definitions.ts, packages/shared-contracts/src/index.ts, packages/host-runtime/src/native-workspace-snapshot.ts, packages/host-runtime/test/local-shared-host.test.ts
新增 desktopProjectDefinitions,校验本地项目字段,并根据项目顺序或当前原生作用域的迁移映射返回项目。原生工作区快照改用该函数生成项目列表。新增测试覆盖迁移项目。
服务端快照补全
packages/web-server/src/ch-desktop-projects.ts, packages/web-server/src/ch-host-client.ts, packages/web-server/test/ch-desktop-projects.test.ts
新增 completeDesktopProjects,从 Codex 全局状态补入快照中缺失的项目。服务端所有者的 projects 方法现在调用该函数。测试覆盖项目补入、快照字段保留,以及状态文件缺失或无效时返回原始快照。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant HostClient as createChHostClient.projects
  participant WorkspaceRead as codexhost/workspace/read
  participant Completer as completeDesktopProjects
  participant StateFile as .codex-global-state.json
  participant Definitions as desktopProjectDefinitions
  HostClient->>WorkspaceRead: 读取工作区快照
  WorkspaceRead-->>HostClient: 返回 ClientWorkspaceSnapshot
  HostClient->>Completer: 传入快照和 codexHome
  Completer->>StateFile: 读取并解析状态
  StateFile-->>Completer: 返回状态数据
  Completer->>Definitions: 传入状态和原生作用域
  Definitions-->>Completer: 返回项目定义
  Completer-->>HostClient: 返回补入项目后的快照
Loading

Possibly related PRs

  • BytePioneer-AI/codex-host#772: 同样涉及原生工作区快照;该 PR 纳入原生 Thread ID,以保留项目分配和 projectless 记录。

Suggested reviewers: bytepioneer-ai, mouzhi

Merge Risk: Low · up to ed406

The change is mergeable with owner awareness: if Web connects to a Host using a different Codex home, migrated projects may remain missing or unrelated project definitions may appear.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(web): retain migrated Desktop project groups”准确概括了主要变更:保留具有 Desktop 原生迁移映射的项目组。标题简洁、具体,并与变更文件和 PR 目标一致。
Description check Passed 描述明确说明了项目可见性问题、Host 映射范围、Web 兼容读取逻辑、回退行为、测试结果和不修改配置的约束。内容与变更集相关。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8fd0ab9 and ed40614.

Files selected for processing: 7

  • packages/host-runtime/src/native-workspace-snapshot.ts
  • packages/host-runtime/test/local-shared-host.test.ts
  • packages/shared-contracts/src/desktop-project-definitions.ts
  • packages/shared-contracts/src/index.ts
  • packages/web-server/src/ch-desktop-projects.ts
  • packages/web-server/src/ch-host-client.ts
  • packages/web-server/test/ch-desktop-projects.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details

Additional context used

Code guidelines: 2

CLAUDE.md — auto-discovered
AGENTS.md — auto-discovered
Path-based instructions: 2

Source excerpt: `shared-contracts` must remain browser-safe and independent of other Workspace packages.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • packages/shared-contracts/src/index.ts
  • packages/shared-contracts/src/desktop-project-definitions.ts
Source excerpt: Host Runtime loads installed plugins through public contracts, not direct imports of concrete Adapter packages.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • packages/host-runtime/test/local-shared-host.test.ts
  • packages/host-runtime/src/native-workspace-snapshot.ts
Learnings: 1

Common learnings

Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: .agents/skills/codexhost-pre-push-checks/SKILL.md:0-0
Timestamp: 2026-10-31T06:53:01.023Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Repository Skills
| Task | Skill |
| --- | --- |
| Selecting local checks before pushing or claiming checks pass | [codexhost-pre-push-checks](.agents/skills/codexhost-pre-push-checks/SKILL.md) |

Source excerpt:
# codexhost 推送前检查

## 按改动面选择

规则:每个行为改动至少有一个“回归时会失败”的测试或检查;没有现成的就补一个或说明缺口。不要因为即将提交就重复跑刚通过的检查。
Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-10-31T06:53:42.652Z
Learning: Source excerpt:
# Repository Guidelines

## Implementation Principles

- Keep changes narrowly scoped. Avoid unrelated refactors, renames, dependency upgrades, or formatting churn.
Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-11-10T13:00:11.347Z
Learning: Source excerpt:
# Repository Guidelines

## Implementation Principles

- Keep changes narrowly scoped. Avoid unrelated refactors, renames, dependency upgrades, or formatting churn.
Additional comments: 7

packages/shared-contracts/src/desktop-project-definitions.ts: 1

1-30: LGTM!

packages/shared-contracts/src/index.ts: 1

420-420: LGTM!

packages/host-runtime/src/native-workspace-snapshot.ts: 1

7-7: LGTM!

Also applies to: 17-18, 56-56

packages/host-runtime/test/local-shared-host.test.ts: 1

278-286: LGTM!

packages/web-server/src/ch-desktop-projects.ts: 1

1-35: LGTM!

packages/web-server/test/ch-desktop-projects.test.ts: 1

1-54: LGTM!

packages/web-server/src/ch-host-client.ts: 1

27-27: Functional Correctness

ClientWorkspaceSnapshot 已导入。缺少该类型导入的情况不成立。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant