Skip to content

feat(transcript): add identity, VS Code adapter, and HTML export - #9641

Open
water-in-stone wants to merge 18 commits into
QwenLM:mainfrom
water-in-stone:codex/backup-feat-web-shell-adapter-before-split-20260818
Open

feat(transcript): add identity, VS Code adapter, and HTML export#9641
water-in-stone wants to merge 18 commits into
QwenLM:mainfrom
water-in-stone:codex/backup-feat-web-shell-adapter-before-split-20260818

Conversation

@water-in-stone

@water-in-stone water-in-stone commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

This PR implements the second phase of the shared read-only chat transcript design for Web Shell, VS Code, Desktop, and HTML Export without introducing a new cross-host ChatPanel package or message model.

  • Keeps the existing daemon transcript blocks as the shared runtime boundary and preserves the current interactive and readonly raw tool semantics, including full write_file Turn Output diffs.
  • Establishes producer-stamped segment provenance and stable, scope-keyed block identity for both direct-daemon and ACP inputs; both candidates pass the documented append, partial-prepend, and replay matrix, and ACP is selected as the product transport.
  • Adds a feature-flagged VS Code Web Shell timeline while retaining the existing composer, permission, session, and host-action ownership; the legacy timeline remains the default and the fallback when stable identity is unavailable.
  • Routes CLI, Web API, VS Code, and the integration runner through one version-bound HTML Export path derived from a closed, document-only transcript DTO with typed previews, opaque IDs, explicit budgets, strict CSP, zero-runtime-network intent, and safe incompatibility handling.
  • Makes Mermaid limits and safe preview/result consumption document-mode-only, removes prevalidation-only production probes, and consolidates structural validation around one production JSON Schema plus a small semantic safety layer for constraints that JSON Schema cannot express.
  • Keeps the migration gate honest: direct-daemon and ACP identity and the product HTML browser gate pass, but the overall result remains fail until scope/generation, host-action, VSIX, and packaging evidence is complete.

Why it's needed

The existing hosts have different transcript and export paths, which creates duplicated replay/rendering logic, unstable identity across replay or history prepend, and a risk that future VS Code or HTML migrations drift from Web Shell behavior. HTML export additionally needs a one-way security boundary so runtime raw payloads, credentials, absolute paths, session identity, unsafe resources, and unbounded rendering work cannot leak into a portable document. This design provides repeatable contract evidence and real product consumers while preserving the default Web Shell, Desktop, and VS Code behavior during rollout.

Reviewer Test Plan

How to verify

  1. Run npm run build and npm run typecheck; expect all workspace packages, the Web Shell library, the embedded document renderer, the CLI, and the VS Code companion to build and type-check.
  2. From integration-tests, run npx vitest run chat-transcript-contract.test.ts; expect fixture hashes, the canonical schema, raw-free document semantics, and stable identity for both direct-daemon and ACP to pass while the expected overall gate remains fail.
  3. Run the focused SDK, Web Shell, CLI Export, and VS Code adapter tests; expect distinct tagged segments to retain stable identity, default raw Turn Output behavior to remain unchanged, product HTML callers to pass source records into the document exporter, and the VS Code feature flag to default to the legacy timeline.
  4. With the VS Code experimental transcript flag disabled, load live and restored sessions and confirm the existing timeline, composer, permissions, session controls, file actions, and editing behavior remain unchanged. Enable the flag and confirm compatible ACP live/history updates render through the shared read-only timeline; remove stable text provenance and confirm it falls back to legacy.
  5. Generate HTML through the CLI, Web API, VS Code, and integration runner; expect the same version-bound self-contained document renderer, no raw tool payloads or sensitive metadata, safe typed tool/plan/permission presentation, and a read-only error page for incompatible schema or renderer versions.
  6. In an environment that can launch Playwright Chromium, run the document browser gate and confirm maximum-budget open/search/copy/print behavior, zero unexpected requests, zero CSP violations, and safe Markdown, Mermaid, image, diff, and code fallbacks.

Evidence (Before & After)

No screenshots or recordings are included. Repeatable fixtures, hashes, capability decisions, focused package validation, direct-daemon/ACP identity results, product HTML build assertions, and integration-runner convergence are covered; the real Playwright Chromium gate now passes maximum-document open/search/copy/print, active CSP enforcement, zero unexpected network requests, and the real product HTML entry point.

Tested on

OS Status
🍏 macOS ✅ tested — SDK, Core, CLI, Web Shell, VS Code, identity gates, Node-side HTML assertions, and the Playwright Chromium product browser gate passed
🪟 Windows ⚠️
🐧 Linux ⚠️

Environment (optional)

macOS 26.0, Node.js v22.22.3, npm 10.9.8, local non-sandboxed workspace.

Risk & Scope

  • Main risk or tradeoff: Stable block identity alone does not complete host-action safety; scope/generation admission, late event/action rejection, copy/edit/open-file mapping, and full legacy parity still require product-level evidence before rollout.
  • Not validated / out of scope: Reconnect and generation behavior, VSIX and installed-artifact packaging, Windows and Linux, Desktop installed-artifact smoke, OpenWork/Craft Electron, and unification of composer, active permissions, session management, transport, persistence, or host overlays.
  • Breaking changes / migration notes: The VS Code Web Shell timeline is opt-in and falls back to the legacy timeline; interactive and readonly raw semantics remain the compatibility baseline, document-only safe projection does not flow back into live sessions, and the overall migration gate intentionally remains fail.

