Repository navigation
feat(ui): comment on file, diff, and PDF selections in chat - #180294
roboclaw-bot wants to merge 10 commits into
Conversation
Worked on by: - @jjjhenriksen Co-authored-by: jjjhenriksen <[email protected]> OpenClaw-Publication: fcf1ab3f-a8af-4032-9eaa-58cb1b182fd0
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Co-authored-by: jjjhenriksen <[email protected]>
|
Codex review: needs changes before merge. What this changesAdds editable chat comments to selected file text and Review diffs, including file paths, line ranges, and revision sides. Example: Select
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it adds a useful Files/Review workflow through existing comment owners, and no definite introduced bug was found; the draft remains conflicted. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherFiles and Review provide selected text and coordinates to the shared comment editor; the existing composer admits, stores, edits, and sends the resulting attachment. flowchart LR
A[File source reader] --> C[Selection coordinates]
B[Review diff] --> C
C --> D[Shared comment editor]
D --> E[Composer attachments]
E --> F[Existing chat send path]
Technical reviewBest possible solution: Keep source-coordinate extraction in the readers and continue using the existing comment editor, attachment storage, and composer delivery owners. Do we have a high-confidence way to reproduce the issue? This is a feature addition; current-main source and the inspected baseline screenshot independently establish the missing file-selection action. Is this the best way to solve the issue? The implementation uses the existing owners and adds only the coordinate extraction, lifecycle checks, and optional annotation metadata needed for the requested workflow. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 433146c1bdf4. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +373, Tests +278, Docs +7. Total +658 across 21 files. Added test files: 3. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 22, 2026, 12:41 AM ET / 04:41 UTC. |
Worked on by: - @jjjhenriksen Co-authored-by: jjjhenriksen <[email protected]> OpenClaw-Publication: 20b73957-5952-4188-9b2e-4ac96b55539a
vyctorbrzezowski
left a comment
There was a problem hiding this comment.
Found 1 actionable issue(s) in the reviewed diff; details are attached to the relevant code.
Automated code review complete. Final product and design review will be handled by the responsible maintainer before the PR is considered for merge.
| word-spacing: normal; | ||
| text-size-adjust: none; | ||
| forced-color-adjust: none; | ||
| transform-origin: 0 0; |
There was a problem hiding this comment.
[P2] Apply PDF.js page rotation to the text layer
For a PDF page whose /Rotate entry is 90, 180, or 270, the canvas honors the page rotation through getViewport(), but the selectable text does not. PDF.js 6.4.299 builds TextLayer in the unrotated page coordinate system and sets data-main-rotation on its container; its viewer stylesheet supplies the matching rotate/translate transforms. This stylesheet copies the text-layer geometry rules without those transforms, and the component does not apply them elsewhere. Consequently the invisible selection targets and comment highlight are displaced from the visible text (and can be clipped on quarter-turn pages), so dragging over the displayed passage cannot reliably select it for a comment. Add the scoped data-main-rotation transforms from the pinned PDF.js contract, and cover a page with an intrinsic rotation. The matching transforms are in the pinned PDF.js viewer stylesheet.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
vyctorbrzezowski
left a comment
There was a problem hiding this comment.
Reviewed the base integration at 20ac2fa8aa4a. The previously reported issue still applies; no additional issue was found in the integration.
Automated code review complete. Final product and design review will be handled by the responsible maintainer before the PR is considered for merge.
Co-authored-by: jjjhenriksen <[email protected]>
…hers push (#187465) ## What Problem This Solves Fixes: after anyone else pushes to a PR that an agent session published through the managed publisher (for example `roboclaw-bot`), that session can never update the PR again. Publishing correctly refuses to overwrite the other commits (`push_rejected`). But the documented recovery, `prepare_pr`, refused twice: 1. **Author check.** `prepare_pr` only accepts PRs authored by the requester's own linked GitHub account. A PR the session published is authored by the publisher bot, so the session that created the PR was refused like a stranger: "This PR is not authored by a GitHub account linked to you." 2. **Clean-workspace check.** The first `prepare_pr` in a session treats the PR as a fresh import and requires a clean workspace. The publishing session always has its own published commits and usually the unpublished fix it is trying to push. Real case: #180294 on the team Gateway. A maintainer pushed 3 commits to the PR branch. The session's next fix failed with `push_rejected` 3 times over a week, and every `prepare_pr` attempt was refused. The agents then suggested reassigning session ownership, which cannot help (see below). ## Why This Change Was Made `inspectOwnGitHubPullRequest` is the one owner of "may this conversation act on this PR". It now also reads the conversation's latest published record. It admits the PR author when that record names this exact PR URL and the PR author is the publisher account recorded for it. A bot-authored PR from another conversation is still refused. `prepare_pr` then treats the head this conversation last published as the already-prepared head. It uses the existing advanced-head path: save the workspace, merge the newer head, return conflicts. It does not use the first-import path that demands a clean workspace. The next ordinary publication appends to the same PR as a fast-forward. No new action, state or config. Also: - The `push_rejected` next step now tells the agent to call `prepare_pr` for its own PR, not "apply the changes on top of that head" (which no tool could do). - The owner-only `prepare_pr` error now says it means the person who started the conversation. Reassigning the session owner does not transfer this; [multi-user](https://docs.openclaw.ai/concepts/multi-user) documents that reassignment keeps authority with the creator, and any agent turn can reassign. This check is unchanged on purpose; only the wording changed, because "owner" sent agents into an ownership-transfer loop. - Docs and the `prepare_pr` tool description state the new path. ## User Impact A session whose bot-published PR was updated by someone else can recover with `prepare_pr` and then publish to the same PR, keeping its saved work. Previously the only way out was a replacement PR or manual Git work by an operator. ## Evidence - **Production trace:** team Gateway, session for #180294. Publication records show 2 published updates by `roboclaw-bot` (account 309084314) to that PR URL, then 3 `push_rejected` failures. The PR's head moved because of 3 maintainer commits. Each `prepare_pr` call failed, either on the author check or on the creator check after an ownership reassignment. - **Red then green through the agent tool and Gateway** (`src/gateway/github-pr-workspace-refresh.test.ts`, "merges another writer's commits into this session's own bot-published PR"): - The session publishes a PR as the publisher bot. - A maintainer appends a commit to that branch. - The session has an unpublished edit. - `prepare_pr` runs, then publish. - `main`: **failed**, with the production error "This PR is not authored by a GitHub account linked to you…". - This branch: **passed**. The maintainer's file is merged and the unpublished fix is kept. Publish sends one fast-forward push leased on the maintainer's head, to the same PR, and that push contains both. - **Authority is still enforced at both effects** (same file, real `prepare_pr` and publication entry points): - A bot-authored PR this session did not publish is refused; no binding is written. - A revoked requester is refused before the newer head is accepted. The workspace HEAD, files and binding are unchanged, with no GitHub writes. - A requester revoked after a successful `prepare_pr` is refused at publication ("no longer authorized"), with zero pushes; the PR branch stays at the maintainer's head. - Reassigning the session owner still does not grant `prepare_pr`; the creator check is unchanged and covered by the existing adoption suite. - **Also new:** a bot-authored PR this session did not publish is still refused, and an unchanged own PR after the base advanced prepares cleanly (it fetches the newer base and writes the binding). - **Related suites:** 160 tests across preparation, refresh, inspect, existing-PR publication, publication actions, base refresh, imported actions, PR workspace adoption, and the `github_publish` tool all pass. The one failure in the first run was a test asserting the old owner-check wording, now updated. `pnpm test src/gateway/github-pr-workspace-refresh.test.ts --maxWorkers=1`: 16 passed, 71 s wall. GitHub transport is synthetic in these tests (real Gateway, Git, session and publication owners); no live GitHub run. - `pnpm check:changed` passes (format, typecheck, lint, guards) with the dead-export scan skipped; that scan fails on files this PR does not touch, which are already on `main`. No overlap with Pash/Sarah changes. **Merge danger:** two-way door. No schema, config or stored-state change; a revert restores the old refusals. **Blast radius:** `prepare_pr`, `inspect_pr`, and publication to a prepared PR, for sessions with a published PR. If the new check were wrong, a session could merge and push to a PR whose author matches its own recorded publisher account. The URL and account must both match this conversation's own publication record, and the existing publisher write-access and remote-head checks still run before any push. Co-authored-by: Ayaan Zaidi <[email protected]>
…hers push (openclaw#187465) ## What Problem This Solves Fixes: after anyone else pushes to a PR that an agent session published through the managed publisher (for example `roboclaw-bot`), that session can never update the PR again. Publishing correctly refuses to overwrite the other commits (`push_rejected`). But the documented recovery, `prepare_pr`, refused twice: 1. **Author check.** `prepare_pr` only accepts PRs authored by the requester's own linked GitHub account. A PR the session published is authored by the publisher bot, so the session that created the PR was refused like a stranger: "This PR is not authored by a GitHub account linked to you." 2. **Clean-workspace check.** The first `prepare_pr` in a session treats the PR as a fresh import and requires a clean workspace. The publishing session always has its own published commits and usually the unpublished fix it is trying to push. Real case: openclaw#180294 on the team Gateway. A maintainer pushed 3 commits to the PR branch. The session's next fix failed with `push_rejected` 3 times over a week, and every `prepare_pr` attempt was refused. The agents then suggested reassigning session ownership, which cannot help (see below). ## Why This Change Was Made `inspectOwnGitHubPullRequest` is the one owner of "may this conversation act on this PR". It now also reads the conversation's latest published record. It admits the PR author when that record names this exact PR URL and the PR author is the publisher account recorded for it. A bot-authored PR from another conversation is still refused. `prepare_pr` then treats the head this conversation last published as the already-prepared head. It uses the existing advanced-head path: save the workspace, merge the newer head, return conflicts. It does not use the first-import path that demands a clean workspace. The next ordinary publication appends to the same PR as a fast-forward. No new action, state or config. Also: - The `push_rejected` next step now tells the agent to call `prepare_pr` for its own PR, not "apply the changes on top of that head" (which no tool could do). - The owner-only `prepare_pr` error now says it means the person who started the conversation. Reassigning the session owner does not transfer this; [multi-user](https://docs.openclaw.ai/concepts/multi-user) documents that reassignment keeps authority with the creator, and any agent turn can reassign. This check is unchanged on purpose; only the wording changed, because "owner" sent agents into an ownership-transfer loop. - Docs and the `prepare_pr` tool description state the new path. ## User Impact A session whose bot-published PR was updated by someone else can recover with `prepare_pr` and then publish to the same PR, keeping its saved work. Previously the only way out was a replacement PR or manual Git work by an operator. ## Evidence - **Production trace:** team Gateway, session for openclaw#180294. Publication records show 2 published updates by `roboclaw-bot` (account 309084314) to that PR URL, then 3 `push_rejected` failures. The PR's head moved because of 3 maintainer commits. Each `prepare_pr` call failed, either on the author check or on the creator check after an ownership reassignment. - **Red then green through the agent tool and Gateway** (`src/gateway/github-pr-workspace-refresh.test.ts`, "merges another writer's commits into this session's own bot-published PR"): - The session publishes a PR as the publisher bot. - A maintainer appends a commit to that branch. - The session has an unpublished edit. - `prepare_pr` runs, then publish. - `main`: **failed**, with the production error "This PR is not authored by a GitHub account linked to you…". - This branch: **passed**. The maintainer's file is merged and the unpublished fix is kept. Publish sends one fast-forward push leased on the maintainer's head, to the same PR, and that push contains both. - **Authority is still enforced at both effects** (same file, real `prepare_pr` and publication entry points): - A bot-authored PR this session did not publish is refused; no binding is written. - A revoked requester is refused before the newer head is accepted. The workspace HEAD, files and binding are unchanged, with no GitHub writes. - A requester revoked after a successful `prepare_pr` is refused at publication ("no longer authorized"), with zero pushes; the PR branch stays at the maintainer's head. - Reassigning the session owner still does not grant `prepare_pr`; the creator check is unchanged and covered by the existing adoption suite. - **Also new:** a bot-authored PR this session did not publish is still refused, and an unchanged own PR after the base advanced prepares cleanly (it fetches the newer base and writes the binding). - **Related suites:** 160 tests across preparation, refresh, inspect, existing-PR publication, publication actions, base refresh, imported actions, PR workspace adoption, and the `github_publish` tool all pass. The one failure in the first run was a test asserting the old owner-check wording, now updated. `pnpm test src/gateway/github-pr-workspace-refresh.test.ts --maxWorkers=1`: 16 passed, 71 s wall. GitHub transport is synthetic in these tests (real Gateway, Git, session and publication owners); no live GitHub run. - `pnpm check:changed` passes (format, typecheck, lint, guards) with the dead-export scan skipped; that scan fails on files this PR does not touch, which are already on `main`. No overlap with Pash/Sarah changes. **Merge danger:** two-way door. No schema, config or stored-state change; a revert restores the old refusals. **Blast radius:** `prepare_pr`, `inspect_pr`, and publication to a prepared PR, for sessions with a published PR. If the new check were wrong, a session could merge and push to a PR whose author matches its own recorded publisher account. The URL and account must both match this conversation's own publication record, and the existing publisher write-access and remote-head checks still run before any push. Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: jjjhenriksen <[email protected]> Co-authored-by: obviyus <[email protected]> Co-authored-by: shakkernerd <[email protected]> Co-authored-by: jalehman <[email protected]>
Co-authored-by: jjjhenriksen <[email protected]> Co-authored-by: obviyus <[email protected]> Co-authored-by: shakkernerd <[email protected]> Co-authored-by: jalehman <[email protected]>
Worked on by: - @jjjhenriksen - @obviyus - @shakkernerd - @jalehman Co-authored-by: jjjhenriksen <[email protected]> Co-authored-by: obviyus <[email protected]> Co-authored-by: shakkernerd <[email protected]> Co-authored-by: jalehman <[email protected]> OpenClaw-Publication: 34381022-b671-48b7-a4c1-3a374159ad6a
What Problem This Solves
Users cannot attach feedback to selected code or PDF text without manually copying the passage and its location into chat.
User Impact
Select code in Files or Review, or text in a PDF attachment, choose Add to chat, and leave a comment. Sending includes the selected text and its source: file path, line range and diff side for code; document name and page number for PDFs. Saving a comment neither modifies the source nor replaces the existing chat draft.
PDF comments support same-origin attachments up to 16 MiB, one page per comment. Scanned pages need OCR outside this reader. Open original PDF retains access to browser printing, search, forms and password entry. External PDFs and workspace binary-file download paths are unchanged. Selections crossing diff sides or omitted lines need separate comments; formatted Markdown previews are outside this change.
Why This Change Was Made
Reuses the existing comment editor, attachment admission, draft storage and send path. Readers supply coordinates while the current composer owns permission and delivery checks; no separate review store or API is introduced.
The native PDF iframe is replaced by a lazy, single-page PDF.js reader with a selectable text layer. PDF.js 6.4.299 is pinned; worker, fonts and decoding resources are served locally. The existing bounded fetch and byte-revalidation owner remains responsible for downloads, and unchanged ticket renewals retain page and zoom. This does not relax the Gateway CSP or enable PDF scripting/forms.
The requester approved adding PDF support to this same draft. The earlier import conflict with #179908 is resolved, preserving both the file-operation refactor and comment integration. The rotated-page selection repair is now published after a history-preserving reconciliation with the PR's newer commits. GitHub still reports conflicts with current main; this draft is not ready to merge.
Evidence
Rotated PDF — Before
Rotated PDF — After
The repair adds the three pinned PDF.js root-rotation transforms, rather than another geometry owner. Relative to the prior PR head: +13 production CSS lines and net +60 test/fixture lines. The existing send scenario now covers four rotations and obsolete native-iframe capture branches are removed.
PDF — Before
PDF — After
File selection comparison and simplification notes
Before
After
The simplification pass removes the native iframe and its obsolete styles rather than retaining competing PDF renderers. Files, Review and PDF reuse one comment-staging operation. Remaining growth supplies PDF rendering/selection and locally packaged resources. Against selected base a90fc1e: production/build +1018/-59 lines; tests/fixtures +584/-56; docs +9/-2; lockfile +134. The smaller file/diff stage was already published; PDF is the explicitly approved extension of this draft.
Draft hold: the independent Auto Review completed with no P0 findings (P0-only scope; no P1–P3 verdict is claimed). Conflicts with current main remain. PR-head reconciliation completed without file conflicts. Current-main integration is still pending: the refresh action selects the recorded PR base rather than the live target-branch tip, so its already-current result does not establish conflict clearance. Full CI, WebKit and a real-agent/model roundtrip remain unverified. This is not ready to merge.
An earlier file-editor load timeout was followed by passing isolated and combined runs; no fix for that intermittent timeout is claimed. The component harness still emits existing strict-reactivity warnings, so a warning-free runtime is not claimed.
Worked on by
Work sessions