Repository navigation
feat: Add desktop HTML page annotations - #202
Merged
Merged
Conversation
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
added 8 commits
November 22, 2026 00:01
…odex/html-page-annotations
- 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
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.
…otations # Conflicts: # web/src/i18n/sourceCatalog.generated.js
LIUXIN557
marked this pull request as ready for review
November 24, 2026 08:07
Owner
审核结论:暂不合入基于 这次做了什么、没做什么
一、合入前必须解决1.
|
The generated i18n source catalog conflicted and was regenerated from the merged sources.
Trust boundary - Expanded annotation prompt: quote the annotated element's page text line by line and collapse line breaks in page-controlled single-line fields (title, URL, element, style values). A page could otherwise write its own "Annotation 2 / Description: ..." lines and pass them off as another user annotation. - Auto review transcript: a message carrying page annotations now contributes only what the user typed plus the annotation descriptions. It was dropped entirely before (unknown boolean flag), and simply allowing the flag would have fallen back to the expanded content, page text included, whenever the user typed nothing. Sending and deleting - A second trigger while an annotation send is still uploading or awaiting its receipt no longer assembles and queues the same annotations again. - Annotations prepared for one session are not submitted into another when the user switches during the upload, and only the draft captured before the upload is cleared afterwards. - Deleting a pending annotation still takes effect immediately, but the undo affordance now expires after five seconds instead of pinning an empty card above the composer; the deferred native removal is committed when the window ends, on the next delete, on unmount, and when a send succeeds (it was silently dropped there, so the record came back after a reload). Screenshots - The capture that follows a save no longer depends on an object that changes identity on every render; any re-render used to cancel it and the record never got its images. - The page shot is released once a page has no pending records left, so it stops riding along with every page state event. - A rejected screenshot request is answered once, not twice. Docs describe the current behaviour and the rules above.
With annotations pending, a built-in command (/compact, /model, /btw ...) or a fork send first uploaded the page shots and then failed with "annotations were not sent"; the command itself never ran, so the user had to send or delete every annotation before a command would work. Route the input first: anything that is not an ordinary message, and every fork send, goes through the normal path and leaves the annotations pending.
The macOS poll block captured its shared_ptr parameter by reference, so it only held a reference to the poller's own member. A block that came due after stop() or destruction dereferenced a cleared or freed pointer (reachable while the desktop shell shuts down). Take the pointer by value so the block owns a copy and stops rescheduling once the poller is inactive. Also rename FullPageCapture::verify: AssertMacros.h on macOS defines a function-like verify macro, and the header only compiles there today because it happens to be included before any Apple header. Neither change could be compiled on macOS here; both are covered by the Windows build and the capture tests.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 verified39cd01db.Closes #193
Closes #194
Closes #195
Closes #196
Closes #197
Closes #198
Closes #199
Closes #200
Closes #201
Validation
39cd01db, fullpnpm 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.0155a863...51358370report 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.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.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 reliable4b0c00c4rebuilding also passed. Its hidden-launch attempt failed the active-visible harness check; the visible rerun passed. Neither smoke replaces the complete annotation manual workflow.routes_wsnow records 747 valid dependencies. Earlier incremental native passes are not proof that all changed headers were compiled.4b0c00c4; no tooling implementation changes were added afterward.44369114282passed 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.51358370is queued: run 44381864976. A duplicate manual dispatch was cancelled after the automatic PR run appeared; no fresh remote result is claimed.Remaining Work / Known Findings
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.