Skip to content

feat: Add desktop HTML page annotations - #202

Draft
LIUXIN557 wants to merge 36 commits into
masterfrom
codex/html-page-annotations
Draft

LIUXIN557 wants to merge 36 commits into
masterfrom
codex/html-page-annotations

Conversation

@LIUXIN557

@LIUXIN557 LIUXIN557 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implement approved Windows/macOS desktop HTML page annotations through OpenSpec change add-html-page-annotations.

Product/test integration at 39cd01db: trusted popup and retained pins/previews, multiple targets/one region, receipt-only batch reconciliation with leased first admission, navigation/default-stay protection, exact-target invalidation, UI-owned request deadlines/cancellation, and native full-page scrollbar-layout preservation. Frozen capture validation survives ordinary reads/next-draft commands; cancellation/deadline actively retires owned capture styles without awaiting a lost screenshot callback. Higher-seam tests now exercise the actual lease-release lifecycle. The Linux HTTP assertion classifies typed internal request-context records separately from real user admissions.

Final evidence-only documentation commit: 51358370; product/test sources are identical to verified 39cd01db.

Closes #193
Closes #194
Closes #195
Closes #196
Closes #197
Closes #198
Closes #199
Closes #200
Closes #201

Validation

  • At unchanged 39cd01db, full pnpm test, production build and regex compatibility checks passed. Directly rebuilt TEMP native driver plus the dedicated Chromium interaction/controller/native-session/HTTP/receiver-queue integration passed; exact-DOM/shadow lifecycle smoke passed.
  • Standards and Spec reviews re-pinned to 0155a863...51358370 report no open code findings; prior retry/text, explicit-read race, active capture cleanup and integration lease-adapter findings are closed within documented test boundaries. Reviewers independently rebuilt the 63-test native composition suite and exercised the combined integration fix. Platform acceptance and the unresolved cascade contract remain separate.
  • All four strict gates (dependency layers, source size, ownership/final and documentation paths), OpenSpec strict and diff checks passed at 51358370, without baseline increases. Documentation-path validation initially identified one quoted prose token mistaken for a tracked path; the final documentation-only commit corrects the wording. No baseline waiver was introduced.
  • At unchanged, clean 39cd01db, Windows desktop/unit/smoke rebuilding passed with valid native dependency records; 107 focused native tests and 107 CTest cases passed, including freshly linked receipt HTTP and payload classification regressions. Actual visible integrated WebView2 smoke passed, checking below-viewport green pixels and unchanged root layout, viewport, scroll and author styles, plus stale-document/resource rejection and retry. Earlier reliable 4b0c00c4 rebuilding also passed. Its hidden-launch attempt failed the active-visible harness check; the visible rerun passed. Neither smoke replaces the complete annotation manual workflow.
  • An old generated MSVC showIncludes prefix was mojibake; Ninja recorded zero project-header dependencies and reused stale ABI objects. Only ignored local compiler-cache files were corrected. All 1674 old zero-dependency objects were invalidated and reliably recompiled; routes_ws now records 747 valid dependencies. Earlier incremental native passes are not proof that all changed headers were compiled.
  • Supplemental independent WebView2 smoke passed normal/stable/both-edges/thin/horizontal variants: 845x2400 PNG includes bottom green with viewport, scroll, root layout, original inline styles and author stylesheet membership preserved. Unsupported author-important cascade fails explicitly with preserved state. All 104 refactoring/tooling tests passed at 4b0c00c4; no tooling implementation changes were added afterward.
  • The previous native unit binary completed 7119 tests: 7088 passed, 20 skipped, 11 failed, and 1 disabled. Failures span pointer hit-testing, TCP reachability, hook timing, skill seed, PowerShell encoding and turn-interrupt tests. Baseline reproduction has not been established; no full-suite success is claimed.
  • Linux CI run 44369114282 passed 7057 of 7058 executed tests, with one annotation receipt-test failure: typed internal execution context was counted as another user admission. The integrated test-only fix preserves exactly-one/body/metadata/receipt/conflict assertions, seeds context deterministically, and uses established serialization/classification. Independent replay, duplicate/missing-metadata mutation checks and receiver tests passed; a fresh Linux CI pass is not yet claimed. Other jobs in that run passed.
  • Fresh PR CI at 51358370 is queued: run 44381864976. A duplicate manual dispatch was cancelled after the automatic PR run appeared; no fresh remote result is claimed.
  • A worker's earlier concurrent full frontend run failed readiness while standalone and coordinator fixed-HEAD runs passed. This historical failure is retained, not attributed to a proven baseline or waived by weakening assertions.

Remaining Work / Known Findings

  • Obtain a passing fresh Linux CI run after the receipt-test classification correction. No viewport fallback or relaxed capture validation.
  • Clarify explicit failure semantics when existing important declarations prevent an independent preview stylesheet from taking effect; do not modify original inline declarations or silently change supported platforms.
  • Real Windows complete desktop workflow and macOS build/native/manual acceptance have not passed. Keep this PR draft until both required platform workflows and remaining gates pass.

OpenSpec tasks 5.1 (Windows native full-page capture), 8.1 (automated integration) and 8.2 (dual-axis code review) are complete within those explicit boundaries. Tasks 2.1 (cascade contract/all-field acceptance), 5.2 (macOS capture), 8.3 (Windows full manual workflow) and 8.4 (macOS build/manual workflow) remain open. Worktrees are retained while acceptance is incomplete.

Acceptance evidence and unexecuted cases: docs/desktop-shell/html-page-annotations-acceptance.md.

Trae User added 28 commits November 18, 2026 23:13
Execution request-context records use the user role with is_meta set. Reuse the existing real-user predicate after protocol deserialization, retain exact admission and identity assertions, and seed context coverage on every platform.
…otations

# Conflicts:
#	web/scripts/i18n-en-overrides.mjs
#	web/src/i18n/sourceCatalog.generated.js
#	web/src/lib/api.js
Trae User added 7 commits November 22, 2026 00:01
- openspec/changes/redesign-html-page-annotations: 新变更包(proposal/design/tasks/tickets/spec)
- docs/specs: PRD、需求基线、技术设计、WIP 定性、验证方案、旧分支映射
- docs/agents/issue-tracker.md: GitHub 工单配置
- 旧 change add-html-page-annotations 四份文档标注 Superseded
旧路线收尾打磨,未按新方案对齐。逐文件定性见
docs/specs/2026-11-22-html-page-annotations-wip-alignment.md(保留 19 / 改造 24 / 废弃 8)。
记录标识与文档解耦:现行 <document_id>:annotation:<n> 在刷新后结构性失效
(document_id 内含 epoch,替换时清空且 runtime 销毁),成功率 0/10 而非概率问题;
另发现 targets[].locator 只有 tag#id,撑不起重放定位。

捕获耗时实测(无头 Edge,页面侧裁剪):做了 scale=1/dpr 时最大档 P95 37ms,
不做则 DPR2 下 P95 238ms 越线 —— scale 修正是硬要求。因此保存走异步补图。

- 新增 2026-11-22-html-page-annotations-t0-findings.md
- 技术设计:D9(记录标识)、D10(异步补图)、§4.8 流程图、新增 §4.12
记录归属会话,页签只是渲染/编辑端点(Q33)。PageAnnotationSession 不再持有
records_/next_number_,改为转发 SessionAnnotationStore。

标识与文档解耦(#208/D9):<page_id>:annotation:<n>,document_id 降为记录属性。
编号按 page_id 分组连续,仍与旧实现等价;discard 只清本页签并归 1。

行为零变化:49 条既有批注测试全绿;新增 5 条 store 契约测试。
host 层按 owner.session_id 共享 store 留给 #211。
Move pending annotation records to the session store so they outlive their page tab, capture screenshots at save time, and send annotations through the normal composer submission path. Remove the batch/reconcile protocol, native send leases, and the old integration driver.

Add pending and read-only sent cards, both edit paths, poll retry with backoff, and Enter/Shift+Enter/Ctrl+Enter semantics in the popup. Refresh the annotation tests and OpenSpec task record.
CI layer-lint failed R12: agent_browser_host.cpp (2856/2832) and
agent_browser_host_mac.mm (3240/3157) grew past the non-increasing
baseline. Extract instead of raising limits:

- move the duplicated set_bounds validation into agent_browser_common
- move the macOS synthetic input JS builders and CG mouse mapping into
  agent_browser_macos_helpers
- add SessionAnnotationStoreRegistry so both hosts stop carrying the
  same per-session store map

Both files are back under their baseline (2824 and 3129). The acceptance
doc no longer points at the deleted integration driver and its retired
batch/lease section, which also failed the documentation-path check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment