Skip to content

fix(computer): preserve window coordinates after image resizing - #138271

Merged
steipete merged 1 commit into
mainfrom
codex/computer-window-image-coordinates
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/computer-window-image-coordinates

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Parent #138230 is now merged as 0f429cef53d8d1dfbe5358b962f56c70c6db8153. Exact candidate d8cd4e5734060f7c74c8ebaf066a5386ab3b14a7 passed CI after three runner-allocation cancellations were retried; no tests ran in those canceled jobs. Native proof now passes on the signed d8cd4e57 candidate. The branch was mechanically refreshed to 82d157163328c5f028550a5b4b4f898a7365d3b7 on 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

  • Actual source-tool → provider registration → CUA owner → sanitizer composition reproduces the wrong point before the patch and the correct point after it. Native input is inert in this diagnostic; it is not called live desktop proof.
  • The composition matrix covers 19 geometry/unit cases, five desktop geometries, missing-image behavior, and three deterministic cleanup/provider-generation races. Native/CSS/opaque units remain unscaled; stale and closed observations cannot dispatch input.
  • 207 focused cases across computer tool, projection, guidance, paired-node lifecycle, parser, CUA actions, and worker observation persistence passed on refreshed 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.
  • Full changed-file gate passed. Final independent Codex review found no actionable P0–P2 defects in the complete 13-file diff. The broader type gate caught and prompted the readonly point-pair tuple and worker test return-shape updates. The normally signed native Mac build was installed and tested without changing its node identity or Accessibility/Screen Recording permissions. The refreshed exact-head CI passed, and the full changed-file gate and final independent review passed again after refreshing main.

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.

Delivered image before input Fresh image after input
Synthetic window before the row-seven coordinate click Marker inserted on row seven after the native coordinate click

The click itself reports unverifiable; the independent insertion/readback and images establish its effect. The insertion reports confirmed via accessibility and 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 82d15716 passed 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.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling plugin: cua-computer size: M maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 9:09 AM ET / 13:09 UTC.

ClawSweeper review

What this changes

This 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
Reviewed head: d8cd4e5734060f7c74c8ebaf066a5386ab3b14a7

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The code and focused matrix are coherent, but exact native CUA behavior, its pinned-driver contract, and exact-head CI remain unproven.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; however, the PR body explicitly says native after-fix proof remains pending, and its inert composition trace does not prove the final CUA input effect.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; however, the PR body explicitly says native after-fix proof remains pending, and its inert composition trace does not prove the final CUA input effect.
Evidence reviewed 7 items Current-main projection behavior: Current main attaches a provider window image and sanitizes it, while the model-visible result retains provider metadata; it has no delivered-image geometry bound to the observation.
Current-main dispatch behavior: Current main forwards a copy of the action parameters to computer.act without transforming window coordinates.
Introduced repair: The PR computes scale from the delivered image dimensions only when the provider declares image-pixel coordinates, then binds that scale to the observation.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

  • Resolve merge risk (P1) - Native CUA input has not yet demonstrated that an oversized observed window click lands at the shown target on this exact head; the supplied composition evidence intentionally keeps native input inert.
  • Resolve merge risk (P1) - The direct @trycua/cua-driver 0.22.0 coordinate contract could not be inspected in this environment, so native proof must establish the final provider boundary.
  • Resolve merge risk (P1) - This is stacked on still-open fix(computer): derive local wait from screenshot support #138230; neither its base nor this PR is on current main.
  • Resolve merge risk (P1) - The repair adds net 46 runtime lines for observation-bound geometry and dispatch transformation; the source layout is coherent, but the added path warrants native confirmation before acceptance.
  • Complete next step (P2) - After the parent PR lands, provide redacted native after-fix CUA window-coordinate proof and successful exact-head CI before merge.
Agent review details

Security

None.

PR surface

Source +46, Tests +79, Docs +2. Total +127 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 6 123 77 +46
Tests 6 133 54 +79
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 258 131 +127

Review metrics

Metric Value Why it matters
Runtime versus test delta runtime +123/-77 (net +46); docs +2; tests +133/-54 (net +79) The runtime growth carries delivered-image geometry through the existing observation boundary; its native provider behavior remains the key pre-merge check.

Merge-risk options

Maintainer options:

  1. Prove the native coordinate round trip (recommended)
    After the parent lands, run the exact head against CUA with a resized window observation and show that a point chosen from the delivered image changes the intended target window.
  2. Keep the stack pending
    Do not merge this child until its parent is integrated, then refresh it and let exact-head CI validate the merged stack.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This repairs an experimental but bounded computer-use pointer-targeting path.
  • add merge-risk: 🚨 other: A wrong image-to-provider coordinate transform could make a real CUA action target the wrong location, and native after-fix evidence is still pending.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; however, the PR body explicitly says native after-fix proof remains pending, and its inert composition trace does not prove the final CUA input effect.

Label justifications:

  • P2: This repairs an experimental but bounded computer-use pointer-targeting path.
  • merge-risk: 🚨 other: A wrong image-to-provider coordinate transform could make a real CUA action target the wrong location, and native after-fix evidence is still pending.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor proof gate does not apply; however, the PR body explicitly says native after-fix proof remains pending, and its inert composition trace does not prove the final CUA input effect.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted native CUA proof that a point chosen in a resized delivered window image reaches the intended target.
  • After the parent PR lands, refresh the stack and obtain successful exact-head CI.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Base automatically changed from codex/computer-local-wait-click-cleanup to main September 4, 2026 13:26
@steipete
steipete force-pushed the codex/computer-window-image-coordinates branch from d8cd4e5 to 82d1571 Compare September 4, 2026 13:51
@steipete
steipete merged commit 8ab5e3d into main Sep 4, 2026
197 checks passed
@steipete
steipete deleted the codex/computer-window-image-coordinates branch September 4, 2026 14:18
vincentkoc added a commit that referenced this pull request Sep 4, 2026
…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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. plugin: cua-computer rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant