Skip to content

feat(web): annotate PDF regions in the file sidebar - #13874

Closed
oedd wants to merge 6 commits into
pingdotgg:mainfrom
oedd:feat/pdf-region-annotations
Closed

oedd wants to merge 6 commits into
pingdotgg:mainfrom
oedd:feat/pdf-region-annotations

Conversation

@oedd

@oedd oedd commented Sep 26, 2026 •

Copy link
Copy Markdown

Researchers and students reviewing papers or compiled LaTeX drafts need to point at a figure, equation, or paragraph and ask an agent about it. Existing PDF previews leave them taking screenshots manually to collect several comments.

PDFs now open in a PDF.js reader in the right sidebar, beside the conversation. Drag an area to open a nearby annotation popup, write a comment, and choose Attach or press Enter. Delete or Escape discards the selection. Repeat across pages or documents to collect screenshots, comments, document references, and page numbers in one prompt. PDF links in messages and unsent PDF attachments use the same sidebar. Removing a note removes its paired image; the source PDF is unchanged.

The reader keeps a snapshot of the loaded document. Agent commands, workspace revisions, and renewed asset URLs no longer remount it or discard an open comment. Actual content changes offer Load new version; accepting replaces the snapshot and resets the open selection/comment. Page navigation and captures use the loaded bytes until then. Long note titles and comments stay within their cards, with full titles available in a tooltip.

Proposal and scope discussion: #13873. This draft is an implementation reference for that discussion.

  • Reuses existing composer context, image upload, attachment limits, and send behavior. No server or provider contract changes.
  • One rendered page at a time, bounded canvas resolution, local fonts/CMaps/decoders, navigation, zoom, password entry, and cancellation on page changes/unmount.
  • Workspace events and a 15-second check detect file updates, including edits outside the workspace. Response validators avoid unnecessary downloads; downloaded bytes determine whether to offer a reload. Background failures preserve the current reader.
  • Uses the draft workspace asset resource before the first message is sent. Applies to web and desktop file panels and attachment previews. Mobile and PDFs opened explicitly in the integrated browser are unchanged.
  • Prototype limits: no text selection/search or continuous scrolling; screenshots count toward the existing eight-attachment limit. Vision support depends on the provider/model. Snapshot loading downloads the full PDF before opening and retains its bytes, so large documents have a memory/loading cost.

Demonstration

The following recordings show the original annotation flow. The snapshot and note-card fixes have automated/build verification; a new visual recording has not been made for these fixes.

Sidebar annotation demo

Before After
Embedded browser PDF preview PDF selection with annotation popup in the sidebar

Two notes beside the composer · Native Electron evidence

Validation

Integrated against upstream main at ea7d46ac. Original desktop recordings use the v0.0.42 prototype.

  • 25 focused tests pass on both the local prototype and integrated branch, covering snapshot retention across agent steps/URL renewals, explicit acceptance of the latest version, unchanged bytes, external edits/reverts, connection failures, reauthorization, initial retry, document switching, missing validators, stale checks, crop geometry, and existing file/attachment behavior.
  • Web typecheck, formatting, and production web builds pass on both branches. Targeted lint reports no errors; the existing file-panel effect-dependency warning remains.
  • Earlier browser and native Electron passes covered Files, draft attachments, PDF message links, region capture, Attach/Enter, delete/Escape, page navigation, zoom, collecting/removing notes, and idle canvas stability. Captures use the local data URL decoder to respect desktop CSP.
  • No live provider turn was sent for validation; screenshot/context pairing is covered at the message-serialization boundary.

Model: GPT-6. Harness: Codex.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Sep 26, 2026
@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Sep 26, 2026
@oedd oedd changed the title feat(web): capture PDF regions as prompt annotations feat(web): annotate PDF regions in the file sidebar Sep 26, 2026

Copy link
Copy Markdown
Member

Note

This comment is posted by Julius' dot

Closing under the prior direction and scope requirement. This replaces the existing PDF preview with a dedicated reader and introduces region annotations collected into prompts, including new snapshot/reload behavior. It is a new document-review workflow, beyond configuration of an established capability. The linked Ideas discussion #13873 currently has no maintainer response approving that direction or scope.

Please obtain explicit scope approval in that discussion, then request reconsideration of an aligned PR. Draft/reference status does not postpone triage. The research/LaTeX use case, working prototype recordings and focused tests remain useful input to that discussion.

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

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants