Skip to content

fix(computer): avoid extra observation turns after window actions - #146822

Merged
vincentkoc merged 1 commit into
mainfrom
perf/cua-targeted-observation-20260913
Sep 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/cua-targeted-observation-20260913

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an extra observation turn after targeted window input: the action returns a desktop screenshot, while the next window action needs fresh window observation IDs and element references.

User Impact

Window actions now return their original outcome followed by a fresh window observation when the provider supports get_window_state, so the agent can continue using the returned references. Screen-only input and browser observation behavior remain unchanged.

Why This Change Was Made

The shared computer tool already owns post-action observation. It now selects the targeted window read through that existing flow, retains the 500 ms settling delay, and uses a separate idempotency namespace for the automatic read. Original input evidence survives a failed follow-up; stale references expire, resized image coordinates stay bound to the fresh observation, and caller cancellation keeps its existing behavior.

Browser act-and-observe is a separate follow-up. This change is not presented as the cause or a measured fix for the sampled screen-only latency incident.

Evidence

  • Current head c5faee8430e6b5bbee76b5c0d51bc3a10f1b5b51 preserves the reviewed production patch from 275cd988f35982f092df3d94cfce43af075d0e92 after refreshing its base. Test-only presence assertions and a coordinate tuple now satisfy strict indexed-access typing without weakening the checks. Independent review is clear; fresh exact-head CI is pending.
  • Linux proof at 275cd988 used Node 24.19.0, pnpm 12.3.4, and CUA Driver 0.23.2: eight focused files / 142 tests passed, the original production implementation reproduced the fresh-reference regression, and pnpm build passed.
  • The earlier changed gate passed formatting and early guards, then stopped at an unchanged unused import in src/config/types.secrets.ts. That issue was fixed separately in fix: avoid channel discovery when plugins are disabled #146689 and is included in the refreshed base. No complete manual static-gate pass is claimed.
  • Real computer-tool → Gateway → paired CUA-node → GTK proof passed. Two background edits required five progress invocations on the original implementation and three on the candidate. Fresh observations read back the expected text, returned references authorized the next edit, stale references were rejected, and cursor, foreground, and image checks passed.
  • The native driver's original effect=unverifiable, accessibility route, and unknown delivery metadata were preserved. Actual effect was established by observation readback. This is bounded fixture and call-count proof, not an end-to-end Team latency measurement.
  • The final test-only narrowing has not yet run on the clean Linux install; the local attempt stopped before test execution because the borrowed dependency install was incomplete. Required CI remains authoritative for that correction.

Production delta: +63 lines for window observation composition and result/idempotency ownership; tests/support +328 lines; docs +2 lines.

@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 07:04
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:23 AM ET / 11:23 UTC (Revision 5).

ClawSweeper review

What this changes

The computer tool returns fresh window images and element references after supported window actions while preserving the original action outcome.

Merge readiness

✅ Ready for maintainer review

The fix remains useful: current main still requires a separate window observation after input. No actionable patch defect was found, and this maintainer-authored PR is protected from automatic closure.

Priority: P2
Reviewed head: c5faee8430e6b5bbee76b5c0d51bc3a10f1b5b51

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful regression coverage, recorded real-setup evidence, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the contributor proof gate; its recorded Linux computer-tool → Gateway → CUA → GTK run reports successful readback and fresh-reference reuse, and all changed production blobs match the proof revision.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the contributor proof gate; its recorded Linux computer-tool → Gateway → CUA → GTK run reports successful readback and fresh-reference reuse, and all changed production blobs match the proof revision.
Evidence reviewed 11 items Current main still needs the fix: After an action without an inline observation, current main sleeps and calls captureAndDeliverScreenshot; it does not request fresh window references.
Latest-release comparison: The supplied latest release also uses the post-action desktop screenshot path; this review found no released implementation of the proposed automatic window refresh.
Introduced behavior and failure handling: The pinned merge-base delta adds a capability-gated window read, excludes browser preparation, preserves action evidence, and keeps caller cancellation authoritative. The read uses a separate idempotency namespace and clears old observation state before dispatch.
Findings None None.
Security None None.

How this fits together

The computer tool translates agent actions into commands for a paired or session-bound desktop. Provider observations return images and references that ground the agent’s next action.

flowchart TD
  A[Agent window action] --> B[Computer tool]
  B --> C[Desktop provider]
  C --> D[Original action outcome]
  D --> E{Window observation supported?}
  E -->|Yes| F[Fresh window image and references]
  E -->|No| G[Desktop screenshot]
  F --> H[Next agent action]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +63, Tests +328, Docs +2. Total +393 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 72 9 +63
Tests 4 336 8 +328
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 411 18 +393

Review metrics

Metric Value Why it matters
Reported interaction reduction 5 → 3 progress invocations for two background edits The recorded real setup demonstrates fewer observation turns without claiming an end-to-end latency improvement.
Production versus test growth Production +63 net lines; tests/support +328 net lines Production growth implements observation composition and result/idempotency handling within the existing owner.

Technical review

Best possible solution:

Keep post-action observation in the shared computer tool, using the existing window-read contract and preserving mutation evidence when refresh fails.

Do we have a high-confidence way to reproduce the issue?