Linked Issues

Closes #9387

中文说明

What this PR does

本 PR 实现 Web Shell、VS Code、Desktop 与 HTML Export 共享只读聊天 transcript 设计的第二阶段,不新增跨宿主 ChatPanel 包或消息模型。

  • 继续以现有 daemon transcript blocks 作为共享运行时边界,保持当前 interactive/readonly 的 raw 工具语义,包括 write_file Turn Output 的完整 diff。
  • 为 direct-daemon 与 ACP 输入建立 producer-stamped segment provenance 和按 scope 派生的稳定 block identity;两条候选路径均通过文档定义的 append、partial-prepend 和 replay matrix,并选择 ACP 作为产品 transport。
  • 为 VS Code 增加 feature-flagged Web Shell 时间线,同时继续由现有宿主持有 composer、permission、session 和 host actions;legacy timeline 仍是默认路径,并在缺少稳定 identity 时作为回退。
  • 让 CLI、Web API、VS Code 和 integration runner 复用同一条版本绑定的 HTML Export 产品路径;该路径由封闭的 document-only transcript DTO 单向派生,并提供 typed previews、opaque IDs、显式预算、严格 CSP、运行时零网络目标和安全的不兼容处理。
  • Mermaid 限制和安全 preview/result 消费仅在 document mode 生效;删除只服务预验证的生产 probe,并将结构校验收敛为唯一生产 JSON Schema,加上一层处理 JSON Schema 无法表达约束的小型语义安全校验。
  • 保持迁移门禁真实:direct-daemon、ACP identity 和产品 HTML browser gate 已通过,但在 scope/generation、host-action、VSIX 和 packaging 证据完整前,overall 仍为 fail

Why it's needed

现有宿主拥有不同的 transcript 与 export 路径,导致 replay/rendering 逻辑重复、replay 或历史 prepend 后 identity 不稳定,并使未来 VS Code 或 HTML 迁移存在偏离 Web Shell 行为的风险。HTML Export 还需要单向安全边界,防止运行时 raw payload、credential、绝对路径、session identity、不安全资源和无界渲染工作进入可移植文档。本设计在保持 Web Shell、Desktop 和 VS Code 默认行为不变的前提下,提供可重复的契约证据和真实产品消费者。

Reviewer Test Plan

How to verify

  1. 运行 npm run buildnpm run typecheck;预期所有 workspace packages、Web Shell library、内嵌 document renderer、CLI 和 VS Code companion 均可构建并通过类型检查。
  2. integration-tests 中运行 npx vitest run chat-transcript-contract.test.ts;预期 fixture hashes、canonical schema、raw-free document semantics,以及 direct-daemon/ACP 两条路径的 stable identity 均通过,同时 expected overall gate 仍保持 fail
  3. 运行聚焦的 SDK、Web Shell、CLI Export 和 VS Code adapter 测试;预期不同 tagged segments 保持稳定 identity,默认 raw Turn Output 行为不变,产品 HTML 调用方将 source records 传入 document exporter,并且 VS Code feature flag 默认使用 legacy timeline。
  4. 在 VS Code experimental transcript flag 关闭时加载 live 和 restored sessions,确认现有 timeline、composer、permissions、session controls、file actions 和 editing 行为不变。开启该 flag 后,确认兼容的 ACP live/history updates 通过共享只读时间线渲染;移除稳定文本 provenance 后,确认回退到 legacy。
  5. 分别通过 CLI、Web API、VS Code 和 integration runner 生成 HTML;预期它们使用同一个版本绑定的自包含 document renderer,不包含 raw tool payload 或敏感 metadata,安全展示 typed tool/plan/permission,并在 schema 或 renderer version 不兼容时显示只读错误页。
  6. 在能够启动 Playwright Chromium 的环境中运行 document browser gate,确认最大预算文档能够执行 open/search/copy/print,unexpected requests 为零、CSP violations 为零,并且 Markdown、Mermaid、image、diff 和 code 均具备安全 fallback。

Evidence (Before & After)

本 PR 未包含 screenshot 或 recording。可重复 fixture、hash、capability decisions、聚焦包验证、direct-daemon/ACP identity、产品 HTML build assertions 和 integration-runner 收敛均有覆盖;真实 Playwright Chromium gate 已通过最大文档 open/search/copy/print、主动 CSP enforcement、零意外网络请求和真实产品 HTML 入口验证。

Tested on

OS Status
🍏 macOS ✅ tested — SDK、Core、CLI、Web Shell、VS Code、identity gates、Node-side HTML assertions 和 Playwright Chromium 产品 browser gate 已通过
🪟 Windows ⚠️ not tested
🐧 Linux ⚠️ not tested

Environment (optional)

macOS 26.0、Node.js v22.22.3、npm 10.9.8;Playwright Chromium 产品 browser gate 已完成。

Risk & Scope

  • Main risk or tradeoff: 稳定 block identity 本身并不能完成 host-action 安全性;在 rollout 前,scope/generation admission、迟到 event/action rejection、copy/edit/open-file mapping 和完整 legacy parity 仍需产品级证据。
  • Not validated / out of scope: reconnect 和 generation 行为、VSIX 与 installed-artifact packaging、Windows 和 Linux、Desktop installed-artifact smoke、OpenWork/Craft Electron,以及 composer、active permissions、session management、transport、persistence 或 host overlays 的统一均未验证或不在范围内。
  • Breaking changes / migration notes: VS Code Web Shell timeline 为 opt-in,并可回退到 legacy timeline;interactive/readonly raw semantics 仍是兼容性基线,document-only safe projection 不会回流 live sessions,overall migration gate 有意保持 fail

