fix(web-shell): restore context tags in queued and recalled prompts - #7312
Conversation
🖼️ 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 3 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 |
654d833 to
5143c14
Compare
|
Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. 中文请勿对活跃的 PR 执行 rebase 或 force-push,因为这会使已有的评审评论失效。另外,供日后参考:作为集成流程的一部分,机器人始终会自动将所有改动压缩(squash)为单个提交。 |
5143c14 to
aba61a4
Compare
aba61a4 to
a7b1554
Compare
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
a7b1554 to
e421a5d
Compare
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
e421a5d to
a27e195
Compare
doudouOUC
left a comment
There was a problem hiding this comment.
Reviewed — no blockers. Suggestions are inline.
— qwen3.7-max via Qwen Code /review
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
08e5263 to
ddcb0f9
Compare
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
ddcb0f9 to
26551d3
Compare
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
— qwen3.7-max via Qwen Code /review
26551d3 to
de656ac
Compare
|
The visual harness does not configure a host |
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
350122a to
89d760e
Compare
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
89d760e to
0034989
Compare
|
Released in v0.20.1. |
What this PR does
This PR keeps host-defined context references rendered as tags after a prompt enters the pending queue and when a user recalls a previous prompt through ArrowUp/ArrowDown or history search. It reuses the existing Web Shell customization contract and readonly tag renderer, validates parser output before using it, preserves the serialized prompt byte-for-byte, and regenerates input annotations through the normal submit path. No package-level API changes are introduced.
Why it's needed
The host customization added in #6578 renders context tags correctly in the composer and user-message bubbles, but two secondary prompt surfaces still exposed the raw serialized context syntax. Queued prompts displayed the original markup, and recalled prompts restored plain text instead of inline tags. Besides the visual regression, an immediately resubmitted history item could lose annotations or accidentally retain stale top-level tags.
Reviewer Test Plan
How to verify
Configure an existing
parseUserMessageContentcustomization that maps a serialized context reference to a tag. Submit a prompt while another turn is active and confirm the queued preview renders the context as the host tag rather than raw markup. Recall the same prompt with ArrowUp/ArrowDown and with Ctrl-R using Tab, mouse selection, and Enter; confirm the composer restores inline tags, shell history remains raw, ArrowDown restores the draft, and resubmission preserves the exact serialized source with one matching input annotation. Also exercise a throwing, malformed, or source-mismatching parser and confirm the UI safely falls back to raw text.Evidence (Before & After)
Before: pending queue rows and recalled history prompts exposed the host's serialized context markup as plain text. After: both surfaces render the same readonly/inline tag presentation already used by the composer and user-message bubbles, while the serialized prompt remains unchanged for submission. The behavior was manually verified in a real embedding-host debug session on macOS; no screenshot or recording is attached.
Tested on
Environment (optional)
Tested locally on macOS with the repository Node/npm setup and an embedding-host debug build. Focused Web Shell tests passed (3 files, 47 tests), the full Web Shell suite passed (119 files, 1,918 tests), and the Web Shell coverage run passed (71.6% statements/lines, 78.3% branches, 61.72% functions). Web Shell lint, typecheck, build,
git diff --check, and the repository pre-commit hook also passed. The exact rootnpm run preflightcompleted dependency setup, format, lint, build, and typecheck, then exited in the CLI test workspace on failures outside this seven-file Web Shell patch. Isolated reruns passed all 762 server tests and all 4 extension-list tests with an isolated Qwen home; one current-main AuthDialog assertion remains reproducible because Grok is now listed between DeepSeek and MiniMax while the unchanged test still sends one ArrowDown and expects MiniMax.Risk & Scope
Linked Issues
N/A — this is a follow-up bug fix to the host customization introduced by #6578; no separate issue was supplied.
中文说明
What this PR does
这个 PR 让宿主自定义的上下文引用在 prompt 进入待发送队列后,以及用户通过 ArrowUp/ArrowDown 或历史搜索召回旧 prompt 时,仍然以 tag 形式渲染。实现复用了现有的 Web Shell 自定义契约和只读 tag renderer,在使用 parser 输出前进行校验,逐字节保留序列化 prompt,并通过标准提交链路重新生成 input annotations。本次没有引入包级 API 变更。
Why it's needed
PR #6578 增加的宿主自定义能力已经能在输入框和用户消息气泡中正确渲染上下文 tag,但还有两个次级 prompt 展示面会暴露原始的序列化上下文语法:待发送 prompt 会直接展示原始标记,历史 prompt 被召回时也只会恢复成纯文本而不是内联 tag。除视觉回归外,立即重新提交历史项时还可能丢失 annotations,或者错误带入过期的顶层 tag。
Reviewer Test Plan
How to verify
配置一个现有的
parseUserMessageContent自定义实现,把序列化上下文引用映射为 tag。在另一个 turn 正在执行时提交 prompt,确认队列预览展示宿主 tag,而不是原始标记。再通过 ArrowUp/ArrowDown,以及 Ctrl-R 的 Tab、鼠标选择和 Enter 路径召回同一个 prompt;确认输入框恢复内联 tag,shell 历史仍保持原始文本,ArrowDown 能恢复草稿,重新提交时序列化源文本完全一致且只生成一条匹配的 input annotation。还应让 parser 抛错、返回畸形结构或返回无法无损重建源文本的内容,并确认 UI 安全回退为原始文本。Evidence (Before & After)
变更前:待发送队列行和召回的历史 prompt 会把宿主的序列化上下文标记直接显示为纯文本。变更后:这两个展示面会使用输入框和用户消息气泡已有的只读/内联 tag 展示,同时提交用的序列化 prompt 保持不变。该行为已在 macOS 上的真实嵌入宿主调试会话中完成人工验证;未附带截图或录屏。
Tested on
Environment (optional)
在 macOS 上使用仓库的 Node/npm 环境和嵌入宿主调试构建完成验证。Web Shell 定向测试通过(3 个文件、47 个测试),完整 Web Shell 测试通过(119 个文件、1,918 个测试),Web Shell coverage 运行通过(statements/lines 71.6%、branches 78.3%、functions 61.72%)。Web Shell lint、typecheck、build、
git diff --check和仓库 pre-commit hook 也均通过。精确执行根目录npm run preflight时,依赖安装、format、lint、build 和 typecheck 均完成,随后在 CLI 测试 workspace 中因本次 7 文件 Web Shell 补丁范围外的失败而退出。隔离复跑后,762 个 server 测试全部通过,并且在隔离 Qwen home 后 4 个 extension-list 测试全部通过;当前主干仍可稳定复现一个 AuthDialog 断言失败,原因是 Grok 现在排在 DeepSeek 与 MiniMax 之间,而未更新的测试仍只发送一次 ArrowDown 就期望选中 MiniMax。Risk & Scope
Linked Issues
N/A — 这是对 #6578 所引入宿主自定义能力的后续 bug 修复;未提供独立 issue。