Yes: current main’s targeted input path returns a desktop screenshot without new window references, requiring another get_window_state call before continuing. Source establishes that path; this review did not execute it.

Is this the best way to solve the issue?

Yes: composing the existing window observation in the existing post-action owner is a focused repair, and the patch preserves inline observations, browser behavior, and action evidence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c1191cf5c9b2.

Labels

Label justifications:

  • P2: This is a bounded computer-use improvement that removes redundant observation turns without evidence of an urgent widespread outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the contributor proof gate; its recorded Linux computer-tool → Gateway → CUA → GTK run reports successful readback and fresh-reference reuse, and all changed production blobs match the proof revision.

Evidence

What I checked:

  • Current main still needs the fix: After an action without an inline observation, current main sleeps and calls captureAndDeliverScreenshot; it does not request fresh window references. (src/agents/tools/computer-tool.ts:237, c1191cf5c9b2)
  • Latest-release comparison: The supplied latest release also uses the post-action desktop screenshot path; this review found no released implementation of the proposed automatic window refresh. (src/agents/tools/computer-tool.ts:238, 3a9d69db306c)
  • Introduced behavior and failure handling: The pinned merge-base delta adds a capability-gated window read, excludes browser preparation, preserves action evidence, and keeps caller cancellation authoritative. The read uses a separate idempotency namespace and clears old observation state before dispatch. (src/agents/tools/computer-tool.ts:237, c5faee8430e6)
  • Focused regression coverage: The complete tests cover usable follow-up references, distinct idempotency keys, inline observations, resized coordinates, failed reads, cancellation, stale-reference rejection, and desktop/browser-preparation fallbacks. Tests were inspected, not executed in this read-only review. (src/agents/tools/computer-tool.observation.test.ts:117, c5faee8430e6)
  • Recorded real setup evidence: The captured PR body, sourceRevision f893be648163144e84a29d437032666494be743bd9ebe7c89a53bb707d015711, reports computer-tool → Gateway → paired CUA node → GTK verification on Linux with CUA Driver 0.23.2. Two edits used five progress invocations before and three afterward; observation readback, subsequent reference use, stale-reference rejection, and foreground/cursor checks passed. These are contributor-recorded observations, not execution by this reviewer. (275cd988f359)
  • Proof revision continuity: GitHub contents metadata for the proof revision and local git ls-tree for HEAD show identical blobs for all four changed production files. This independently supports retaining the earlier production proof after the base refresh. (src/agents/tools/computer-tool.ts, 275cd988f359)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-13T07:12:53.940Z sha 275cd988f35982f092df3d94cfce43af075d0e92 :: blocked before merge. :: none
  • reviewed 2026-09-13T09:23:28.997Z sha c5faee8 :: blocked before merge. :: none
  • reviewed 2026-09-13T09:51:07.042Z sha c5faee8 :: blocked before merge. :: none
  • reviewed 2026-09-13T10:29:35.556Z sha c5faee8 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the perf/cua-targeted-observation-20260913 branch from 275cd98 to c5faee8 Compare September 13, 2026 08:57
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review current head c5faee8430e6b5bbee76b5c0d51bc3a10f1b5b51. The description records completed proof and pending exact-head CI.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc vincentkoc closed this Sep 13, 2026
@vincentkoc vincentkoc reopened this Sep 13, 2026
@vincentkoc
vincentkoc merged commit 14527ca into main Sep 13, 2026
219 of 221 checks passed
@vincentkoc
vincentkoc deleted the perf/cua-targeted-observation-20260913 branch September 13, 2026 11:38
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit to zachisfine/openclaw that referenced this pull request Sep 13, 2026
* temp/pr-146799: (70 commits)
  test: reuse explicit fallback config fixtures (openclaw#146948)
  fix(computer): return fresh window observations after actions (openclaw#146822)
  refactor(feishu): remove unreachable requester topic selection (openclaw#146904)
  improve(gateway): reduce CPU spent listing agent-owned sessions (openclaw#137745)
  fix(ui): avoid recapturing chat drafts during UI updates (openclaw#146884)
  fix(ui): show system uptime in the debug overlay (openclaw#146960)
  fix(retry): honor waits beyond the native timer limit (openclaw#145718)
  fix(ui): keep chat history idle when run status changes (openclaw#146802)
  fix(ui): reuse persisted text during chat streaming (openclaw#146831)
  refactor(qa): share harness drift result construction (openclaw#146903)
  test(agents): coordinate settings lock contention (openclaw#146949)
  fix(worker): avoid repeatedly serializing screenshot history (openclaw#146907)
  fix(secrets): stop buffered upload writes after cancellation (openclaw#146840)
  perf(doctor): avoid unnecessary state runtime imports (openclaw#146926)
  improve: reduce compaction request estimation work (openclaw#146961)
  fix(ci): wait for forwarded avatar imports before assertions (openclaw#146729)
  perf(workers): skip configured Git author lookups (openclaw#146833)
  fix: admit borrowed memory writes through the agent database owner (openclaw#146760)
  fix(discord): prevent voice playback gaps and stale turn controls (openclaw#146798)
  improve: reduce worktree filesystem stalls and archive syncs (openclaw#146906)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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