Repository navigation
fix(computer): preserve window coordinates after image resizing - #138271
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 9:09 AM ET / 13:09 UTC. ClawSweeper reviewWhat this changesThis PR maps CUA window pointer coordinates from the resized bitmap delivered to the model back to the provider’s original image-pixel space. Merge readiness⛔ Blocked before merge - 5 items remain Keep open. The patch is a focused, source-supported repair, but it is stacked on an open parent and its own body correctly records that native after-fix proof and exact-head CI are still pending. Priority: P2 Review scores
Verification
How this fits togetherThe computer tool receives a window observation from a paired CUA provider, projects its image for the model, and later dispatches the model’s input back through the same provider. The observation, image geometry, and pointer action must remain bound to one coordinate contract. flowchart LR
A[CUA window observation] --> B[Image sanitization]
B --> C[Delivered bitmap dimensions]
C --> D[Observation-bound scale]
E[Model pointer action] --> F[Computer action dispatcher]
D --> F
F --> G[CUA window input]
H[Provider coordinate contract] --> D
Before merge
Agent review detailsSecurityNone. PR surfaceSource +46, Tests +79, Docs +2. Total +127 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the parent first, then retain the plugin-declared coordinate-space contract and single observation-bound core transform after a redacted native CUA oversized-window observation and click prove the displayed target receives the action. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main sanitizes a CUA window image while forwarding its model coordinates unchanged, so a resized observation produces mismatched units. A native provider run is still required to demonstrate the final effect. Is this the best way to solve the issue? Unclear pending native proof: plugin-owned coordinate declaration plus one generic observation-bound core transform is the cleanest identified boundary, but the pinned driver’s final coordinate behavior was not independently inspectable here. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 51fd752e60ea. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
d8cd4e5 to
82d1571
Compare
…9-prep * commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits) perf(ui): coalesce automation event refreshes (#138065) fix: reject incomplete Skill Workshop directory reads (#138082) test(ui): decouple rendering checks from generated wording (#138283) perf: avoid temporary entries in bounded JSON traversal (#138017) fix(irc): render complete messages before splitting (#138328) perf: prepare worker trajectory payloads only for recorded events (#138086) fix(mcp): paginated listings no longer time out after a forward clock step (#137206) fix(codex): page native transcripts and bound UI previews (#136282) feat(gateway): apply more settings without restarting (#138112) fix(docs): preserve mirrored ClawHub maturity links (#138241) fix(test): own UI animation and legacy database setup (#138296) fix(tts): preserve literal directives in Markdown code (#138319) fix: load chat widgets behind authenticated gateways (#138074) chore(ui): cover native approval finalization (#137259) fix(cron): cancel conditions before main-session handoff (#138313) fix(backup): preserve text after embedded NUL characters (#138327) fix(android): align composer control sheets (#137442) fix(ci): wait for replacement PR runs instead of stale failures (#138307) fix(sessions): keep Gateway responsive with long transcripts (#138094) fix(computer): map window inputs to delivered image coordinates (#138271) ... # Conflicts: # scripts/release-check.ts # test/release-check.test.ts
Parent #138230 is now merged as
0f429cef53d8d1dfbe5358b962f56c70c6db8153. Exact candidated8cd4e5734060f7c74c8ebaf066a5386ab3b14a7passed CI after three runner-allocation cancellations were retried; no tests ran in those canceled jobs. Native proof now passes on the signedd8cd4e57candidate. The branch was mechanically refreshed to82d157163328c5f028550a5b4b4f898a7365d3b7on main; all 13 changed files are byte-identical. Refreshed exact-head CI passed: 110 jobs succeeded, 16 scoped skips, no retries or failures.Problem
Core resized CUA window screenshots before sending them to the model but retained the provider's original dimensions and forwarded model coordinates unchanged. A 1568×784 window delivered as 1200×600 therefore sent a center click at (600, 300) instead of the provider's (784, 392).
Repair
The CUA plugin declares image-pixel coordinates in its existing open metadata. Core's image projection records the actual delivered bitmap dimensions and binds the inverse scale to the existing observation, node, and provider generation. The final action dispatcher maps click, drag, and zoom-request point pairs once. Omitted images reject pixel input while retaining element references. Provider-native accessibility bounds, logical points, CSS coordinates, and arbitrary plugin metadata remain unchanged.
Desktop and window images now share one projection path. This removes duplicate sanitization/assembly and guessed desktop dimensions; valid screenshots with missing optional provider dimensions report their actual delivered size. Existing image caps, model-vision gating, outbound-media suppression, execution serialization, and cleanup authority remain intact. No new configuration, environment variable, database, protocol version, dependency, provider-specific core branch, or compatibility path.
Evidence
82d15716, repeated after its frozen dependency install (six normal Vitest shards, 24.80s). Screen, window, and browser worker transcripts retain pixels only in image content and preserve the original provider result.Production: 123 added, 77 removed (net +46). Tests: net +79 after consolidating the worker test's two projection branches. The production growth records delivered-image geometry at its sole owner and carries it through the existing observation boundary; guessing provider units or removing image limits would reintroduce wrong-target input. The surrounding wait/click and observer cleanups remove 34 production lines separately.
Actual native Mac proof
The real source computer tool, default paired-node Gateway route, and signed native CUA app observed a synthetic TextEdit window of 586×476 pixels. The existing image limit was set to 400 for this tool instance only; the delivered image and reported dimensions were 400×325. A point selected visually at
(130, 132)on row seven drove one native window click. One exact-element accessibility insertion then marked that caret. A fresh native observation confirmed the marker occurred once on row seven with every other character unchanged; WebVNC independently showed the same result. No transport injection, manufactured coordinate metadata, native VNC client, saved configuration change, or foreground escalation was used.The click itself reports
unverifiable; the independent insertion/readback and images establish its effect. The insertion reportsconfirmedviaaccessibilityand uses AXSelectedText at the existing caret, with no pixel retarget or field replacement. Before/after image SHA-256:cf73af0874fe02171903a933e9c6f7f160a8e1ddc79b4a949aca87decdc2f2f2/35c6db02ec06ced28a26b8c2827e3ca89b0d25ad490429a44050a77b96096d9b. Cleanup was awaited and returned; paired-node cleanup is internally best effort, not a physical-close attestation.The initial proof attempt correctly refused untargeted background typing because two TextEdit windows shared one process (
same_pid_keyboard_ambiguity). That failed run is retained. The successful run used the exact text element from its fresh observation; no production safety gate was changed or bypassed. This is native Mac/default-paired proof, not a claim that a deployed cloud worker or Windows/Linux native app was upgraded to this revision.A final native capture stress check on refreshed
82d15716passed all 30 observations in 23.45 seconds: ten screenshots, ten waits, and ten window captures, including two concurrent three-call batches. Serial calls had a 616 ms median and 1.03 s maximum; the slowest queued concurrent call took 1.95 s. Every delivered image matched its dimensions and cap, the fixture/configuration/provider generation stayed unchanged, cleanup returned, and the retained tool rejected further use through its local closed-execution guard. WebVNC remained connected afterward. This is capture/serialization/local-closure evidence, not an assertion of physical teardown or native input throughput.Pinned driver contract
Directly inspected upstream CUA
ac9b1643acb61e20d5af078215e7d1b8c414db89(driver 0.22.0), rather than inferring native units from the OpenClaw wrapper. On macOS, window capture stores the native-to-delivered ratio, and click dispatch consumes that ratio before backing-scale/window-origin conversion. The Linux and Windows click paths use the same delivered-driver-pixel contract. Core must undo only its own additional resize.Latest ClawSweeper rank-up moves are addressed: parent #138230 landed; the stack was refreshed with byte-identical repair files; exact-head CI is green; the native resized-coordinate proof and pinned driver source contract are retained above. The 46-line runtime increase carries the missing observation-bound inverse geometry through one existing dispatch owner; the shared projection refactor removes the duplicated image path.
Scope limits
This fixes tool-to-provider image coordinates, not upstream native crop correctness. Pinned CUA 0.22.0 has separate macOS/Linux zoom resize handling and cross-window/nested zoom limitations; Windows already applies part of that conversion. Browser CSS/image metadata projection is also a named follow-up. The zoom-request tests do not claim those native behaviors are repaired. Historical unexplained WebVNC 1006 closure remains separate from this change.
Release-note context: clicks on resized CUA window observations now target the shown position, and screenshot dimensions describe the image actually delivered to the model.