fix(web-shell): initialize workspace selector from ID - #7518
Conversation
|
Thanks for the PR! Template looks good ✓ Problem: observed bug with clear evidence — #7430 was filed by a maintainer with step-by-step reproduction. When an embedding supplies only a secondary Direction: aligned. The web-shell workspace selector should reflect the workspace resolved from the supplied ID. CHANGELOG has no direct reference, but the area is clearly relevant — workspace initialization is core to the embedding contract. Size: not applicable — no core paths touched. 56 additions / 1 deletion across 4 files (2 source, 2 test). Approach: the scope feels right. The fix threads a single Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:已观测到的 bug,有明确证据——#7430 由维护者提交,附带逐步复现步骤。当嵌入方只传入次级 方向:对齐。Web Shell 工作区选择器应反映从传入 ID 解析出的工作区。CHANGELOG 无直接引用,但该领域显然相关——工作区初始化是嵌入契约的核心部分。 规模:不适用——未触及核心路径。4 个文件(2 个源码、2 个测试)共 56 行新增 / 1 行删除。 方案:范围合理。修复方案将单个 进入代码审查 🔍 — Qwen Code · qwen3.8-max-preview Reviewed at |
Code ReviewIndependent proposal: given the issue description, I would (1) pass the resolved Comparison: the PR does exactly this. No simpler path was missed. No critical blockers or convention violations found. Specifics:
ESLint and Prettier pass on all four changed files. TestingThis is a web-shell React component change (browser-based UI), so CLI tmux testing does not apply. Verification was done via the package-level Vitest suite, which exercises the component tree through React Testing Library — the same rendering path a browser would use. The two new tests specifically cover the fix:
中文说明代码审查独立方案: 根据 issue 描述,我会 (1) 将解析出的 对比: PR 的实现与此完全一致。没有遗漏更简单的路径。 未发现关键阻塞项或规范违反。具体:
ESLint 和 Prettier 在所有四个改动文件上通过。 测试这是 Web Shell React 组件变更(浏览器 UI),CLI tmux 测试不适用。验证通过 package 级 Vitest 套件完成,该套件通过 React Testing Library 执行组件树——与浏览器使用的渲染路径相同。 两个新测试具体覆盖了修复:
— Qwen Code · qwen3.8-max-preview Reviewed at |
|
Confidence: 5/5 — clean, minimal fix for a maintainer-filed bug; matches my independent proposal exactly. This is a textbook small fix: one prop threaded through, one The PR also does the small things right — the condition 中文说明置信度:5/5 — 干净、最小的修复,针对维护者提交的 bug;与我的独立方案完全一致。 这是一个教科书式的小修复:穿透一个 prop,更改一个 PR 在细节上也做对了——条件 — Qwen Code · qwen3.8-max-preview Reviewed at |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅
— qwen3.7-max via Qwen Code /review
🖼️ web-shell visual previewRendered against a mock daemon (no real backend): the PR base vs this PR head Screenshots · before / afterℹ️ No screenshot changed against the PR base — but this PR edits 2 render-shaping files:
Either the change has no visual effect (logic, plumbing, a state the scenarios never reach), or no scenario renders this UI — in which case the preview cannot see it, and an empty result is a coverage gap rather than a clean bill of health. To make it visible, add a scenario to Full-resolution recordings (.webm) are attached to the workflow run. — Qwen Code · web-shell visuals |
✅ Local build & test verification — merge-readyI built and ran this PR locally in an isolated worktree at head Environment: macOS (Darwin 24.6), Node 22, Summary
Controlled A/B (the proof it is load-bearing)The two new tests independently cover the two production edits. Reverting each edit — while keeping its test — turns exactly that test red, then restoring it turns it green again:
Regression parity (same env, base vs head)Full Live browser end-to-endI also drove the real unlocked embedding path ( On base the same selector initializes to Primary at first paint (the bug), then a post-mount effect settles it back to Secondary — i.e. the first-render/first-prompt race the issue describes. That window is inherently transient in a live browser, which is why the deterministic contract (initial Notes
LGTM. ✅ Screenshots are hosted on branch 中文版本(点击展开)✅ 本地构建与测试验证 —— 可以合并我在隔离 worktree 中检出 PR 头 环境: macOS(Darwin 24.6)、Node 22、 汇总
受控 A/B(证明修复是必需的)两个新增测试分别独立覆盖两处生产代码改动。回退任一处改动(同时保留其对应测试),恰好让该测试变红,恢复后又变绿:
回归对照(同一环境,base vs head)
浏览器端到端我还在 base 与 head 上分别驱动了真实的未锁定嵌入路径( 在 base 上,同一选择器在首帧初始化为 Primary(bug),随后一个 mount 后的 effect 又把它纠正回 Secondary —— 即 issue 所描述的首次渲染/首次提示的竞态窗口。该窗口在真实浏览器中本质上是瞬态的,因此其确定性契约(初始 备注
LGTM。✅ 截图托管于分支 |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Reviewed — no blockers. Suggestions are inline.
— qwen3.7-max via Qwen Code /review
fix: adjust initial workspace directory resolution logic to support embeddings passing only unlocked workspaceCwd Replace condition check from effectiveWorkspaceId to !lockWorkspaceCwd && targetWorkspace, prevent sessions from incorrectly initializing under primary workspace for secondary workspace path inputs Co-authored-by: qwen-code-ci-bot <qwen-code-ci@service.alibaba.com>
|
@wenshao Thanks again for the detailed verification. The branch has been updated, but the current CI run is awaiting maintainer approval. When convenient, could you approve the pending workflows and give the PR final approval if it still looks good? Thank you! |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅
— qwen3.7-max via Qwen Code /review


What this PR does
Initializes the visible, unlocked Web Shell workspace selector from the workspace resolved for a supplied workspace ID. A new chat therefore begins in the selected secondary workspace while users can still change that selection.
Why it's needed
When an embedding supplies only a non-primary workspace ID, the session is already scoped to that workspace but the native selector initially displays the primary workspace. The selector can then overwrite the intended target before the first prompt, causing a new session to be created in the primary workspace.
Reviewer Test Plan
How to verify
Evidence (Before & After)
Before: an unlocked embedding that supplied only a secondary workspace ID showed the primary workspace in the native selector, so the first new session could be created in the primary workspace.
After: the selector starts on the resolved secondary workspace, remains unlocked, and the first new session uses that workspace. Automated regression coverage verifies both the resolved-ID selector initialization and the first-session creation path.
Tested on
Environment (optional)
Windows 11, Node.js v24.11.1, npm 11.6.2, and the package-level Vitest configuration. The focused Web Shell regression suite passed 182 tests; formatting and ESLint checks passed for the four changed files.
Risk & Scope
scripts/clean.jsis unavailable, while typecheck lacks the SDK and Web UI declarations required by this checkout. The focused Vitest run required a temporary local module-resolution workaround because this checkout does not contain the SDK package metadata; it was removed and is not part of this PR.workspaceIdand7430; no open pull request fixes this selector initialization.Linked Issues
Fixes #7430
中文说明
本 PR 做了什么
本 PR 会根据传入的工作区 ID 所解析出的工作区,初始化可见且未锁定的 Web Shell 工作区选择器。因此,新聊天会在所选的次级工作区中开始,同时用户仍可修改该选择。
为什么需要它
当嵌入方只传入非主工作区 ID 时,会话本身已经限定在该工作区,但原生选择器初始仍显示主工作区。选择器随后可能在首次提示词之前覆盖预期目标,导致新会话被创建在主工作区。
Reviewer 测试计划
如何验证
证据(Before & After)
Before:只传入次级工作区 ID 的未锁定嵌入会在原生选择器中显示主工作区,因此第一个新会话可能被创建在主工作区。
After:选择器会从解析出的次级工作区开始,保持未锁定状态,第一个新会话也会使用该工作区。自动化回归覆盖同时验证了解析出的 ID 对选择器的初始化,以及第一个会话的创建路径。
测试平台
环境(可选)
Windows 11、Node.js v24.11.1、npm 11.6.2,以及 package 级 Vitest 配置。聚焦的 Web Shell 回归套件通过了 182 个测试;4 个改动文件的格式化和 ESLint 检查均已通过。
风险与范围
scripts/clean.js不可用而停止,typecheck 则缺少此检出所需的 SDK 与 Web UI 声明。聚焦的 Vitest 运行因该检出不包含 SDK 包元数据而需要临时本地模块解析 workaround;该临时内容已移除,且不属于本 PR。workspaceId和7430搜索开放 Pull Request,未发现修复这一选择器初始化问题的开放 PR。关联 Issue
Fixes #7430