Linked Issues

N/A


Closes: #9387


heyang.why added 3 commits August 20, 2026 15:26
Establish a shared transcript model and document-mode projection so Web
Shell, VS Code, and HTML export can consume the same stable conversation
semantics without changing interactive rendering.

- Preserve daemon and ACP segment identity across replay and normalization
- Add export-safe previews and a versioned transcript document builder
- Add document-mode Web Shell rendering with bounded Mermaid processing
- Lock direct-daemon and ACP behavior with contract fixtures
- Cover render and export equivalence in integration tests
Move transcript prevalidation onto real product paths while preserving
the legacy VS Code timeline as the default fallback.

- Add version-bound document HTML with strict CSP and schema checks
- Add opt-in ACP projection with stable source identity
- Reuse product export code across hosts and the integration runner
- Remove test-only production probes and consolidate shared validation

Note: Browser, host-action, VSIX, and packaging gates remain pending.
Keep the npm lockfile aligned with the VS Code and HTML export package
manifests added by the transcript consumer migration.

- Lock the VS Code Web Shell workspace dependency
- Lock Web Templates SDK, Web Shell, and React build dependencies
@github-actions github-actions Bot added the review/self-reported The linked issue was opened by the PR author (self-reported) label Aug 21, 2026
@qwen-code-ci-bot

qwen-code-ci-bot commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Qwen Triage finishedview run. See the stage comments in this thread for the result.

Qwen Triage 已完成 —— 查看运行。结果见本线程中的各阶段评论。

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Thanks for continuing the transcript contract work! The gate passes on template and problem, but the direction needs a maintainer's call before anyone sinks time into a 10k-line review.

  • Template: complete ✓ — all required sections present.
  • Problem: real and linked. Prevalidate a shared chat transcript contract across hosts #9387 was accepted for exploration in issue triage (stable cross-host transcript identity is a recurring theme — Concurrent session writers can fork transcript history and hide responses #7164, bug(core): MAX_TOKENS output recovery leaves the durable transcript disagreeing with history, so --resume rehydrates duplicated turns #8979, Reuse WebShell transcript UI in the VS Code companion #9187), and part 1 of this work already merged as feat(web-shell): add transcript contract prevalidation #9388. This is a feature request, so no reproduction is required; note the issue is self-reported by the PR author (review/self-reported).
  • Direction: aligned with the multi-host transcript/export roadmap in principle, but escalated to a maintainer here (Stage 1c) for two reasons:
    • It touches public contract surface: ACP session updates gain _meta.qwenTranscript.segmentId, sdk-typescript projection/preview types change, and ExportTranscriptDocumentV1 introduces a new versioned document format.
    • What this PR is remains ambiguous — see Approach.
  • Size: core-infrastructure scope (cross-package change spanning acp-bridge, cli, core, sdk-typescript, vscode-ide-companion, web-shell, web-templates). Breakdown: ≈4,531 production-logic lines / ≈4,598 test lines / ≈1,544 fixtures, docs, CSS, schema and integration scripts (99 files, +8,834/−1,839). Not blocked on size — but this is well past both the 500-line maintainer-awareness mark and the 1,000-line advisory, so consider splitting if feasible.
  • Approach: honest questions before going deeper:
    • The branch and PR title say this is a backup taken before a split (codex/backup-feat-web-shell-adapter-before-split-20260818). Is this meant to be reviewed and merged as-is, or is it a snapshot while the split PRs are prepared? No split PRs are open yet.
    • The description (verify step 5) says no final host consumer is wired, but commit fffebf26 is "wire real VS Code and HTML export consumers", and the diff does add VS Code webview adapters/hooks and touches the export command. Which is the intended scope?
    • The three commits each read like a standalone PR (export pipeline / host wiring / dependency sync) — those seams are the natural split points.
    • The branch currently conflicts with main (expected, since feat(web-shell): add transcript contract prevalidation #9388 landed after it was cut) — it needs a rebase regardless.
    • The PR body itself notes the design doc status header still marks MR2 as deferred and should be reconciled before merge.
  • Risk: packages/cli/src/acp-integration/** matches the revert-correlated high-risk paths, so any later review must run at full depth with CI evidence. Also per the author's own notes: Windows/Linux untested, and the contract/export/Chromium suites were not run during drafting.

⏸️ Deferring to @yiliang114 (who merged part 1, #9388) — needs a human call on: (a) whether this backup branch is a merge candidate now or should wait for the planned split, and (b) the public-contract additions (ACP _meta, SDK types, export document V1). @water-in-stone a one-line answer on the two scope questions above would help a lot. Code review is held until the direction is settled.

Not verified: static gate only (unattended CI run); no code was built or executed.

中文说明

感谢继续推进 transcript 契约工作!模板与问题真实性均通过 gate,但在投入 1 万行的评审之前,方向问题需要维护者拍板。

  • 模板: 完整 ✓ —— 必填小节齐全。
  • 问题: 真实且已关联。Prevalidate a shared chat transcript contract across hosts #9387 已在 issue 分诊中被接受探索(跨宿主 transcript 稳定标识是反复出现的主题 —— Concurrent session writers can fork transcript history and hide responses #7164bug(core): MAX_TOKENS output recovery leaves the durable transcript disagreeing with history, so --resume rehydrates duplicated turns #8979Reuse WebShell transcript UI in the VS Code companion #9187),本工作的第一部分已作为 feat(web-shell): add transcript contract prevalidation #9388 合入。这是功能请求,无需复现;注意该 issue 由 PR 作者本人提交(review/self-reported)。
  • 方向: 原则上与多宿主 transcript/导出路线图一致,但在此按 Stage 1c 升级给维护者,原因有二:
    • 触及公共契约面: ACP session update 新增 _meta.qwenTranscript.segmentId,sdk-typescript 的投影/预览类型发生变化,并引入了新的版本化文档格式 ExportTranscriptDocumentV1
    • 这个 PR 本身的定位仍不明确 —— 见下方"方案"。
  • 规模: 核心基础设施范围(跨 package 改动,涉及 acp-bridge、cli、core、sdk-typescript、vscode-ide-companion、web-shell、web-templates)。拆分:约 4,531 行生产逻辑 / 约 4,598 行测试 / 约 1,544 行 fixtures、文档、CSS、schema 与集成脚本(99 个文件,+8,834/−1,839)。规模不构成阻塞 —— 但已远超 500 行维护者知会线与 1,000 行大 PR 建议线,如可行请考虑拆分。
  • 方案: 深入评审前的几个直接问题:
    • 分支名与 PR 标题表明这是拆分前推送的备份(codex/backup-feat-web-shell-adapter-before-split-20260818)。它是打算按现状评审合入,还是拆分 PR 准备期间的快照?目前没有任何拆分 PR 处于 open 状态。
    • PR 描述(验证步骤 5)称未接入最终宿主消费者,但 commit fffebf26 的信息是 "wire real VS Code and HTML export consumers",且 diff 确实新增了 VS Code webview adapter/hook 并改动了 export 命令。预期范围到底是哪个?
    • 三个 commit 各自都像一个独立 PR(导出管线 / 宿主接入 / 依赖同步)—— 这些接缝正是天然的拆分点。
    • 分支目前与 main 存在冲突(预期之中,因为 feat(web-shell): add transcript contract prevalidation #9388 在分支切出后合入)—— 无论如何都需要 rebase。
    • PR 正文自己也提到:设计文档状态头仍将 MR2 标为 deferred,合入前应对齐。
  • 风险: packages/cli/src/acp-integration/** 命中与 revert 相关的高风险路径,后续评审必须全深度进行并附 CI 证据。另据作者自述:Windows/Linux 未测试,契约/导出/Chromium 专项套件在起草期间未运行。

⏸️ 转交 @yiliang114(第一部分 #9388 的合入者)—— 需要人工决定:(a) 该备份分支是当前即可作为合入候选,还是应等待计划中的拆分;(b) 公共契约面的新增(ACP _meta、SDK 类型、导出文档 V1)。@water-in-stone 如能就上面两个范围问题给出一句话答复会非常有帮助。方向确定前,代码评审暂缓。

未验证项: 仅静态 gate(无人值守 CI);未构建或执行任何代码。

Qwen Code · qwen3.8-max

Reviewed at 1077fb97d42c8b806ca7a7d4995888bb620958c6 · re-run with @qwen-code /triage

…plit-20260818

# Conflicts:
#	packages/acp-bridge/src/transcript-replay.ts
#	packages/sdk-typescript/scripts/build.js
#	packages/sdk-typescript/src/daemon/ui/transcript.ts
#	packages/web-shell/client/components/MessageList.tsx
#	packages/web-shell/client/components/messages/GoalStatusMessage.tsx
@water-in-stone water-in-stone changed the title Codex/backup feat web shell adapter before split 20260818 feat(transcript): add cross-host document export pipeline Aug 21, 2026
@qwen-code-ci-bot

qwen-code-ci-bot commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

🖼️ web-shell visual preview

Rendered against a mock daemon (no real backend): the PR base vs this PR head 893f172. Only screenshots that changed are shown (flows below, if any, are head-only) — refreshes on every push.

Screenshots · before / after

⚠️ No preview: one or more scenarios failed to render on this head — see the workflow run. This is not "no visual change" — a scenario that times out or throws produces no image. Fix the failing scenario (or a genuine regression it caught) and the preview returns on the next push.

Full-resolution recordings (.webm) are attached to the workflow run.

Qwen Code · web-shell visuals

@qwen-code-ci-bot

qwen-code-ci-bot commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

🩺 serve daemon A/B

Built the PR base vs this PR head 893f172, drove a fixed endpoint set against each, and diffed the JSON responses. Only fields that changed are shown.

No response changes against the PR base across 12 scenario(s).

Qwen Code · serve A/B

@water-in-stone

Copy link
Copy Markdown
Collaborator Author

@qwen-code-ci-bot I have updated the PR body and resolved all conflicts. Please take another look

@water-in-stone

Copy link
Copy Markdown
Collaborator Author

@qwen-code-ci-bot /review

@qqqys qqqys 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.

Critical — the current head c5d8a53 fails the Ubuntu Node 22 check before tests run. This PR adds @qwen-code/web-shell to packages/vscode-ide-companion/package.json, but does not update packages/vscode-ide-companion/NOTICES.txt. The required notices verification regenerates that file with 9,311 additions and exits 1, blocking the PR. Please run npm run generate:notices --workspace=qwen-code-vscode-ide-companion and commit the generated NOTICES.txt. Evidence: https://github.com/QwenLM/qwen-code/actions/runs/32451973539/job/96682045074

@yiliang114

Copy link
Copy Markdown
Collaborator

The title add cross-host document export pipeline only covers the HTML export piece, but this PR actually bundles four independent features:

  1. ACP VS Code transcript adapteracpTranscriptAdapter.ts + useAcpTranscript.ts + App.tsx feature flag
  2. Stable identity / segment provenancetranscript-update-identity.ts + projectStableTranscriptBlockIds + SDK types.ts/normalizer.ts changes
  3. HTML export pipelineexport-transcript-document.ts + formatters/html.ts + document-main.tsx + web-templates
  4. Web-shell readonly/document mode renderingMarkdown.tsx/ToolGroup.tsx/PlanMessage.tsx etc (~20 files)

The body says "implements the second phase of the shared read-only chat transcript design", which matches the design doc MR2 scope — but the title only mentions export. Consider renaming to something that covers the full scope, e.g. feat: MR2 — cross-host transcript identity, VS Code ACP adapter, and export pipeline.

Also, the branch name backup-feat-web-shell-adapter-before-split-20260818 suggests a split was planned. If the intent is to land this as one PR, it would help to state why it should not be split (e.g. the four areas are coupled by the stable-identity contract).

Lastly, CI is red: @qwen-code/web-shell was added to packages/vscode-ide-companion/package.json but NOTICES.txt was not regenerated. Running npm run generate:notices --workspace=qwen-code-vscode-ide-companion and committing the result should fix the Ubuntu Node 22 check.

@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.

Partially reviewed — gaps disclosed.

Not explored to full depth (tool budget reached): chunk 27: executing transcriptToMessages.test.ts under vitest and running the web-shell typecheck (blocked by missing workspace install in the review worktree); chunk 11: executing the new/changed tests (worktree has no node_modules / dist and a full monorepo install + build exceeded the review budget; verification is static ag…; "agent reverse-audit (round 1)": verify vitest expect.poll default timeout against the maximum-document render time in test 2 — could not locate the poll implementation in the bundled vitest ….

Not reviewed: reverse audit — stopped before round 3 by the review time budget.

中文说明

仅完成部分审查,审查缺口已披露。

未探索到全部深度(达到工具调用预算):chunk 27:executing transcriptToMessages.test.ts under vitest and running the web-shell typecheck (blocked by missing workspace install in the review worktree);chunk 11:executing the new/changed tests (worktree has no node_modules / dist and a full monorepo install + build exceeded the review budget; verification is static ag…"agent reverse-audit (round 1)"verify vitest expect.poll default timeout against the maximum-document render time in test 2 — could not locate the poll implementation in the bundled vitest …

未审查:反向审计——评审时间预算不足,未能开始第 3 轮。

— qwen3.8-max via Qwen Code /review (v0.21.15)

Comment thread packages/cli/src/ui/utils/export/formatters/html.ts
Comment thread integration-tests/concurrent-runner/export-html-from-chatrecord-jsonl.js Outdated
Comment thread packages/cli/src/ui/utils/export/export-transcript-document.ts Outdated
Comment thread packages/cli/src/ui/utils/export/export-transcript-document.ts Outdated
Comment thread packages/cli/src/ui/utils/export/export-transcript-document.ts Outdated
Comment thread packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts Outdated
Comment thread packages/web-templates/src/export-html/build.mjs Outdated
Comment thread packages/sdk-typescript/src/daemon/ui/toolPreview.ts
Comment thread packages/sdk-typescript/src/daemon/ui/toolPreview.ts Outdated
Comment thread packages/web-shell/client/components/messages/ToolGroup.test.tsx
Resolve review findings across document export and the VS Code ACP
timeline while preserving default interactive and readonly semantics.

- Preserve stable text and non-text identity across live and replay
- Harden export projection, budgets, URL handling, CSP, and nonces
- Make document rendering complete, inert, and browser-validated
- Keep VS Code transcript scope, theme, copy, and flags reactive
- Restore fixture, schema, hash, and compatibility contract locks

Note: The overall gate remains failed pending VSIX, host-action, and
packaged-artifact evidence.
@water-in-stone water-in-stone changed the title feat(transcript): add cross-host document export pipeline feat(transcript): add identity, VS Code adapter, and HTML export Aug 22, 2026
@water-in-stone

Copy link
Copy Markdown
Collaborator Author

Addressed the review feedback in bff6f3b2f6.

  • Renamed the PR and updated the body to describe the full MR2 scope: stable identity, the feature-flagged VS Code ACP consumer, document-mode Web Shell behavior, and the HTML Export consumer. MR1 is already merged as feat(web-shell): add transcript contract prevalidation #9388; this PR is the intended MR2 merge candidate because both consumers depend on the same identity and document contract.
  • Regenerated and committed packages/vscode-ide-companion/NOTICES.txt; a second generation produced the same SHA-256 hash.
  • Fixed the Critical and accepted Suggestion findings from the review, including export degradation/sanitization, session scope isolation, non-text ACP identity, document inertness, per-export CSP nonces, and restored contract locks.
  • Ran the real Playwright Chromium product gate successfully: maximum-document open/search/copy/print, active CSP enforcement, zero unexpected requests, safe remote-resource fallback, and the actual HTML Export entry point all pass.

Validation completed locally: repository build and typecheck, focused CLI/Web Shell/VS Code/SDK/ACP tests, contract fixtures, HTML browser gate, ESLint, Prettier, and NOTICES idempotence.

The frozen overall gate intentionally remains fail only for the remaining VS Code reconnect/generation, host-action/VSIX, and packaged-artifact evidence. I am replying to the individual review threads with the exact fixes and resolving the addressed threads.

heyang.why added 2 commits August 22, 2026 22:49
…eb-shell-adapter-before-split-20260818

# Conflicts:
#	packages/web-shell/client/components/MessageList.tsx
#	packages/web-shell/client/components/messages/AssistantMessage.tsx
#	packages/web-shell/client/components/messages/ToolGroup.tsx

@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.

Partially reviewed — gaps disclosed.

Not reviewed: build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and the browser-gate half of chat-transcript-document.test.ts cannot execute there (Chromium binaries not installed — see finding R2-7); the Node-side halves were executed locally.

Not explored to full depth (tool budget reached): chunk 64: none — I chose not to run the two test files because this worktree has no node_modules and a full install exceeds this chunk's budget; the static verification…; chunk 22: could not execute packages/sdk-typescript/test/unit/daemonUi.test.ts — node_modules is not installed in this review worktree and dependency installation was o…; chunk 3: executing integration-tests/chat-transcript-contract.test.ts via vitest (worktree has no node_modules; requires npm ci + build + bundle); chunk 3: running tsc -p integration-tests/tsconfig.json over the rewritten tests (no node_modules; typing verified statically against lockfile TypeScript 5.9.3 instead…; chunk 13: none. (I did not execute the two unit test files because this shared review worktree has no node_modules and no built packages/core/dist ; a full install+bui….

Not reviewed: reverse audit — stopped before round 3 by the review time budget.

Deferred under the convergence posture (round 2, not a blocker) — recorded, not requested in this round:

  • packages/cli/src/ui/utils/export/export-transcript-document.ts:1594 — [review] Fence-language case divergence between builder and validator; sanitizer misses two URL shapes
  • packages/cli/src/ui/utils/export/export-transcript-document.ts:2030 — [review] redactHomePaths misses /usr/home, /root, and custom home bases
  • packages/web-shell/client/adapters/transcriptToMessages.ts:1560 — [review] Safe projection crashes on malformed typed previews (crafted-file trigger)
  • integration-tests/chat-transcript-document.test.ts:525 — [review] Heap gate ?? 0 fallback passes vacuously if performance.memory is absent
  • packages/vscode-ide-companion/src/webview/App.tsx:1395 — [review] Copy message silently no-ops for rows without data-source-block-ids
  • packages/web-shell/client/components/messages/Markdown.tsx:318 — [review] Mermaid queue: interactive starvation and post-timeout overlap
  • packages/web-templates/src/export-html/src/document-main.tsx:86 — [review] DocumentError fail-closed path untested
  • packages/vscode-ide-companion/src/webview/handlers/SessionMessageHandler.ts:1195 — [review] Resume-fallback scope desync on archived session id
  • packages/cli/src/ui/utils/export/export-transcript-document.ts:956 — [review] Link reference definitions last-wins vs renderer first-wins
  • integration-tests/chat-transcript-contract.test.ts:205 — [review] Closed-shape lock skips toolResultPreview inline branches
  • integration-tests/chat-transcript-contract.test.ts:477 — [review] Identity gate vacuously satisfiable on empty candidates
  • integration-tests/chat-transcript-document.test.ts:625 — [review] Gate report publishes the harness's own CSP probe violation
  • integration-tests/chat-transcript-document.test.ts:682 — [review] Zero-network gate asserts 4 of 12 CSP directives
  • packages/cli/src/ui/utils/export/export-transcript-document.ts:1016 — [review] Rich-task rewrite ignores fence segmentation
  • packages/sdk-typescript/src/daemon/ui/transcript.ts:1279 — [review] Shell block merging lacks the segmentId guard
  • packages/cli/src/ui/utils/export/export-transcript-document.ts:1621 — [review] Image titles containing ) escape all image gates
  • packages/vscode-ide-companion/src/webview/adapters/acpTranscriptAdapter.ts:44 — [review] compatible latch is irreversible
  • packages/web-shell/client/adapters/transcriptToMessages.test.ts:2540 — [review] mergeToolCall safeToolProjection clauses unpinned by tests
  • packages/web-shell/client/adapters/transcriptToMessages.ts:484 — [review] mid_turn_message_injected echoes lack sourceBlockIds

Mechanism health: this round did not close cleanly, so it withholds the incremental anchor — and the round it recovered had none either, so the next review re-reads the whole diff and will keep doing so until a round's marker carries an anchor again. (Stated, not acted on — this changes nothing about what the round posts.)

中文说明

仅完成部分审查,审查缺口已披露。

未审查:build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and the browser-gate half of chat-transcript-document.test.ts cannot execute there (Chromium binaries not installed — see finding R2-7); the Node-side halves were executed locally。

未探索到全部深度(达到工具调用预算):chunk 64:none — I chose not to run the two test files because this worktree has no node_modules and a full install exceeds this chunk's budget; the static verification…;chunk 22:could not execute packages/sdk-typescript/test/unit/daemonUi.test.ts — node_modules is not installed in this review worktree and dependency installation was o…;chunk 3:executing integration-tests/chat-transcript-contract.test.ts via vitest (worktree has no node_modules; requires npm ci + build + bundle);chunk 3:running tsc -p integration-tests/tsconfig.json over the rewritten tests (no node_modules; typing verified statically against lockfile TypeScript 5.9.3 instead…;chunk 13:none. (I did not execute the two unit test files because this shared review worktree has no node_modules and no built packages/core/dist ; a full install+bui…

未审查:反向审计——评审时间预算不足,未能开始第 3 轮。

收敛姿态下延后(第 2 轮,非阻断)——已记录,本轮不要求修改:共 19 条(原文未翻译,列表见上方英文部分)。

机制健康:本轮未能干净收尾,因而扣留了增量锚点,而它恢复到的那一轮也没有锚点,因此下一次评审将重读整个 diff——并会一直如此,直到某一轮的标记重新带上锚点。(仅陈述,不据此行动——这不改变本轮发布的任何内容。)

— qwen3.8-max via Qwen Code /review (v0.21.15)

Comment thread packages/acp-bridge/src/transcript-replay.ts
Comment thread packages/cli/src/acp-integration/session/Session.ts Outdated
Comment thread packages/web-templates/src/export-html/src/document-main.tsx
Comment thread packages/cli/src/ui/utils/export/export-transcript-document.ts
Comment thread packages/web-shell/client/components/messages/Markdown.tsx
Comment thread packages/vscode-ide-companion/NOTICES.txt Outdated
Comment thread packages/sdk-typescript/src/daemon/ui/transcript.ts
Comment thread packages/vscode-ide-companion/src/webview/providers/WebViewProvider.ts Outdated
Comment thread integration-tests/chat-transcript-contract.test.ts Outdated
Comment thread packages/cli/src/ui/utils/export/export-transcript-document.ts Outdated
Close the latest review findings across transcript identity, VS Code
rehydration, and the HTML export security boundary.

- Terminate discrete ACP segments and bind automatic turn provenance
- Reset VS Code transcript scopes across replay and reconnect lifecycles
- Align Markdown sanitization and envelope budgets with document rendering
- Run browser gates with Chromium and complete third-party notices
heyang.why added 5 commits August 24, 2026 15:08
Close the latest review findings around document resource safety and
recorded-user replay consistency.

- Redact local home paths structurally without corrupting remote URLs
- Sanitize nested Markdown images inside otherwise safe links
- Advance merged segment provenance without duplicating separators
- Keep recorded-user stable IDs anchored to durable record identity
…plit-20260818

# Conflicts:
#	packages/cli/src/acp-integration/session/Session.ts
#	packages/web-shell/client/components/MessageList.tsx
#	packages/web-shell/client/components/WebShellTranscript.tsx
#	packages/web-shell/client/components/messages/ToolGroup.test.tsx
#	packages/web-shell/client/components/messages/ToolGroup.tsx
Keep MR2A focused on the document export pipeline while preserving the legacy VS Code timeline.

- Retain VS Code /export html as a real document consumer
- Move live transcript adapters, identity wiring, and feature flag to MR2B
- Remove the direct Web Shell dependency and restore baseline notices
- Keep candidate identity evidence in integration-only helpers
- Document the MR1, MR2A, and MR2B delivery boundaries
@yiliang114

Copy link
Copy Markdown
Collaborator

@qwen-code /resolve

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

Qwen Code attempted to resolve merge conflicts but the run did not complete successfully.

Check the workflow run for full logs.

@yiliang114

Copy link
Copy Markdown
Collaborator

#9811 now owns the complete VS Code WebShell cutover and has been synchronized with current main. The VS Code adapter, companion UI wiring, and VS Code-specific notice changes in this PR are therefore superseded and should be removed here.

The reusable boundary we still need from this work is the stable transcript identity plus the document-only HTML export path. #9812 can retire @qwen-code/webui once that focused export slice is available.

The current head is still conflicting with main and has unresolved Critical findings in the export sanitizer, so #9812 cannot safely take it as a prerequisite yet. I am keeping the retirement PR draft and will not duplicate a partial exporter there. The shortest path forward is to narrow this PR to the identity/export slice, resolve the current export findings, and sync it with main; then #9812 can consume it and remain a deletion-focused change.

yiliang114 added a commit to water-in-stone/qwen-code that referenced this pull request Aug 24, 2026
…o main

Resolves conflicts between PR QwenLM#9641 (water-in-stone: WebShell transcript
identity, VS Code adapter, and HTML export) and main (QwenLM#9719 already merged).

Strategy: main (QwenLM#9719) is authoritative for the adapter plumbing; preserve
QwenLM#9641's identity projection and HTML export (renderMode/documentMode) while
dropping the duplicate adapter implementation.

Also fixes merge remnants: orphaned data-web-shell-transcript flag, duplicate
onTranscriptUpdate declaration, stale useAcpTranscript.test.tsx rename, and
duplicate @qwen-code/web-shell dependency.
@yiliang114

Copy link
Copy Markdown
Collaborator

Resolved the merge conflicts between this PR and #9719 (WebShell transcript UI, already merged to main).

Strategy — kept main as the baseline:

  • The ACP transcript adapter from feat(vscode-ide-companion): adopt WebShell transcript as the default timeline #9719 already landed, so this PR's duplicate adapter plumbing (useAcpTranscript, acpTranscriptAdapter, forwarding in WebViewProvider/SessionMessageHandler/qwenAgentManager, plus data-web-shell-transcript/experimental.webShellTranscript flags) was dropped in favor of main.
  • Preserved this PR's unique work: transcript identity (TranscriptUpdateIdentityProjector, promptIdContext) and HTML export (renderMode/documentMode in WebShellTranscript + ToolGroup).

Result — force-pushed onto this branch as a fast-forward merge commit (79cb05ea82ee, parents d66a44f3 + main):

  • 98 files changed, +9564 / −1703
  • mergeable: true — conflicts resolved

Note: mergeable_state is still blocked by the CHANGES_REQUESTED review; those review threads still need to be addressed separately.

Verification: web-shell 4269 tests passed, vscode-ide-companion 607 passed, typecheck clean (one pre-existing #9796 sdk-dist error, unrelated to this merge).

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

Qwen Code attempted to resolve merge conflicts but the run did not complete successfully.

Check the workflow run for full logs.

@yiliang114 yiliang114 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 at dbc3e7b4 (including the main-merge conflict resolution). One blocker inline: credentials embedded in URL userinfo leak into the HTML export verbatim, which breaks the PR's own one-way-boundary guarantee. Four non-blocking follow-ups are inline as well.

What I checked and found clean: untrusted content only enters the export through the JSON script envelope (escapeJsonForHtmlScriptData handles </script>/U+2028), the document CSP is default-src 'none' with only nonce'd scripts and data: images, Mermaid runs securityLevel: 'strict' with budgets in document mode, and sessionId is a forbidden envelope field with a final re-assert pass. The rendering surface itself looks sound — the leak below is on the redaction side.

Comment thread packages/cli/src/ui/utils/export/export-transcript-document.ts
Comment thread packages/sdk-typescript/src/daemon/ui/transcript.ts
Comment thread packages/cli/src/ui/utils/export/formatters/html.ts
Comment thread packages/acp-bridge/src/transcript-replay.ts
Comment thread packages/cli/src/ui/utils/export/export-transcript-document.ts
@yiliang114

Copy link
Copy Markdown
Collaborator

The current head is blocked before the new export tests run:

  • Qwen Code CI and the web-shell visual/smoke jobs fail during npm ci / prepare at packages/web-shell/client/App.tsx:8082: MODES_CYCLE.indexOf(currentMode) receives a string, while indexOf expects the approval-mode union. A comparison callback such as findIndex((mode) => mode === currentMode) avoids the widening issue.
  • The workflow-size gate also fails: .github/workflows/ci.yml is 74,256 bytes against the recorded 69,782-byte baseline, which is 4,474 bytes over baseline and 378 bytes beyond the allowance. This PR's 9-line workflow addition tips it over; moving the browser-gate command into a script would keep the workflow below the limit, or the baseline needs an explicit justified update.

These are separate from the remaining export-sanitization Critical. Fixing them should remove the current CI cascade and expose any actual document-export test failures.

@yiliang114

Copy link
Copy Markdown
Collaborator

Commit bff4e63a7c76 closes the remaining blockers on the current head:

  • strips URL userinfo from plain, inline-code, fenced-code, and command text before it enters the portable document, with builder and validator regressions;
  • fixes the Web Shell approval-mode type error that stopped npm ci during the package build;
  • records the justified ci.yml size increase for the dual Playwright install plus document browser gate.

Focused verification: export document tests 31/31 passed, Web Shell library TypeScript check passed, Prettier/ESLint pre-commit passed, and ci.yml is 74,256 bytes against the new 74,256-byte ratchet baseline. CI is running on the new head.

yiliang114
yiliang114 previously approved these changes Aug 24, 2026

@yiliang114 yiliang114 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.

The URL-credential export blocker is fixed in bff4e63. The focused export suite passes 31/31, the Web Shell library typecheck passes, and all review threads are resolved. CI is still running as the remaining merge gate.

@yiliang114

Copy link
Copy Markdown
Collaborator

Fixed the Ubuntu CI failure in 893f172. The Web Shell smoke job intentionally installs Chromium for both Playwright copies; the workflow contract test still expected the old single npx playwright command. It now checks the hosted and self-hosted command blocks separately, including the self-hosted no---with-deps rule.

Focused result: 9 passed, 1 platform-specific test skipped.

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Qwen Code review timed out. Qwen review timed out after 21600 seconds (of the 360-minute budget). This run already used the maximum 360 minute timeout. See workflow logs.

@yiliang114

Copy link
Copy Markdown
Collaborator

@qwen-code /resolve

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

Qwen Code attempted to resolve merge conflicts but the run did not complete successfully.

Check the workflow run for full logs.

heyang.why added 2 commits August 25, 2026 18:46
# Conflicts:
#	packages/web-shell/client/components/messages/ToolGroup.tsx
…/backup-feat-web-shell-adapter-before-split-20260818
@water-in-stone
water-in-stone force-pushed the codex/backup-feat-web-shell-adapter-before-split-20260818 branch from 893f172 to 3d87d7a Compare August 25, 2026 11:41
@github-actions

Copy link
Copy Markdown
Contributor

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)为单个提交。

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Qwen Code review did not complete successfully. The review pipeline failed before a review could be posted. A transient error is retried automatically; if you are seeing this, retry with @qwen-code /review. See workflow logs.

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

Labels

need-discussion review/self-reported The linked issue was opened by the PR author (self-reported)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevalidate a shared chat transcript contract across hosts

6 participants