Skip to content

fix(web-shell): remove duplicate useWebShellPortalRoot import in ChatEditor - #6890

Merged
yiliang114 merged 1 commit into
QwenLM:mainfrom
C0d3N1nja97342:fix/web-shell-chat-editor-duplicate-import
Jul 14, 2026
Merged

fix(web-shell): remove duplicate useWebShellPortalRoot import in ChatEditor#6890
yiliang114 merged 1 commit into
QwenLM:mainfrom
C0d3N1nja97342:fix/web-shell-chat-editor-duplicate-import

Conversation

@C0d3N1nja97342

Copy link
Copy Markdown
Contributor

What this PR does

Removes the duplicate import { useWebShellPortalRoot } from '../portalRoot' at packages/web-shell/client/components/ChatEditor.tsx:46, keeping the earlier one at line 21.

Why it's needed

PR #6872 (fix(web-shell): make composer height adaptive) added a second identical import next to a new useWebShellPortalRoot() call site without noticing the same specifier was already imported earlier in the file. TypeScript reports:

client/components/ChatEditor.tsx(21,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
client/components/ChatEditor.tsx(46,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.

That fails the web-shell build script (vite build && vite build --config vite.lib.config.ts && tsc -p tsconfig.lib.json), which runs from scripts/prepare.js during npm ci in CI. So every PR opened against main after #6872 landed sees its Install dependencies step abort before any tests run — the two failing PRs I noticed while testing #6887 both surfaced this same duplicate identifier error, entirely unrelated to their own diffs.

Removing the duplicate line at 46 keeps the two useWebShellPortalRoot() call sites (lines 247 and 858) resolving to the single retained import at line 21, which is what main had before #6872 and what the code intends.

Reviewer Test Plan

How to verify

  • git blame packages/web-shell/client/components/ChatEditor.tsx | grep useWebShellPortalRoot on main before this PR shows the same line imported twice (one from the pre-existing import block, one added by fix(web-shell): make composer height adaptive #6872's diff at line 46).
  • After this PR the specifier appears exactly once: line 21: import { useWebShellPortalRoot } from '../portalRoot';, with the two consumers unchanged at lines 247 and 858.
  • Running npm run typecheck inside packages/web-shell no longer reports TS2300: Duplicate identifier 'useWebShellPortalRoot'. (Other pre-existing errors from unresolved workspace modules on a partially-built tree remain — they are unrelated to this fix and vanish after a full npm ci build, i.e. in CI.)

Evidence (Before & After)

Before (excerpt from #6887 CI run 29331201533):

client/components/ChatEditor.tsx(21,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
client/components/ChatEditor.tsx(46,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
npm error Lifecycle script `build` failed with error:
npm error code 2
npm error workspace @qwen-code/web-shell@0.19.10

After: the useWebShellPortalRoot line at 46 is deleted; only the line-21 import remains. No user-visible behavior change — the file still uses useWebShellPortalRoot() in the same two places it did before.

Tested on

OS Status
🍏 macOS ⚠️
🪟 Windows
🐧 Linux ⚠️

Environment (optional)

npm run typecheck inside packages/web-shell. Verified the duplicate identifier error is gone; remaining local-only errors are workspace-resolution issues that clear once npm ci runs (as it does in CI).

Risk & Scope

  • Main risk or tradeoff: none. The duplicate was a no-op accepted by JavaScript at runtime but rejected by TypeScript at build time; removing it restores intent.
  • Not validated / out of scope: nothing else in ChatEditor.tsx — only the extra import line was removed.
  • Breaking changes / migration notes: none.

Linked Issues

Follow-up to #6872 (introduced the duplicate). No dedicated issue was filed; the failure is visible on every open PR's CI, e.g. #6887's Test (ubuntu-latest, Node 22.x) and web-shell E2E Smoke runs.

中文说明

这个 PR 做了什么

移除 packages/web-shell/client/components/ChatEditor.tsx:46 处重复的 import { useWebShellPortalRoot } from '../portalRoot',保留第 21 行原有那个。

为什么需要

PR #6872fix(web-shell): make composer height adaptive)在新的 useWebShellPortalRoot() 调用旁边添加了第二个完全相同的 import,没注意到文件靠上位置已经有了同名 import。TypeScript 报错:

client/components/ChatEditor.tsx(21,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
client/components/ChatEditor.tsx(46,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.

这让 web-shellbuild 脚本(vite build && vite build --config vite.lib.config.ts && tsc -p tsconfig.lib.json)失败,而 build 会在 CI 的 npm ci 过程中通过 scripts/prepare.js 执行。因此 #6872 合入后每个针对 main 打开的 PR,Install dependencies 步骤都会在跑任何测试之前中断——我测试 #6887 时发现的两个失败 PR 都是同一处 duplicate identifier 错误,跟它们自己的 diff 完全无关。

删除第 46 行后,两个 useWebShellPortalRoot() 调用(第 247、858 行)继续 resolve 到第 21 行保留下来的那个 import,与 #6872 之前 main 的状态一致,也符合代码原意。

复审测试计划

如何验证

  • 在本 PR 之前,git blame packages/web-shell/client/components/ChatEditor.tsx | grep useWebShellPortalRootmain 上会看到同一 specifier 被 import 两次(一个来自原有 import 块,一个是 fix(web-shell): make composer height adaptive #6872 diff 在第 46 行新加的)。
  • 本 PR 后,specifier 精确出现一次:第 21 行: import { useWebShellPortalRoot } from '../portalRoot';,两个消费者(第 247、858 行)不变。
  • packages/web-shellnpm run typecheck 不再报 TS2300: Duplicate identifier 'useWebShellPortalRoot'。(部分构建下 workspace 模块未解析产生的其他既有错误与本修复无关,全量 npm ci 后消失,即 CI 环境。)

证据(Before & After)

Before(摘自 #6887 CI 运行 29331201533):

client/components/ChatEditor.tsx(21,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
client/components/ChatEditor.tsx(46,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
npm error Lifecycle script `build` failed with error:
npm error code 2
npm error workspace @qwen-code/web-shell@0.19.10

After:第 46 行 useWebShellPortalRoot import 被删除,仅保留第 21 行的 import。无用户可见行为变更——文件仍在原来的两处使用 useWebShellPortalRoot()

测试环境

系统 状态
🍏 macOS ⚠️
🪟 Windows
🐧 Linux ⚠️

环境(可选)

packages/web-shell 中的 npm run typecheck。已确认 duplicate identifier 错误消失;剩余本地 only 错误是 workspace 解析问题,CI 中 npm ci 后即消失。

风险与范围

  • 主要风险 / 取舍:无。重复 import 在 JavaScript 运行时被接受为 no-op,但被 TypeScript 编译时拒绝;移除它即恢复代码原意。
  • 未验证 / 范围之外:ChatEditor.tsx 中除该 import 外别无它改。
  • 破坏性变更 / 迁移说明:无。

关联 Issue

跟进 #6872(引入了 duplicate)。无专门 issue;每个打开的 PR 都能看到该失败,例如 #6887Test (ubuntu-latest, Node 22.x)web-shell E2E Smoke 运行。

…Editor

PR QwenLM#6872 ("fix(web-shell): make composer height adaptive") added a
second `import { useWebShellPortalRoot } from '../portalRoot'` at
ChatEditor.tsx:46 without noticing the identical import already existed
at line 21. TypeScript reports:

  TS2300: Duplicate identifier 'useWebShellPortalRoot'.

This fails the web-shell build (`vite build && ... && tsc -p
tsconfig.lib.json`) in `npm run prepare`, so every subsequent PR's CI
`Install dependencies` step aborts before any real test runs. Remove
the duplicate line 46 (keep the earlier import) so `main` builds again.

The two callers at lines 247 and 858 continue to resolve to the
single retained import.
@C0d3N1nja97342

Copy link
Copy Markdown
Contributor Author

@qwen-code /review

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

Template looks good ✓

Problem: Observed bug. PR #6872 introduced a duplicate import { useWebShellPortalRoot } from '../portalRoot' at line 46 of ChatEditor.tsx, while the same import already existed at line 21. TypeScript reports TS2300: Duplicate identifier 'useWebShellPortalRoot', which breaks the web-shell build script and causes CI to fail on every PR opened against main. The error output and CI run reference are provided in the PR body.

Direction: Aligned — this is a build-breaking regression on main that blocks all other PRs from passing CI. Fixing it is urgent and uncontroversial.

Size: Not applicable — the only changed file (packages/web-shell/client/components/ChatEditor.tsx) is not a core module path. 0 additions, 1 deletion.

Approach: The scope is exactly right — a single-line deletion that removes the duplicate import. The two consumers of useWebShellPortalRoot() (lines 248 and 859) continue to resolve to the retained import at line 21. No simpler path exists; this is already the minimum fix.

Moving on to code review. 🔍

中文说明

感谢贡献!

模板完整 ✓

问题:已观测到的 bug。 PR #6872ChatEditor.tsx 第 46 行引入了重复的 import { useWebShellPortalRoot } from '../portalRoot',而第 21 行已有同名 import。TypeScript 报 TS2300: Duplicate identifier 'useWebShellPortalRoot',导致 web-shell 构建失败,所有针对 main 的 PR 的 CI 都无法通过。PR 正文中提供了错误输出和 CI 运行引用。

方向:对齐——这是 main 上的构建回归,阻塞了所有其他 PR 的 CI。修复紧迫且无争议。

规模:不适用——唯一修改的文件(packages/web-shell/client/components/ChatEditor.tsx)不在核心模块路径下。0 行新增,1 行删除。

方案:范围完全正确——仅删除重复 import 的一行改动。useWebShellPortalRoot() 的两个调用方(第 248 和 859 行)继续解析到第 21 行保留的 import。不存在更简路径,这已是最小修复。

进入代码审查 🔍

Qwen Code · qwen3.7-max

Reviewed at 00550405101cde3a9abb0e2d843cecd16629c846 · re-run with @qwen-code /triage

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Code Review

The diff is a single-line deletion — exactly what's needed. Independent assessment: given a duplicate import { useWebShellPortalRoot } from '../portalRoot' at lines 21 and 46, the fix is to delete one. The PR correctly removes the later duplicate (line 46, introduced by #6872) and keeps the original (line 21). Both consumers at lines 248 and 859 continue to resolve correctly. No correctness issues, no regressions, no AGENTS.md violations.

Nothing else to flag — this is the minimum possible fix.

Real-Scenario Testing

Reproduced the build failure on main and confirmed the fix on the PR branch using npm run build:

Before (main, 3e81315ad):

client/components/ChatEditor.tsx(21,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
client/components/ChatEditor.tsx(46,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
npm error Lifecycle script `build` failed with error:
npm error code 2
npm error workspace @qwen-code/web-shell@0.19.10

After (PR branch, 005504051):

> qwen-code-vscode-ide-companion@0.19.10 build:dev
> npm run check-types && npm run lint && node esbuild.js

> qwen-code-vscode-ide-companion@0.19.10 check-types
> tsc --noEmit

> qwen-code-vscode-ide-companion@0.19.10 lint
> eslint src

> @qwen-code/chrome-bridge@0.19.10 build
> node scripts/sync-extension.js && node config/esbuild.background.config.js --production

Static assets synced -> dist/extension
Background/content build complete!

Build passes cleanly — no TS2300, no lifecycle failure. ✅

中文说明

代码审查

Diff 仅一行删除——完全正确。独立评估:面对第 21 行和第 46 行重复的 import { useWebShellPortalRoot } from '../portalRoot',修复方案是删除其中一个。PR 正确地移除了后面那个重复项(第 46 行,由 #6872 引入),保留了原始的那个(第 21 行)。两个调用方(第 248 和 859 行)继续正确解析。无正确性问题、无回归、无 AGENTS.md 违规。

没有其他需要标记的问题——这已是最小修复。

真实场景测试

main 上复现了构建失败,在 PR 分支上确认了修复,使用 npm run build

Before (main, 3e81315ad):

client/components/ChatEditor.tsx(21,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
client/components/ChatEditor.tsx(46,10): error TS2300: Duplicate identifier 'useWebShellPortalRoot'.
npm error Lifecycle script `build` failed with error:
npm error code 2
npm error workspace @qwen-code/web-shell@0.19.10

After (PR 分支, 005504051):

> qwen-code-vscode-ide-companion@0.19.10 build:dev
> npm run check-types && npm run lint && node esbuild.js

> @qwen-code/chrome-bridge@0.19.10 build
> node scripts/sync-extension.js && node config/esbuild.background.config.js --production

Static assets synced -> dist/extension
Background/content build complete!

构建干净通过——无 TS2300、无 lifecycle 失败。✅

Qwen Code · qwen3.7-max

Reviewed at 00550405101cde3a9abb0e2d843cecd16629c846 · re-run with @qwen-code /triage

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Confidence: 5/5

This is a one-line deletion that removes a duplicate import introduced by #6872. The TS2300 error is reproduced on main and resolved on the PR branch — build passes cleanly. No code review concerns, no AGENTS.md violations, no risk of regression.

This PR unblocks CI for every other PR against main. Recommend merging immediately.

中文说明

信心度:5/5

这是一个单行删除,移除了 #6872 引入的重复 import。TS2300 错误在 main 上已复现,在 PR 分支上已解决——构建干净通过。无代码审查问题、无 AGENTS.md 违规、无回归风险。

此 PR 解除了所有针对 main 的 PR 的 CI 阻塞。建议立即合并。

Qwen Code · qwen3.7-max

Reviewed at 00550405101cde3a9abb0e2d843cecd16629c846 · re-run with @qwen-code /triage

@qwen-code-ci-bot qwen-code-ci-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, looks ready to ship. ✅

@yiliang114
yiliang114 enabled auto-merge July 14, 2026 12:48
@yiliang114
yiliang114 disabled auto-merge July 14, 2026 12:48

@qwen-code-ci-bot qwen-code-ci-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed. Not reviewed: chunk 1 — no agent reported covering these; nobody read them.

— qwen3.7-max via Qwen Code /review

@dreamWB

dreamWB commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the minimal fix. Tracking issue: #6884. One provenance correction: #6872\u0027s source head contained only one import; the duplicate appeared when that patch composed cleanly with concurrent PR #6804 on the newer main, while PR CI validated the head ref. The one-line deletion here is still the correct repair.

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.

4 participants