← Back to Pull requests

feat(automation): add background native text selection #908

Merged
steipete merged 80 files (2169 lines) on Oct 04, 2026 08:11 UTC
View on GitHub
steipete steipete commented on Oct 04, 2026 05:30 UTC
Author

Summary

Add peekaboo select-text and Agent/MCP select_text for literal native text selection and caret placement without typing, changing the clipboard, activating the app, or falling back to foreground input.

Requests use exact UTF-16 matching, adjacent prefix/suffix disambiguation, and text, cursor_before, or cursor_after. Missing/ambiguous matches refuse before input. Success requires a confirmed native range and unchanged source text; unconfirmed writes remain retry-unsafe.

Ownership and compatibility

Reuse the existing AX range setter, element mutation planning, snapshot leases, target receipts, and canonical outcome owners. Selection is action-only and does not require AXValue writability or keyboard focus. Final window validation follows the final awaited source-text read immediately before no-op/write. Existing action/value query lookup retains its first-match fast path.

Bridge protocol 1.42 advertises the capability. Older hosts refuse without synthesized input. CLI/MCP documentation, command inventories, hosted test filters, and both changelogs are updated. Native testing also found and fixed the public MCP projector dropping the four selection metadata fields; a real server/InMemoryTransport regression reproduced that defect before the fix.

Qualification

