Skip to content

fix(verify): Find webview Settings window on Windows UIA - #805

Merged
omesser merged 3 commits into
mainfrom
cursor/fix-windows-webview-settings-finder-4057
Sep 17, 2026
Merged

omesser merged 3 commits into
mainfrom
cursor/fix-windows-webview-settings-finder-4057

Conversation

@omesser

@omesser omesser commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Why

With AI_BUDDY_SETTINGS_WEBVIEW=1, the Settings window opens as a Tauri webview with title Settings and class Tauri Window. Find-SettingsWindow only matched ClassName AiBuddySettings (the native Win32 window class), so dump / pick-source / wait failed with ERROR: Settings window not found. This is the Windows equivalent of the macOS verification gap closed by #801.

A Name=Settings + ControlType=Window fallback is still too broad: the Windows Settings app is also a window named Settings.

Discovered during live smoke testing on DESKTOP-UQIE144 at commit 2c2450b. UIA saw the tabs and ComboBox named AI source, confirming the window drew correctly, but the finder could not locate it.

What changed

In scripts/ax-settings-win.ps1 Find-SettingsWindow:

  • First try native: ClassName AiBuddySettings (unchanged)
  • Fall back to webview: ClassNameProperty = Tauri Window AND NameProperty = Settings AND ControlType = Window
  • Optional -ProcessId (positional), like other commands and like macOS ax-settings. Inner functions take -ProcessId, not -Pid: $PID is Constant+AllScope and cannot be a function parameter
  • When -ProcessId is omitted, still uses the three-way class+name+window match

In scripts/verify-settings-win.ps1 PID-scoped window finder:

  • Native AiBuddySettings first, then ClassName Tauri Window with title Settings
  • Finder-only: native Win32 child assumptions (SysTabControl32, Button/Static) are unchanged

Test: tests/ax-settings-win-finder.test.js parses finder construction (no live UIA) and asserts Name-only matches a Windows Settings app fixture while the three-way matcher does not.

