← Back to Pull requests

fix: background input, bridge error surfacing, exact-app targeting, and system permission dialogs #743

Merged
steipete merged 60 files (3082 lines) on Sep 19, 2026 01:14 UTC
View on GitHub
steipete steipete commented on Sep 16, 2026 06:15 UTC
Author

Five fixes surfaced while driving Messages.app in the background over SSH (macOS 27, Peekaboo host + build-scoped daemon). Each was reproduced against a running host before the fix and re-verified on real hardware afterward.

Fixes

  • fix(bridge): surface unsigned host failures behind attested receipts — a failed attested mutating op answered with an unsigned error that the client discarded, printing the useless Bridge response was lost … the required receipt envelope and hiding the real cause. The client now surfaces the host's actual code/message/details plus host-vs-client build strings (with a skew warning), and the server returns a signed receipt carrying the real failure for mutating operations.

  • fix(automation): resolve exact app targets despite unpinnable unrelated processes — an unrelated process lacking process-generation identity (e.g. AppSSODaemon) made the mutation inventory partial and blocked resolving an unambiguous --app target for type/paste/menu. Resolution now falls back to an authoritative selector census when the inventory is partial, preserving ambiguity refusal, expected-generation checks, and PID revalidation. The omission warning now names the skipped process.

  • fix(input): deliver background chords and reflowing text without spurious focus refusals — a delivered exact-window chord (e.g. cmd+n, which opens a window) failed a post-delivery focus re-check even though the keystroke landed. Delivered chords/trailing keys no longer require unchanged focus afterward, and multi-character typing tolerates a same-element frame reflow while still stopping on a genuine receiver change (focus moving to a popup/other window).

  • feat(dialog): discover and dismiss macOS system permission alerts — TCC/permission prompts drawn by UserNotificationCenter are invisible to the standard window enumeration. dialog list / dialog click --button now discover allowlisted system-alert hosts (com.apple.UserNotificationCenter, com.apple.SecurityAgent) with bounded, read-only AX traversal and dismiss them via the existing exact-receipt AXPress path (fail-closed on incomplete or ambiguous discovery).

  • fix(dialog): carry system-alert discovery capability through resolved services — the resolved capability rebuild dropped the new systemAlertDiscovery flag, so a no-target dialog click refused even when the host advertised the capability. Carried the flag through and covered the propagation.
  • A sixth reported issue — a see snapshot lost between observation and mutation across daemon/GUI hosts — is already fixed on main by producer-bound snapshot references and the host-affinity resolver, so no code change is included for it.

    Verification

    Targeted unit/integration suites for all five areas pass (bridge transport/attested-failure, application mutation planner, exact-window focus + hotkey + type continuation, and dialog discovery), format/lint are clean, and Codex autoreview returned scoped-clean. On a real macOS host: press cmd+n --app Messages --window-id … now succeeds (was "response was lost"); dialog list discovers a live TextEdit TCC prompt that window list --app UserNotificationCenter misses, and dialog click --button "Don't Allow" dismisses it (the requester received a denial), which is how the capability-propagation bug above was caught.

    Diff: 3082 lines (+2830 / -252) across 60 files Reviewer: steipete Review duration: 4019m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.96) × (1 − Review Confidence (0.73)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.96 · 3082 lines diff across 60 files
    0.96
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.79 · 5 substantive comment(s)
    0.79
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    72%
    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
    Sensitive Paths sensitive_paths
    0.096
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    9 items
    clawsweeper[bot] clawsweeper[bot] commented on Sep 16, 2026 06:15 UTC
    Bot

    <!-- clawsweeper-pr-ack:opened item=743 -->
    🦞👀
    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 -->

    cursor[bot] cursor[bot] commented on Sep 16, 2026 06:15 UTC
    Bot

    PR Summary

    <!-- CURSOR_SUMMARY -->
    Medium Risk
    Changes touch mutation targeting, AX dialog discovery/AXPress, and exact-window input validation—areas where wrong acceptance could click the wrong alert or send keystrokes to the wrong receiver, though discovery remains heavily bounded and fail-closed.

    Overview
    Adds background system-alert dialog discovery so targetless dialog list / dialog click --button can find and act on allowlisted macOS permission hosts (UserNotificationCenter, SecurityAgent) via bounded AX scanning, attested discovery proofs on prepared receipts, and fail-closed rules (no --foreground, unique dialog + one enabled AXPress button). CLI list output and JSON gain owner/subrole/button detail; remote hosts expose systemAlertDiscovery through resolved dialog capabilities.

    Exact app targeting no longer fails solely on a partial mutation inventory when an unrelated generationless process was omitted: planners can fall back to an authoritative direct lookup with selector census proofs, while ambiguity and stale-generation checks stay strict.

    Exact-window keyboard delivery is relaxed where UI legitimately moves: typing uses initial vs continuation focus validation (frame reflow OK, receiver/window change still stops delivery); delivered hotkeys/special keys skip post-delivery focus re-checks that used to fail after chords like cmd+n; focus reader disambiguation and large-tree limits are tightened accordingly.

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

    cursor[bot] cursor[bot] commented on code on Sep 16, 2026 06:19 UTC
    Code Review
    Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogDiscoveryModels.swift:1
    @@ -0,0 +1,81 @@
    +import Foundation
    +
    +/// Only exact Apple bundle and executable identities authorize automatic system-host discovery.
    +public enum DialogSystemAlertHosts {
    +    public static let executables: [String: String] = [
    +        "com.apple.UserNotificationCenter":
    +            "/System/Library/CoreServices/UserNotificationCenter.app/Contents/MacOS/UserNotificationCenter",
    +        "com.apple.SecurityAgent":
    +            "/System/Library/Frameworks/Security.framework/Versions/A/MachServices/" +
    +            "SecurityAgent.bundle/Contents/MacOS/SecurityAgent",
    +    ]
    +
    +    public static func contains(_ application: ServiceApplicationInfo) -> Bool {
    +        guard let bundle = application.bundleIdentifier,
    +              let expected = self.executables[bundle]
    +        else { return false }
    +        return application.executablePath == expected &&
    +            application.bundlePath == URL(fileURLWithPath: expected)
    +            .deletingLastPathComponent().deletingLastPathComponent().path
    +    }

    System-alert host path check is off-by-one

    High Severity

    <!-- DESCRIPTION START -->
    DialogSystemAlertHosts.contains compares bundlePath to two parents of the executable, which is the Contents directory. Production bundlePath comes from NSRunningApplication.bundleURL and is the .app or .bundle wrapper, so the allowlist never matches live UserNotificationCenter or SecurityAgent processes. Unfocused TCC and Security Agent alerts are then skipped; only a focused owner can still be discovered.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: 6113430a-78ef-4c0e-a61b-ab13eb6d1d82 -->

    <!-- LOCATIONS START
    Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogDiscoveryModels.swift#L12-L20
    LOCATIONS END -->
    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjI0ODIwN2NhLWVhODUtNDg1MC04ZWNmLWE4NmYwZDNkMjcwMSIsImVuY3J5cHRpb25LZXkiOiJieVBzcURmQWd6TmZpZ1RqMHNHMGtfY1FQWTZoaVktS2loTGhFOFdxVDJjIiwiYnJhbmNoIjoic3RlaXBldGUvam9sbHktYm9vdGgtZTU0YTU1IiwicmVwb093bmVyIjoib3BlbmNsYXciLCJyZXBvTmFtZSI6IlBlZWthYm9vIiwicHJvdmlkZXIiOiJnaXRodWIifX0" 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=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjI0ODIwN2NhLWVhODUtNDg1MC04ZWNmLWE4NmYwZDNkMjcwMSIsImVuY3J5cHRpb25LZXkiOiJieVBzcURmQWd6TmZpZ1RqMHNHMGtfY1FQWTZoaVktS2loTGhFOFdxVDJjIiwiYnJhbmNoIjoic3RlaXBldGUvam9sbHktYm9vdGgtZTU0YTU1IiwicmVwb093bmVyIjoib3BlbmNsYXciLCJyZXBvTmFtZSI6IlBlZWthYm9vIiwicHJOdW1iZXIiOjc0MywiY29tbWl0U2hhIjoiYzE0OTJmZTUyYzNkNWFhOTBkMzY2ZWQ0OTQ0ZjZhZGI2Y2NmNTgyMCIsInByb3ZpZGVyIjoiZ2l0aHViIn19" 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 c1492fe52c3d5aa90d366ed4944f6adb6ccf5820. Configure here.</sup>

    cursor[bot] cursor[bot] commented on code on Sep 16, 2026 06:19 UTC
    Code Review
    Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:1
    @@ -131,13 +138,14 @@ enum DetachedExactWindowFocusReader {
                         title: self.stringAttribute(kAXTitleAttribute as String, of: element),
                         identifier: self.stringAttribute(kAXIdentifierAttribute as String, of: element),
                         frame: observedFrame ?? .zero)
    -                if FocusedElementReceiptResolver.matches(candidate, expected: expected) {
    +                if FocusedElementReceiptResolver.matches(candidate, expected: expected, phase: phase) {
                         exactMatches.append(element)
                     }
                 }
                 queue.append(contentsOf: self.elementArrayAttribute(kAXChildrenAttribute, of: element))
             }
     
    +        guard queue.isEmpty else { return .failure(.multipleFocusedElements) }

    Incomplete focus scan now always fails

    Medium Severity

    <!-- DESCRIPTION START -->
    DetachedExactWindowFocusReader.read now returns .multipleFocusedElements whenever the 4096-node walk leaves items in the queue. That applies to the initial receipt as well as continuation. A unique focused match that used to succeed in a large window now fails, so exact-window type and press can refuse in apps whose AX tree is simply large.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: f04b28f8-50e0-4547-831e-dbc9de64fec0 -->

    <!-- LOCATIONS START
    Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift#L121-L148
    LOCATIONS END -->
    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmE3YjJmMDAxLTRmMWYtNGQyNS1hZTMwLTE4ZmFlYTQ2YThjNCIsImVuY3J5cHRpb25LZXkiOiJlVXh3ZHNDZ1VWMk9QS1RjTHBtbW1FNWV2WDlMV0Z3Q3ItUzBhaVYyTEpJIiwiYnJhbmNoIjoic3RlaXBldGUvam9sbHktYm9vdGgtZTU0YTU1IiwicmVwb093bmVyIjoib3BlbmNsYXciLCJyZXBvTmFtZSI6IlBlZWthYm9vIiwicHJvdmlkZXIiOiJnaXRodWIifX0" 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=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmE3YjJmMDAxLTRmMWYtNGQyNS1hZTMwLTE4ZmFlYTQ2YThjNCIsImVuY3J5cHRpb25LZXkiOiJlVXh3ZHNDZ1VWMk9QS1RjTHBtbW1FNWV2WDlMV0Z3Q3ItUzBhaVYyTEpJIiwiYnJhbmNoIjoic3RlaXBldGUvam9sbHktYm9vdGgtZTU0YTU1IiwicmVwb093bmVyIjoib3BlbmNsYXciLCJyZXBvTmFtZSI6IlBlZWthYm9vIiwicHJOdW1iZXIiOjc0MywiY29tbWl0U2hhIjoiYzE0OTJmZTUyYzNkNWFhOTBkMzY2ZWQ0OTQ0ZjZhZGI2Y2NmNTgyMCIsInByb3ZpZGVyIjoiZ2l0aHViIn19" 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 c1492fe52c3d5aa90d366ed4944f6adb6ccf5820. Configure here.</sup>

    cursor[bot] cursor[bot] commented on Sep 16, 2026 06:19 UTC
    Reviewer

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

    <!-- BUGBOT_FIX_ALL -->
    <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTowNzIzZWJhNy1mODgxLTRmY2QtYTI5Zi1lYmFkMTI0YmQxMTQiLCJlbmNyeXB0aW9uS2V5IjoiTUdLam5wenRmemV3NnZXVTdZQjM4ZUtwT3Jia1N1WlpvbGs1ZnJzcExnUSIsImJyYW5jaCI6InN0ZWlwZXRlL2pvbGx5LWJvb3RoLWU1NGE1NSIsInJlcG9Pd25lciI6Im9wZW5jbGF3IiwicmVwb05hbWUiOiJQZWVrYWJvbyIsInByb3ZpZGVyIjoiZ2l0aHViIn19" 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 -->

    Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

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

    steipete steipete commented on code on Sep 16, 2026 06:28 UTC
    Code Review
    Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogDiscoveryModels.swift:1
    @@ -0,0 +1,81 @@
    +import Foundation
    +
    +/// Only exact Apple bundle and executable identities authorize automatic system-host discovery.
    +public enum DialogSystemAlertHosts {
    +    public static let executables: [String: String] = [
    +        "com.apple.UserNotificationCenter":
    +            "/System/Library/CoreServices/UserNotificationCenter.app/Contents/MacOS/UserNotificationCenter",
    +        "com.apple.SecurityAgent":
    +            "/System/Library/Frameworks/Security.framework/Versions/A/MachServices/" +
    +            "SecurityAgent.bundle/Contents/MacOS/SecurityAgent",
    +    ]
    +
    +    public static func contains(_ application: ServiceApplicationInfo) -> Bool {
    +        guard let bundle = application.bundleIdentifier,
    +              let expected = self.executables[bundle]
    +        else { return false }
    +        return application.executablePath == expected &&
    +            application.bundlePath == URL(fileURLWithPath: expected)
    +            .deletingLastPathComponent().deletingLastPathComponent().path
    +    }

    Fixed in 7d01ae05. The allowlist now derives the .app/.bundle wrapper (three components up from the executable, matching NSRunningApplication.bundleURL) instead of stopping at Contents, so unfocused UserNotificationCenter / SecurityAgent alerts are discovered — not only a focused owner. The test fixture shared the same wrong depth, which is why it passed; corrected it too, and DialogDiscoveryTests now validates the real path structure.

    _🤖 Addressed by Claude Code_

    steipete steipete commented on code on Sep 16, 2026 06:28 UTC
    Code Review
    Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:1
    @@ -131,13 +138,14 @@ enum DetachedExactWindowFocusReader {
                         title: self.stringAttribute(kAXTitleAttribute as String, of: element),
                         identifier: self.stringAttribute(kAXIdentifierAttribute as String, of: element),
                         frame: observedFrame ?? .zero)
    -                if FocusedElementReceiptResolver.matches(candidate, expected: expected) {
    +                if FocusedElementReceiptResolver.matches(candidate, expected: expected, phase: phase) {
                         exactMatches.append(element)
                     }
                 }
                 queue.append(contentsOf: self.elementArrayAttribute(kAXChildrenAttribute, of: element))
             }
     
    +        guard queue.isEmpty else { return .failure(.multipleFocusedElements) }

    Fixed in 7d01ae05. Removed the guard queue.isEmpty check that failed the scan with .multipleFocusedElements whenever the 4096-node walk was truncated; the existing exactMatches.count == 1 guard already proves uniqueness among the scanned nodes, so a unique focused match in a large AX tree resolves again and exact-window type / press no longer refuse in deep-hierarchy apps.

    _🤖 Addressed by Claude Code_

    clawsweeper[bot] clawsweeper[bot] commented on Sep 16, 2026 06:32 UTC
    Bot

    Codex review: blocked before merge. _Reviewed September 16, 2026, 3:05 AM ET / 07:05 UTC (Revision 3)._

    ClawSweeper review

    What this changes

    Repairs background keyboard delivery, exact application selection, and bridge error reporting, and adds discovery and clicking of macOS permission dialogs.

    Regression provenance

    Possible regression — suspected (reviewed change). No predecessor PR is attributed.

    Merge readiness

    ⛔ Blocked before merge - 3 items remain

    The PR contains useful work absent from main, but the previously reported receiver-continuity defect remains unchanged at the pinned head. The collaborator-authored PR is not eligible for cleanup closure.

    Priority: P2
    Reviewed head: f112f68399604de073fbad2c17b3bd990888e733

    Review scores

    | Measure | Result | What it means |
    |---|---|---|
    | Overall readiness | 🦐 gold shrimp (3/6) | Useful implementation and substantial regression coverage remain limited by the unchanged input-routing blocker. |
    | Proof confidence | 🌊 off-meta tidepool | Not applicable: The collaborator exemption applies. The body reports real Messages hotkey success and TextEdit permission-dialog discovery and denial through the host; these observations do not resolve the separate sibling-focus defect. |
    | Patch quality | 🦐 gold shrimp (3/6) | 1 actionable review finding remain. |

    Verification

    | Check | Result | Evidence |
    |---|---|---|
    | Real behavior | Not applicable | Not applicable: The collaborator exemption applies. The body reports real Messages hotkey success and TextEdit permission-dialog discovery and denial through the host; these observations do not resolve the separate sibling-focus defect. |
    | Evidence reviewed | 7 items | Previous blocker remains unchanged: The latest commit changes only two CLI test expectations: eight additions and two deletions. The focus-selection and typing implementation remains identical to the previously reviewed head.<br>Focused sibling can replace the captured receiver: When multiple controls match the captured identity and no unique captured-frame match remains, selection falls back to whichever candidate is focused. Continuation validation accepts a matching title without requiring the original frame, so a same-label sibling can pass and receive subsequent characters.<br>Dispatch path makes the selection consequential: TypeService selects the continuation validator after any emitted input, then dispatches the next character. UIAutomationService checks process, window, bounds, and the relaxed identity comparison; those checks do not distinguish same-label siblings in the same window. |
    | Findings | 1 actionable finding | [P1] [P1] Reject sibling focus as proof of receiver continuity |
    | Security | None | None. |

    How this fits together

    Peekaboo routes CLI automation requests through local services or a macOS Bridge host. Application, window, and control receipts constrain where keyboard input and dialog actions may be delivered.

    flowchart TD
      A[CLI automation request] --> B[Local service or Bridge host]
      B --> C[Application and dialog discovery]
      C --> D[Exact target receipt]
      D --> E[Revalidate receiver or dialog]
      E --> F[Keyboard input or dialog click]
      F --> G[Outcome and signed receipt]
    

    Before merge

  • \[P1\] Reject sibling focus as proof of receiver continuity (P1) - This previous finding remains unchanged. If two AXTextField controls share a title and lack identifiers, the original receiver can reflow after the first character while focus moves to its sibling. With neither candidate at the captured frame, this fallback selects the focused sibling. The later process, window, and title checks accept it, so remaining text reaches the wrong control. Retain verified receiver identity or refuse multiple identity matches when frame disambiguation is lost, and cover reflow combined with sibling focus transfer.

  • Resolve merge risk (P1) - Existing background typing workflows with duplicate-label controls can deliver a suffix to the wrong field after reflow; ordinary successful typing checks do not establish compatibility for this case.

  • Complete next step (P2) - Fix the existing sibling-focus finding and add a regression proving that ambiguous reflow stops further input.
  • Findings

  • [P1] [P1] Reject sibling focus as proof of receiver continuity — Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:221-222
  • <details>
    <summary><strong>Agent review details</strong></summary>

    Security

    None.

    Review metrics

    | Metric | Value | Why it matters |
    |---|---|---|
    | Production and test growth | Production +929 net lines; tests +1630 net lines; docs +19 net lines | The stated scope explains the growth across discovery, targeting, input validation, and bridge diagnostics. |
    | Changes since previous review | 2 test files changed; 0 production files changed | The previous production-code blocker remains applicable. |

    Merge-risk options

    Maintainer options:
    1. Preserve receiver continuity (recommended)
    Remove focus-only disambiguation when captured identity is ambiguous and cover both unchanged duplicate-label controls and reflow followed by sibling focus transfer.

    <details>
    <summary>Copy recommended automerge instruction</summary>

    @clawsweeper automerge
    
    Special instructions:
    Repair continuation receiver selection without changing initial receipt validation: preserve unique captured-frame selection, refuse ambiguous identity matches when frame disambiguation is lost, and add regression coverage proving that a same-label sibling receives no remaining characters after reflow.
    

    </details>

    Technical review

    Best possible solution:

    Allow reflow only while receiver identity remains unambiguous, preserving unchanged-frame disambiguation and refusing ambiguous continuation before further input.

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

    Yes, from source: reflow the original field after the first character and move focus to a same-label sibling with no identifier; the PR's fallback selects that sibling. This read-only review did not execute a native reproduction.

    Is this the best way to solve the issue?

    No, not fully: reusing exact receipts and the authoritative application census is appropriate, but current focus cannot establish continuity between otherwise indistinguishable controls.

    Full review comments:

  • [P1] [P1] Reject sibling focus as proof of receiver continuity — Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:221-222

  • This previous finding remains unchanged. If two AXTextField controls share a title and lack identifiers, the original receiver can reflow after the first character while focus moves to its sibling. With neither candidate at the captured frame, this fallback selects the focused sibling. The later process, window, and title checks accept it, so remaining text reaches the wrong control. Retain verified receiver identity or refuse multiple identity matches when frame disambiguation is lost, and cover reflow combined with sibling focus transfer.
    Confidence: 0.99

    Overall correctness: patch is incorrect
    Overall confidence: 0.98

    AGENTS.md: found and applied where relevant.

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

    Labels

    Label justifications:

  • P2: This is a bounded desktop-automation improvement with a merge-blocking input-selection defect, without evidence of an urgent shipped outage.

  • merge-risk: 🚨 compatibility: Relaxed continuation selection can redirect existing exact-window typing workflows into a same-label sibling.

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The collaborator exemption applies. The body reports real Messages hotkey success and TextEdit permission-dialog discovery and denial through the host; these observations do not resolve the separate sibling-focus defect.
  • Evidence

    Acceptance criteria:

  • [P1] swift test --package-path Core/PeekabooAutomationKit --filter DetachedExactWindowFocusSelectionTests.

  • [P1] swift test --package-path Core/PeekabooAutomationKit --filter TypeServiceTargetResolutionTests.

  • [P1] swift test --package-path Core/PeekabooAutomationKit --filter UIAutomationExactWindowFocusTests.

  • [P1] pnpm run lint.

  • [P1] pnpm run format.
  • What I checked:

  • Previous blocker remains unchanged: The latest commit changes only two CLI test expectations: eight additions and two deletions. The focus-selection and typing implementation remains identical to the previously reviewed head. (f112f6839960)

  • Focused sibling can replace the captured receiver: When multiple controls match the captured identity and no unique captured-frame match remains, selection falls back to whichever candidate is focused. Continuation validation accepts a matching title without requiring the original frame, so a same-label sibling can pass and receive subsequent characters. (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:221, f112f6839960)

  • Dispatch path makes the selection consequential: TypeService selects the continuation validator after any emitted input, then dispatches the next character. UIAutomationService checks process, window, bounds, and the relaxed identity comparison; those checks do not distinguish same-label siblings in the same window. (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:567, f112f6839960)

  • Current main and release retain the older contract: Current main still requires frame equality for focused-element resolution and explicit targeting for dialog clicks. The inspected v4.4.0 dialog documentation likewise requires a target; automatic system-alert clicking is a distinct addition, not an already-shipped replacement. (docs/commands/dialog.md:18, d82dbd888326)

  • Dialog actions preserve receipt revalidation: Discovered actions reuse the one-shot prepared-action store. Before AXPress, the service repeats discovery and compares the exact target and retained window, dialog, and button identities. Tests cover generation changes, replacement buttons, ambiguity, incomplete discovery, and zero dispatch on refusal. (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+PreparedActions.swift:528, f112f6839960)

  • Discussion and proof assessment: The captured PR body reports real macOS 27 Messages hotkey execution and discovery/dismissal of a TextEdit permission prompt. The four downloaded images were inspected and are Cursor action buttons, not runtime evidence. The author is a COLLABORATOR, so the ordinary external-contributor proof gate does not apply. The two earlier Cursor findings were addressed; the retained ClawSweeper receiver-continuity finding was not. (f112f6839960)
  • Likely related people:

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

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

  • Repair ambiguous continuation selection and demonstrate that a newly focused same-label sibling receives no remaining characters.
  • 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 (2 earlier review cycles)</summary>

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

  • reviewed 2026-09-16T06:31:24.513Z sha 7d01ae05ec1930e476e030f7fb79c7c73bdc1b5e :: blocked before merge. :: [P1] [P1] Preserve frame disambiguation for unchanged typing receivers

  • reviewed 2026-09-16T06:45:45.729Z sha fe3ebfe997ddfeab1f0af7d280ed6ca9de77ea21 :: blocked before merge. :: [P1] [P1] Reject sibling focus as proof of receiver continuity
  • </details>

    </details>

    <!-- clawsweeper-verdict:needs-human item=743 sha=f112f68399604de073fbad2c17b3bd990888e733 confidence=high updated_at=2026-09-16T07:03:12Z reviewed_at=2026-09-16T07:05:39.385Z lease_owner=github-run-35066529331-1 lease_comment_id=5693404305 source_revision=9655e129003ef2e86b0acd5f126f99e4cd3f3565125d9c5b7882174ebab2b6fb live_verification=absent -->
    <!-- clawsweeper-review-state:blocked item=743 sha=f112f68399604de073fbad2c17b3bd990888e733 v=1 -->

    <!-- clawsweeper-review-version item=743 reviewed_at=2026-09-16T07:05:39.385Z sha=f112f68399604de073fbad2c17b3bd990888e733 source_revision=9655e129003ef2e86b0acd5f126f99e4cd3f3565125d9c5b7882174ebab2b6fb lease_owner=github-run-35066529331-1 lease_comment_id=5693404305 v=1 -->

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

    Reviewers
    Assignees
    steipete steipete
    Labels
    risk: low confidence: 72.8% reviewed sensitive_module
    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: 96% (HIGH) · Higher = larger blast radius
    96%
    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: 72.8% · Lower = rushed or shallow review
    72.8%
    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: 26.1% · Safe to merge
    26.1%