Landed as 3f70a60411f50b969221df92ec4f747f5913aebe by the repository's allowed squash method. Its tree is byte-identical to reviewed/tested head 58ebe36f8ff28d678cd055b793d1d8765a391cfd, which includes the diagnostic correction and main's prior changes. All exact-head hosted checks, signed native qualification and external reviews pass. Earlier evidence below remains pinned to its actual source.

  • Follow-up ff1cf19f6: valid process-only/screen observations now receive retry-safe INVALID_INPUT guidance naming --window-id / window_id, outside the generic receipt-error catch. Malformed/invalidated receipts still report stale, with no dispatch. Red-before/green-after: 21 CLI tests and 74 MCP tests passed, plus clean format/strict lint and isolated P0 review. The four tested file hashes remain identical after the main merge.

  • The merged candidate passed a fresh isolated whole-PR P0 review. Only changelog placement needed manual resolution; published 4.8.0 notes remain byte-identical to main.

  • Rebuilt/signed current58 native qualification passes all21 CLI/MCP cases,48 actual uncached observations/full images,310 live receipt validations plus two offline lifecycle checks, and normal cleanup with88/88 baseline generations preserved. The observer spans all input and shutdown (7,133 samples,max43.797ms); foreground/cursor/buttons/modifiers/clipboard remain unchanged. CUA separately matches context cases but selects19/20 newline-inclusive units. The earlier58 observer-cap failure and a pre-input runner readiness failure are retained separately, not counted as passes.
  • Completed candidate qualification at 88841dcb3f3aa8f77de653a84bee43a6caac9d3f:

  • Focused follow-up: 218 tests across 13 suites passed, with clean formatting/lint and isolated scoped P0 review. Initial CI exposed 12 stale inventory assertions across six test files; those were fixed, not bypassed.

  • macOS CI, supplemental validation including full-safe, and CodeQL all passed on that exact head, attempt 1.

  • Signed candidate native run: 10 CLI cases and 11 real stdio-MCP actions, including all three modes, adjacent contexts, full newline-inclusive selection, unfocused guard selection, and ambiguity/missing/wrong-window refusal. Fifteen changes and six refusals agree with independent native ranges; both documents' text, styles, and mutation/paste counters remain unchanged.

  • A first exact-head run had correct native effects but eight cached pre-action observations per transport. That freshness failure is retained. A new fixture run requalified all cases with 42 demonstrably uncached pre/post AX observations; actual exported responses were checked before each action. The 1.8-second observation spacing is a proof workaround, not a public force-fresh API claim.

  • New-run receipts: 298 live validations against their actual producers (279 candidate, 19 installed-GUI auxiliary invalidations); two later daemon lifecycle receipts are offline-only. All 87 baseline app generations survived normal fixture cleanup. The observer spanned cleanup: 5,463 samples, maximum gap 44.001 ms; global foreground, pointer/buttons/modifiers, clipboard and pre-existing window order were unchanged. This is sampled evidence, not continuous isolation.

  • Separate exact-head comparator evidence: integrated computer use selected 19 UTF-16 units for the same newline-inclusive 20-unit literal; Peekaboo selected all 20. An explicit protocol-1.41 host refused safely before selection dispatch. Neither claim is generalized to all applications.
  • Boundaries

    This is signed candidate-daemon qualification, not an installed-GUI rollout. Native fixed-baseline tests do not cover surrogate-pair/decomposed-Unicode content; that coverage remains unit/wire-level. The separate installed rich-paste preparation failure and complex Agent/CUA concurrency acceptance remain open. No release or universal parity is claimed.

    The branch was integrated with main without rebase/force and landed by the allowed squash method. The final source tree matches the tested head exactly; old green runs were not substituted for current-head CI. Signed58 artifacts are pre-squash candidates and remain uninstalled.

    Diff: 2169 lines (+2079 / -90) across 80 files Reviewer: steipete Review duration: 161m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.91) × (1 − Review Confidence (0.84)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.91 · 2169 lines diff across 80 files
    0.91
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.91 · 5 substantive comment(s)
    0.91
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    83%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Self Review self_review
    0.140
    Mass File Touch mass_file_touch
    0.080
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    11 items
    clawsweeper[bot] clawsweeper[bot] commented on Oct 04, 2026 05:30 UTC
    Bot

    <!-- clawsweeper-pr-ack:opened item=908 -->
    🦞👀
    ClawSweeper picked this up.

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

    <!-- clawsweeper-review-progress:start -->

    ClawSweeper review complete

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

    View the workflow run.
    <!-- clawsweeper-review-progress:end -->

    clawsweeper[bot] clawsweeper[bot] commented on Oct 04, 2026 05:33 UTC
    Bot

    Codex review: needs maintainer review before merge. _Reviewed October 4, 2026, 4:08 AM ET / 08:08 UTC (Revision 4)._

    ClawSweeper review

    What this changes

    Adds native text selection and caret placement across the CLI, Agent, MCP, and Bridge, with literal UTF-16 matching and verified outcomes.

    Merge readiness

    ✅ Ready for maintainer review

    The feature remains distinct from current main. The prior diagnostic defect is fixed, and current-head native qualification resolves the previous review’s blocker; no remaining actionable patch defect was found.

    Priority: P2
    Reviewed head: 58ebe36f8ff28d678cd055b793d1d8765a391cfd

    Review scores

    | Measure | Result | What it means |
    |---|---|---|
    | Overall readiness | 🦞 diamond lobster (5/6) | Strong current-head native qualification, focused safety regressions, and shared implementation owners support above-average confidence with no remaining actionable finding. |
    | Proof confidence | 🦞 diamond lobster (5/6) ✨ media proof bonus | Sufficient (linked_artifact): Signed qualification at the pinned head exercises the shared native selection owner through CLI and real stdio MCP, covering all modes, contexts, newline selection, unfocused fields, and refusals; inspected images supplement native-range and lifecycle results. The previous qualification blocker is resolved. No stored-data contract changes require migration proof. |
    | Patch quality | 🦞 diamond lobster (5/6) | No actionable review findings were identified. |

    Verification

    | Check | Result | Evidence |
    |---|---|---|
    | Real behavior | Verified | Sufficient (linked_artifact): Signed qualification at the pinned head exercises the shared native selection owner through CLI and real stdio MCP, covering all modes, contexts, newline selection, unfocused fields, and refusals; inspected images supplement native-range and lifecycle results. The previous qualification blocker is resolved. No stored-data contract changes require migration proof. |
    | Evidence reviewed | 9 items | Pinned introduction and merge identity: Reviewed the introduced main-to-head delta. Raw commit records confirm the original head’s two recorded parents and the test merge’s exact main-then-head parents; both commits have the same result tree.<br>Final-effect target validation: The selection driver rechecks exact target authority after the final awaited source read and immediately before either no-op or native write. Readback requires the requested range and unchanged UTF-16 text; unconfirmed writes remain retry-unsafe.<br>Prior diagnostic finding resolved: The exact-window guard now sits outside the generic receipt-error catch. Current CLI and MCP regressions distinguish valid process/screen observations from malformed or invalidated receipts, matching the accepted discussion at https://github.com/openclaw/peekaboo/pull/908#discussion_r4176553397. |
    | Findings | None | None. |
    | Security | None | None. |

    How this fits together

    Peekaboo’s desktop automation receives element targets and literal text from CLI or agent clients. It validates an observed window, changes the native selection through Accessibility, and returns a verified outcome and target receipt.

    flowchart TD
     A[CLI or agent request] --> B[Observed window and element]
     B --> C[Validate target and snapshot lease]
     C --> D[Resolve unique literal match]
     D --> E[Native selection or caret write]
     E --> F[Verify range and unchanged text]
     F --> G[Outcome and target receipt]
     C --> H[Safe refusal]
     D --> H
    

    Before merge

    None.

    <details>
    <summary><strong>Agent review details</strong></summary>

    Security

    None.

    Review metrics

    | Metric | Value | Why it matters |
    |---|---|---|
    | Production and test growth | Swift production +902 net lines; tests +1021 net lines | Production growth implements the shared selection operation and its client surfaces, with substantial matching and boundary regression coverage. |
    | Native qualification | 21 CLI/MCP cases; 48 uncached observations; 310 live receipt validations | The captured current-head qualification exercises native effects and refusals beyond mocked tests. |

    Technical review

    Best possible solution:

    Retain the shared native-only selection path with exact-window validation, unchanged-text readback, and capability-gated remote execution.

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

    Not applicable to a feature request; the recorded signed current-head CLI/MCP run demonstrates selection modes, context matching, and safe refusals in a native receiver.

    Is this the best way to solve the issue?

    Yes: the patch reuses existing mutation planning, target receipts, snapshot leases, and native range setting rather than adding a competing input mechanism.

    AGENTS.md: found and applied where relevant.

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

    Labels

    Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.

  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • Label justifications:

  • P2: This is a bounded desktop automation capability with demonstrated native behavior and no urgent regression.

  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.

  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Signed qualification at the pinned head exercises the shared native selection owner through CLI and real stdio MCP, covering all modes, contexts, newline selection, unfocused fields, and refusals; inspected images supplement native-range and lifecycle results. The previous qualification blocker is resolved. No stored-data contract changes require migration proof.

  • proof: sufficient: Contributor real behavior proof is sufficient. Signed qualification at the pinned head exercises the shared native selection owner through CLI and real stdio MCP, covering all modes, contexts, newline selection, unfocused fields, and refusals; inspected images supplement native-range and lifecycle results. The previous qualification blocker is resolved. No stored-data contract changes require migration proof.
  • Evidence

    What I checked:

  • Pinned introduction and merge identity: Reviewed the introduced main-to-head delta. Raw commit records confirm the original head’s two recorded parents and the test merge’s exact main-then-head parents; both commits have the same result tree. (67b0d591d656)

  • Final-effect target validation: The selection driver rechecks exact target authority after the final awaited source read and immediately before either no-op or native write. Readback requires the requested range and unchanged UTF-16 text; unconfirmed writes remain retry-unsafe. (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:350, 58ebe36f8ff2)

  • Prior diagnostic finding resolved: The exact-window guard now sits outside the generic receipt-error catch. Current CLI and MCP regressions distinguish valid process/screen observations from malformed or invalidated receipts, matching the accepted discussion at https://github.com/openclaw/peekaboo/pull/908#discussion_r4176553397. (Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPDesktopActionFailureHandler.swift:71, 58ebe36f8ff2)

  • Current-head native qualification: The captured body and https://github.com/openclaw/peekaboo/pull/908#issuecomment-5977940641 report rebuilt signed qualification at the pinned head: 21 CLI/real stdio-MCP cases, 48 uncached observations, 310 live receipt validations, and 88 preserved baseline process generations. This completes the previous review’s rank-up move. Prepared images 1–4 were inspected locally: current-head selection includes the full displayed line, while the comparator excludes its newline. Exact counts rely on the accompanying native-range results, not pixels alone. Qualification is explicitly limited to the candidate daemon and finite sampled observations. (58ebe36f8ff2)

  • Refusal, revocation, and replay coverage: Focused tests cover authority revoked during the final read, secure targets, source/selection drift, zero-write no-ops, pending or consumed snapshots, and retry-unsafe unverified writes. These supplement native missing/ambiguous/wrong-window refusal evidence. (Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/TextSelectionRequestTests.swift:47, 58ebe36f8ff2)

  • Compatibility and security boundaries: Bridge negotiation removes selection below protocol 1.42, and client/server capability checks refuse before dispatch. Existing mutation operations retain their capability checks. Default protocol implementations preserve existing conformers, existing input preferences remain unchanged, and the public MCP projector exposes selection metadata without source text. No stored-data migration or dependency-source change is introduced. (Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:175, 58ebe36f8ff2)
  • Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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

    <details>
    <summary>Review history (3 earlier review cycles)</summary>

    <!-- clawsweeper-review-history v=1 total=3 -->

  • reviewed 2026-10-04T05:33:04.978Z sha d2a2662098d3bc0849f58147cb438fda0205ac35 :: needs changes before merge. :: none

  • reviewed 2026-10-04T06:07:52.296Z sha 88841dcb3f3aa8f77de653a84bee43a6caac9d3f :: needs changes before merge. :: none

  • reviewed 2026-10-04T07:21:29.731Z sha 58ebe36f8ff28d678cd055b793d1d8765a391cfd :: needs changes before merge. :: none
  • </details>

    </details>

    <!-- clawsweeper-verdict:needs-human item=908 sha=58ebe36f8ff28d678cd055b793d1d8765a391cfd confidence=high updated_at=2026-10-04T08:06:19Z reviewed_at=2026-10-04T08:08:25.545Z lease_owner=github-run-37187798344-1 lease_comment_id=5977958066 source_revision=f2d269da91357a328c8c0d342576255f45e28fe4520bdb3c16ee0004bc190064 live_verification=absent -->
    <!-- clawsweeper-review-state:ready item=908 sha=58ebe36f8ff28d678cd055b793d1d8765a391cfd v=1 -->

    <!-- clawsweeper-review-version item=908 reviewed_at=2026-10-04T08:08:25.545Z sha=58ebe36f8ff28d678cd055b793d1d8765a391cfd source_revision=f2d269da91357a328c8c0d342576255f45e28fe4520bdb3c16ee0004bc190064 lease_owner=github-run-37187798344-1 lease_comment_id=5977958066 v=1 -->

    <!-- clawsweeper-review item=908 -->

    steipete steipete commented on Oct 04, 2026 06:58 UTC
    Author

    Exact 88841dcb native requalification is complete: CLI and real stdio MCP agree with the native receiver on selection modes, context matching, full trailing-newline selection, unfocused-field selection and safe refusals. The first run's cached pre-action AX evidence remains a failed freshness clause; the new fixture run has 42 uncached pre/post observations and unchanged text/style/paste state.

    The inspected captures below are synthetic-only. Before: PRIMARY is selected. After: the complete PB_PRIMARY_BASELINE line, including its trailing newline, is selected. Native state and CLI/MCP metadata—not the pixels alone—prove the exact 0+20 UTF-16 range.

    The new run validates 298 signed bundles against their actual live producers, preserves all 87 baseline app generations, and samples unchanged global foreground, cursor/buttons/modifiers, clipboard and existing window order through normal cleanup. Two later daemon lifecycle receipts are offline-only. This is candidate-daemon proof; no installed-GUI or universal-parity claim.

    !Before: PRIMARY selected in the synthetic receiver

    !After: newline-inclusive full literal selected, native range 0+20

    cursor[bot] cursor[bot] commented on Oct 04, 2026 06:58 UTC
    Bot

    PR Summary

    <!-- CURSOR_SUMMARY -->
    Medium Risk
    Introduces a new process-generation-bound accessibility mutation and Bridge 1.42 negotiation surface, but reuses existing element-action receipt patterns with strict pre-dispatch refusals and no keyboard/clipboard fallback.

    Overview
    Adds background native text selection end-to-end: CLI select-text, Agent/MCP select_text, and Bridge protocol 1.42 with a textSelection capability and selectText operation.

    Matching is literal UTF-16 with optional adjacent prefix/suffix, modes text / cursor_before / cursor_after, and pre-dispatch refusals for ambiguous or missing matches. Execution goes through AXSelectedTextRange only (action-only policy—no typing, focus, activation, or clipboard), with source-drift checks, observed mutation readback, and the same snapshot leases / process-generation receipts as other element mutations. Exact-window snapshots are required; process-only or screen observations refuse before dispatch.

    ElementActionResult and command/MCP output now carry textSelection ranges; MCP metadata projection exposes only the four public selection fields for select_text. Runtime wiring includes bridge client/server handlers, remote automation, capability policy, CI test filters, changelogs, and release preflight (34 root commands).

    <sup>Reviewed by Cursor Bugbot for commit 58ebe36f8ff28d678cd055b793d1d8765a391cfd. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>
    <!-- /CURSOR_SUMMARY -->

    cursor[bot] cursor[bot] commented on Oct 04, 2026 07:02 UTC
    Reviewer

    <!-- BUGBOT_REVIEW -->
    Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

    <!-- BUGBOT_FIX_ALL -->
    <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo2M2FiMDc5YS04NWExLTQ4OTMtOGZiOC1jOWUxM2M5ZTZiNDQiLCJlbmNyeXB0aW9uS2V5IjoiX2tJTnBjZV9saHZZYnhkUHk2czhyU1poRHlaWWpvUExRRGRRbjFFMUMwTSIsImJyYW5jaCI6ImNvZGV4L2JhY2tncm91bmQtdGV4dC1zZWxlY3Rpb24iLCJyZXBvT3duZXIiOiJvcGVuY2xhdyIsInJlcG9OYW1lIjoiUGVla2Fib28iLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
    <!-- /BUGBOT_FIX_ALL -->

    <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN -->
    <sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.</sup>
    <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END -->

    <sup>Reviewed by Cursor Bugbot for commit 88841dcb3f3aa8f77de653a84bee43a6caac9d3f. Configure here.</sup>

    cursor[bot] cursor[bot] commented on code on Oct 04, 2026 07:02 UTC
    Code Review
    Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:1
    @@ -358,9 +362,18 @@ enum ElementActionCommandExecutor {
     
         private static func requireActionTargetIdentity(
             snapshotID: String,
    -        snapshots: any SnapshotManagerProtocol
    +        snapshots: any SnapshotManagerProtocol,
    +        requireExactWindow: Bool
         ) async throws -> DesktopTargetIdentity {
             do {
    +            if requireExactWindow {
    +                let identity = try await SnapshotTargetReceiptPlanner(snapshots: snapshots)
    +                    .planForMutation(snapshotID: snapshotID).receipt.requireIdentity()
    +                guard identity.exactWindow != nil else {
    +                    throw PeekabooError.invalidInput("Text selection requires a fresh exact-window snapshot")
    +                }
    +                return identity
    +            }

    Exact-window refusal message is lost

    Medium Severity

    <!-- DESCRIPTION START -->
    The new exact-window guard throws a specific invalidInput refusal, but the surrounding catch immediately replaces it with a generic process-generation receipt failure. Callers then see a stale-snapshot error and hint, so a process-only or screen snapshot is reported as an inconsistent receipt instead of a missing exact-window target.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: 79ce26de-ce5c-4a2c-b2b0-813a1fdc7444 -->

    <!-- LOCATIONS START
    Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift#L368-L389
    Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPDesktopActionFailureHandler.swift#L55-L70
    LOCATIONS END -->
    <details>
    <summary>Additional Locations (1)</summary>

  • Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPDesktopActionFailureHandler.swift#L55-L70
  • </details>

    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjdlZDA1ZjkzLTdmZTAtNGJmYS1iODdkLTc4ZDIzODhmNzVlZSIsImVuY3J5cHRpb25LZXkiOiJkWk1oZmJPSllsZGU0UDBjZjVmMDQ4YTBxNENXYUxjY0tjcF9COFRGemhZIiwiYnJhbmNoIjoiY29kZXgvYmFja2dyb3VuZC10ZXh0LXNlbGVjdGlvbiIsInJlcG9Pd25lciI6Im9wZW5jbGF3IiwicmVwb05hbWUiOiJQZWVrYWJvbyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjdlZDA1ZjkzLTdmZTAtNGJmYS1iODdkLTc4ZDIzODhmNzVlZSIsImVuY3J5cHRpb25LZXkiOiJkWk1oZmJPSllsZGU0UDBjZjVmMDQ4YTBxNENXYUxjY0tjcF9COFRGemhZIiwiYnJhbmNoIjoiY29kZXgvYmFja2dyb3VuZC10ZXh0LXNlbGVjdGlvbiIsInJlcG9Pd25lciI6Im9wZW5jbGF3IiwicmVwb05hbWUiOiJQZWVrYWJvbyIsInByTnVtYmVyIjo5MDgsImNvbW1pdFNoYSI6Ijg4ODQxZGNiM2YzYWE4Zjc3ZGU2NTNhODRiZWU0M2E2Y2FhYzlkM2YiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>

    <sup>Reviewed by Cursor Bugbot for commit 88841dcb3f3aa8f77de653a84bee43a6caac9d3f. Configure here.</sup>

    steipete steipete commented on Oct 04, 2026 07:05 UTC
    Author

    The late exact-window diagnostic finding is accepted. Both wrappers put the exact-window requirement inside a generic receipt-error catch, so callers can get stale-process-receipt guidance for the wrong kind of target. I am fixing the distinction and adding CLI/MCP regression coverage before landing.

    The signed native selection proof above remains valid for its exact tested head and cases. No merge has been pushed; the focused follow-up will receive its own review and exact-head checks. No input fallback, target-authority relaxation, or blind replay is involved.

    steipete steipete commented on code on Oct 04, 2026 07:16 UTC
    Code Review
    Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:1
    @@ -358,9 +362,18 @@ enum ElementActionCommandExecutor {
     
         private static func requireActionTargetIdentity(
             snapshotID: String,
    -        snapshots: any SnapshotManagerProtocol
    +        snapshots: any SnapshotManagerProtocol,
    +        requireExactWindow: Bool
         ) async throws -> DesktopTargetIdentity {
             do {
    +            if requireExactWindow {
    +                let identity = try await SnapshotTargetReceiptPlanner(snapshots: snapshots)
    +                    .planForMutation(snapshotID: snapshotID).receipt.requireIdentity()
    +                guard identity.exactWindow != nil else {
    +                    throw PeekabooError.invalidInput("Text selection requires a fresh exact-window snapshot")
    +                }
    +                return identity
    +            }

    Fixed in ff1cf19f6, included in current head 58ebe36f8. The generic catch now covers receipt assembly/invalidated evidence only; valid process-only or screen observations receive an explicit retry-safe INVALID_INPUT refusal naming --window-id / window_id. Malformed and invalidated controls retain SNAPSHOT_STALE, and no mutation or focus fallback occurs. New regressions failed on the original implementation and pass after the fix: 21 CLI tests and 74 MCP tests across the focused and adjacent suites. Both the focused fix and the main-integrated PR passed isolated P0 review. New-head hosted checks and signed qualification are running before landing.

    steipete steipete commented on Oct 04, 2026 08:03 UTC
    Author

    Current-head signed native qualification is complete at 58ebe36f8ff28d678cd055b793d1d8765a391cfd.

    The isolated source-blind audit passes all 21 CLI/MCP cases and their freshness/lifecycle requirements: 48 actual uncached pre/post observations and full images, 310 live-validated signed bundles (291 candidate plus 19 GUI auxiliary invalidations), and two separately checked offline lifecycle bundles. The tracked observer spans input, normal exact-generation cleanup, receipt validation and daemon shutdown: 7,133 samples, maximum gap43.797ms, with unchanged global foreground, pointer/buttons/modifiers and clipboard. All88 baseline app generations are present at final inventory. This remains finite sampled evidence, not continuous isolation.

    The integrated-computer-use comparison matches both context-disambiguation cases but again selects0+19 for a requested newline-inclusive0+20 literal; Peekaboo's CLI and MCP each select all20. The two inspected synthetic captures below show that difference. Native ranges—not pixels alone—establish the counts. Prior CUA three-mode matches and the unavailable guard-window binding remain separately recorded; neither is falsely promoted to a new comparison here.

    Earlier failed evidence is preserved: the first58 observer hit its600-second cap during the slower comparator, and an intermediate runner caught a readiness race before any fixture launch/input. Neither is counted as a full pass. The final bounded run records the observer's exact PID/generation and completes normally within its lifetime. No input was replayed into the old receiver.

    The accepted diagnostic finding is fixed and reviewed, with21 CLI and74 MCP red-before/green-after tests; current Cursor and ClawSweeper reviews have no remaining actionable findings. New-head macOS CI is green; remaining workflow finalization is still watched before landing. No installation, release or universal-parity claim.

    !Peekaboo current58: native selection 0+20 including newline

    !Integrated comparator: same literal request, native selection 0+19

    steipete steipete commented on Oct 04, 2026 08:15 UTC
    Author

    Landed by the repository's allowed squash method as 3f70a60411f50b969221df92ec4f747f5913aebe. The landed tree is a80df0fbde95825c577d3b779291b2747d11e162, byte-identical to the reviewed/tested head58ebe36f8. Visible main is pulled and synchronized; pre-existing local submodule selections are preserved. The signed artifacts remain labeled as pre-squash58 candidates, not installed or falsely restamped.

    Final focused regression commands, run through the workspace wrapper with isolated configuration and native/ambient input gates disabled:

    python3 scripts/setup-swift-workspace.py run -- swift test --package-path Apps/CLI --arch arm64 --configuration debug --jobs 2 --disable-automatic-resolution --skip-update --disable-xctest --enable-swift-testing --no-parallel --filter 'SelectTextCommandTests|SnapshotReceiptPreDispatchCommandTests|ComposedInputParityValidationTests'
    python3 scripts/setup-swift-workspace.py run -- swift test --package-path Core/PeekabooCore --arch arm64 --configuration debug --jobs 2 --disable-automatic-resolution --skip-update --disable-xctest --enable-swift-testing --no-parallel --filter 'MCPTextSelectionTests|MCPDesktopActionOutcomeProjectionTests|MCPToolArgumentValidationTests'
    

    These passed21 CLI and74 MCP tests after the new assertions failed on the original helpers. Earlier metadata/inventory follow-up passed218 tests across13 suites. Formatting, strict lint, isolated review, Cursor and ClawSweeper have no remaining actionable findings.

    Exact58 hosted proof passed attempt1: macOS CI, supplemental/full-safe, and CodeQL. Signed current-head native proof is recorded above:21 CLI/MCP cases,48 uncached reads/images,310 live receipts plus2 offline lifecycle checks, and observed normal cleanup preserving88/88 baseline generations. Earlier cache/observer/setup failures remain explicitly separate.

    The feature uses the existing range setter and mutation/receipt boundaries; no keyboard, clipboard or foreground fallback was added. The separate installed-GUI paste failure, wider pointer/key/scroll coverage and complex Agent/CUA concurrency goal remain open. No release or universal parity is claimed.

    Reviewers
    Assignees
    steipete steipete
    Labels
    risk: low confidence: 83.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 90.5% (HIGH) · Higher = larger blast radius
    90.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 83.9% · Lower = rushed or shallow review
    83.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%