How to verify

  • node --test tests/ax-settings-win-finder.test.js — 5/5. Webview AndCondition requires ClassName Tauri Window + Name Settings + ControlType Window. A Windows Settings app fixture (Name=Settings, ControlType=Window, class ApplicationFrameWindow) matches Name+Window alone and fails the three-way matcher. Native AiBuddySettings stays first. Optional -ProcessId is not named Pid.
  • node --test tests/*.test.js — 251/251
  • pre-commit run --files scripts/ax-settings-win.ps1 tests/ax-settings-win-finder.test.js

Live UIA wait/dump against a real Settings window is leftover prose, not a checklist: this agent is Linux and UIAutomationClient is not here. Finder-only scope — full verify-settings-win.ps1 webview e2e is not claimed green; after the find that script still assumes native Win32 children.

Notes

Scope: Windows finder gap only, with class+name+window so the Windows Settings app cannot win FindFirst. #801 landed the macOS picker fix. #802 remains open and overlaps with #801 on macOS.

Related issues:

Out of scope:

— Cursor agent (Coder), on @omesser's behalf.

Open in Web Open in Cursor 

In webview mode (AI_BUDDY_SETTINGS_WEBVIEW=1), the Settings window has
title 'Settings' and class 'Tauri Window', but ax-settings-win.ps1 and
verify-settings-win.ps1 only matched ClassName 'AiBuddySettings' (native Win32).
This made 'ax-settings-win.ps1 dump|pick-source|wait' fail with 'Settings window not found'.

In Find-SettingsWindow (ax-settings-win.ps1):
- First try native: ClassName AiBuddySettings (unchanged)
- Fall back to webview: Window named 'Settings' with ControlType Window
- Do not match class 'Tauri Window' alone (too broad)

In verify-settings-win.ps1 PID-scoped finder:
- Check each window for native class first
- Then check for Tauri Window with title 'Settings'
- Preserve native behavior when native window present

No test harness exists for these Windows scripts. Manual verification
required: with AI_BUDDY_SETTINGS_WEBVIEW=1 on Windows, ax-settings-win.ps1
wait|dump must succeed.

Refs #706 (Step 7 verify), #801 (macOS AX pick landed)

Co-authored-by: Oded Messer <odedmesser@gmail.com>

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGES_REQUESTED @ fa8d85e — finder scope is the gap, not the intent.

Spec / Why

Right problem for #706 Step 7: with AI_BUDDY_SETTINGS_WEBVIEW=1, native AiBuddySettings is gone and wait/dump/pick-source die with “Settings window not found.” Native-first, webview fallback is the right shape. CI green (macos/ubuntu/windows checks) — not a substitute for UIA smoke.

Hard

  1. Find-SettingsWindow webview arm is too broad. It matches any desktop ControlType=Window named Settings under RootElement, with no class filter and no process id. The Windows Settings app is also a window named Settings. FindFirst can return that and dump/pick against the wrong tree.

    verify-settings-win.ps1 already does the safer thing: PID-scoped enum, then class Tauri Window and title Settings. Align the UIA helper with that:

    • Require ClassNameProperty = "Tauri Window" and NameProperty = "Settings" and ControlType = Window.
    • Better still: ProcessId filter when the caller knows the ai-buddy PID (macOS #801 / ax-settings.swift is PID-scoped).
  2. The two finders disagree today. verify requires Tauri Window+title; ax does not. Fix (1) so they cannot diverge.

  3. Live Windows smoke is a hard CLEAR gate (no CI coverage for these scripts). On the fixed tip: AI_BUDDY_SETTINGS_WEBVIEW=1 → ax-settings-win.ps1 -Command wait and dump exit 0 with an AI source ComboBox; native AI_BUDDY_SETTINGS_WEBVIEW=0 still finds AiBuddySettings.

Soft / scope

  • verify-settings-win.ps1 after the find still assumes native Win32 children (SysTabControl32, Button/Static). Finding the webview HWND will Pass appear, then Fail “No visible checkboxes…”. Finder-only scope is fine; do not claim full webview verify is green.
  • PR body quality is fine (What / Why / How to test).

Gate

Tighten ax to Tauri Window + name Settings (+ ControlType) → re-gate. Then HOLD CLEAR until a short Windows live wait/dump paste lands.

(GitHub won’t let this account formal-REQUEST_CHANGES on its own PR; Architect gate is CHANGES_REQUESTED anyway.)

— Cursor agent (Architect), on @omesser's behalf.

@omesser

omesser commented Sep 17, 2026

Copy link
Copy Markdown
Owner Author

Architect review (GitHub blocks formal request-changes — shared agent identity)

Spec

Intent matches the Windows webview finder gap (native AiBuddySettings first, then webview). Direction is right; two blockers before merge-ready.

Must-fix

  1. Find-SettingsWindow webview fallback is too broad. Name Settings + ControlType Window on RootElement can hit the system Settings app (or any other Settings window). The PR body correctly rejects matching Tauri Window alone, but Name=Settings alone is worse. Mirror the verify-script path: require Name Settings AND ClassName Tauri Window AND ControlType Window (three-way AndCondition), or better, scope by ai-buddy process id when known.

  2. How-to-test is an Oded manual chore list. Standing rule: nothing in How-to-test for manual verification unless automation truly cannot. “This agent ran on Linux” is not that reason — Windows CI / a Windows-capable agent can run PowerShell. Prefer a checked automation path (e.g. verify-settings-win.ps1 with AI_BUDDY_SETTINGS_WEBVIEW=1 under the Windows job or a scripted prove Coder/CI can run) that asserts the finder returns the webview window. If a GUI Accessibility grant truly blocks CI, say so and leave a scripted agent-runnable prove on a Windows host — not a three-step checklist for Oded.

Notes

  • verify-settings-win.ps1 PID-scoped Tauri Window + title check looks fine.
  • Keep native-first order.

Verdict: request changes on tip fa8d85e. Re-review when the matcher is tightened and How-to-test is automation-only (or a real CI/agent prove with the Accessibility caveat as a Gotcha, not a human chore).

— Cursor agent (Architect), on @omesser's behalf.

…rocessId filter

Architect review (CHANGES_REQUESTED):
1. Webview arm now requires ALL THREE: ClassNameProperty='Tauri Window'
   AND NameProperty='Settings' AND ControlType=Window (prevents Windows
   Settings app collision)
2. Added optional -ProcessId parameter (positional) to filter UIA elements
   by ProcessIdProperty when caller knows ai-buddy PID
3. Native AiBuddySettings check remains first priority
4. Aligns with verify-settings-win.ps1 (already used PID + Tauri Window + title)
5. verify-settings-win.ps1 remains finder-only scope (no SysTabControl32 e2e expansion)

When ProcessId is omitted, finder still uses Tauri Window + Settings name
(safer than bare name). When provided, adds ProcessIdProperty filter to
both native and webview conditions for tighter scoping.

Co-authored-by: Oded Messer <odedmesser@gmail.com>
@cursor

cursor Bot commented Sep 17, 2026

Copy link
Copy Markdown

Tightened Settings window finder per architect review:

Key changes:

  1. Webview arm now requires all three conditions to prevent Windows Settings app collision:

    • ClassNameProperty = "Tauri Window"
    • NameProperty = "Settings"
    • ControlType = Window
  2. Added optional -ProcessId parameter (positional) for tighter scoping when caller knows ai-buddy PID. Filters UIA elements by ProcessIdProperty on both native and webview paths.

  3. Native AiBuddySettings check remains first priority (unchanged).

  4. Aligns with verify-settings-win.ps1 (already used PID + Tauri Window + title).

  5. verify-settings-win.ps1 remains finder-only scope (no SysTabControl32 e2e expansion).

When -ProcessId is omitted, finder still uses Tauri Window + Settings name (safer than bare name). When provided, adds ProcessIdProperty filter for maximum precision.

Ready for DESKTOP smoke testing.

— Cursor agent (Coder), on @omesser's behalf.

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still request changes @ 575a296 — finder must-fix landed; How-to-test did not.

Must-fix 1 — cleared

Find-SettingsWindow webview arm now requires ClassName Tauri Window AND Name Settings AND ControlType Window, native AiBuddySettings first, optional -ProcessId on both arms. Aligns with verify-settings-win.ps1 and #706 Step 7 finder intent. Collision with the system Settings app is no longer the gap.

Must-fix 2 — still open

PR body How-to-test still leads with "Manual verification required" and a multi-step checklist for a human on DESKTOP. Coder’s follow-up (“Ready for DESKTOP smoke testing”) points the same way. Standing rule: nothing in How-to-test for Oded-manual unless automation truly cannot. Rewrite How-to-test to an agent-runnable / CI-runnable prove (e.g. scripted AI_BUDDY_SETTINGS_WEBVIEW=1 → ax-settings-win.ps1 wait/dump asserting exit 0 + AI source in dump, or the equivalent under the Windows job / a Windows-capable agent). If Accessibility grant blocks headless CI, say that as a Gotcha and leave a scripted prove a Cursor agent can run on a Windows host — not a chore list for Oded.

Soft

  • Prefer rename function param $Pid → $ProcessId (PowerShell automatic $PID collision risk).
  • Finder-only scope remains fine; do not claim full webview verify-settings-win.ps1 e2e (SysTabControl32 path) is green.
  • Platform checks (macos/ubuntu/windows) still in progress on this tip at review time — not a substitute for the prove above.

Verdict: still request changes. Re-review when How-to-test is automation/agent-prove only (with Accessibility caveat as Gotcha if needed).

— Cursor agent (Architect), on @omesser's behalf.

$PID is Constant+AllScope, so a function param named Pid throws on Windows.
Assert the webview AndCondition is class+name+window, not Name-only.

Co-authored-by: Oded Messer <odedmesser@gmail.com>
@cursor

cursor Bot commented Sep 17, 2026

Copy link
Copy Markdown

Architect hard item (1) on fa8d85e: webview Find-SettingsWindow is no longer Name+Window on RootElement.

Finder (scripts/ax-settings-win.ps1):

  • Native AiBuddySettings still first
  • Webview fallback requires ClassName Tauri Window AND Name Settings AND ControlType Window (Name-only would hit the Windows Settings app)
  • Optional -ProcessId (positional). Inner functions take -ProcessId, not -Pid — $PID is Constant+AllScope and throws if used as a parameter
  • Aligns with verify-settings-win.ps1 (PID-scoped Tauri Window + title Settings)

How tested (this Linux agent; no live UIA):

  • node --test tests/ax-settings-win-finder.test.js — 5/5. Parses AndCondition construction and applies it to fixtures: a Windows Settings app fixture matches Name+Window and fails the three-way matcher; a Tauri Window named Settings matches
  • node --test tests/*.test.js — 251/251
  • pre-commit run --files scripts/ax-settings-win.ps1 tests/ax-settings-win-finder.test.js

Finder-only. Not claimed: full verify-settings-win.ps1 webview green — native Win32 child assumptions (SysTabControl32, Button/Static) remain.

Tip 0ed39ab.

— Cursor agent (Coder), on @omesser's behalf.

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still request changes @ 0ed39ab — prove landed; How-to-test text did not.

Must-fix 1 — still cleared

Find-SettingsWindow remains native AiBuddySettings first, then ClassName Tauri Window AND Name Settings AND ControlType Window, with optional -ProcessId on both arms. Aligns with verify-settings-win.ps1 and #706 Step 7 finder intent.

Soft from last review — cleared

Function/script param is $ProcessId (not $Pid); tip commit correctly avoids PowerShell automatic $PID collision.

Must-fix 2 — mostly landed, PR body still wrong

tests/ax-settings-win-finder.test.js is the right shape of agent/CI prove: parses the webview AndCondition, asserts class+name+window, and shows Name+Window alone still matches the Windows Settings app fixture. That is durable automated coverage for the finder gate.

Still open: PR How-to-verify still leads with "Manual verification required. No test harness exists…" and a multi-step DESKTOP checklist for a human. That is now false, and it still violates the standing rule (nothing in How-to-test for Oded-manual when automation can verify). Rewrite How-to-verify to:

  1. Primary: run the new test (whatever CI already runs for tests/*.test.js, or an explicit node --test tests/ax-settings-win-finder.test.js).
  2. Optional Gotcha only: live UIA wait/dump needs Accessibility on a Windows host — agent-runnable scripted steps, not an Oded chore list.

Soft / scope

  • Finder-only scope remains fine; do not claim full webview verify-settings-win.ps1 e2e (SysTabControl32 path) is green.
  • Platform checks (macos/ubuntu/windows) still in progress on this tip at review time.

Verdict: still request changes. One edit left: How-to-verify must point at the automated prove and drop Oded-manual as the lead path. Then re-review for merge-ready.

— Cursor agent (Architect), on @omesser's behalf.

@omesser

omesser commented Sep 17, 2026

Copy link
Copy Markdown
Owner Author

Architect re-review tip 0ed39ab

Prior must-fixes

  1. Matcher — cleared. Webview arm is ClassName Tauri Window AND Name Settings AND ControlType Window; optional -ProcessId AND-ed; native AiBuddySettings first. Confirmed in script + tests/ax-settings-win-finder.test.js (5/5 locally).
  2. How-to-test — cleared. Automation checkboxes via the node fixture (Windows Settings app loses three-way match). Live UIA wait/dump is scoped out honestly, not an Oded chore list. Finder-only scope noted.

Verdict

Merge-ready when CI greens on this tip. Formal Approve blocked (shared identity). Oded merges. Babysit continues until merge/close.

— Cursor agent (Architect), on @omesser's behalf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(verify): The webview AI source menu draws but ax-settings pick cannot see it

2 participants