Skip to content

Windows: switch_app, Store-app controls, and a writer through agent CLIs - #63

Open
Ancorro wants to merge 2 commits into
awlevin:mainfrom
Ancorro:windows-switch-app
Open

Ancorro wants to merge 2 commits into
awlevin:mainfrom
Ancorro:windows-switch-app

Conversation

@Ancorro

@Ancorro Ancorro commented Oct 2, 2026 •

Copy link
Copy Markdown

Two Windows changes that together let the loop finish a goal outside the browser, plus a writer that needs no API key. Found on Windows 11 with two monitors, goal compute 6 times 7 with Chrome in front.

switch_app

The only way to leave the frontmost window was use_browser, so a goal for another app had no move: the classifier typed into the page or stopped.

  • New kind switch_app and question app: the other open windows by title, plus a few apps it may start (Calculator, Notepad, File Explorer, Paint). The state also gets other_windows_and_apps.
  • Offered only when desktop.windows() lists something. macos.py and OSWorldDesktop return [], so their payloads are unchanged (stubs added to keep the Desktop protocol whole).
  • Windows ignores SetForegroundWindow from a background process. switch_to attaches to the foreground thread's input first, then falls back to an Alt tap, and checks it took.
  • Windows are matched by window, not process. Store apps run in ApplicationFrameHost.exe, so only the title names them. Minimized windows are kept; cloaked and tool windows are skipped.
  • A window off the primary monitor is moved onto it, since only the primary is captured.
  • Confidence is min(kind, app), as for clicks.

Accessibility walk: Store-app controls

subtree_key keyed nodes with no role and no label. In Calculator the content pane (NavView) has the same frame as an empty ApplicationFrameInputSinkWindow pane walked just before it, so the content pane was skipped as a duplicate along with every button in it. The app read as minimize/maximize/close only (ax=3). Nodes with neither role nor label are no longer keyed. On macOS every node has a role, so it is unaffected. New test: test_two_bare_containers_sharing_a_frame_are_both_walked (fails before the change).

Replay notes

  • Before: step 2 after switching to Calculator: items=8 ax=3, kind click_item 0.48 on 'CE', then a stop at confidence 0.27. An earlier run, with the window still on the second monitor, bounced between Calculator and Chrome for 10 steps.
  • After: items=42 ax=37. Starting from Explorer: switch_app (0.88) to Calculator, then pressed Six, Seven, Multiply by, Equals, saw Display is 4,489, pressed Clear, redid Six × Seven =, and stopped on done (0.99) with Display is 42. 11 steps, 1.4s of classifier time.

Writer through a signed-in agent CLI

The writer needed an Anthropic or OpenAI-compatible key. CLICKER_WRITER_API=claude-code|codex|opencode (new cli_writer.py) sends the same requests to that agent's headless CLI on the user's existing login instead: one run per call, no tools, no saved session, read-only.

  • Claude Code: claude -p with stream-json input (screenshot inline) and --json-schema; reads structured_output.
  • Codex: codex exec --ephemeral -s read-only with -i for the screenshot, --output-schema, and -o for the last message.
  • OpenCode: opencode run --format json with -f; reads the last text event. On Windows without opencode on PATH it goes through wsl.exe.
  • Writing (text to type, URLs) uses a small fast model; answering reads the screenshot with one that sees images. Defaults: Claude haiku / sonnet; Codex gpt-6-luna at low reasoning effort / its configured model; OpenCode nemotron-3.5-lightning-free / mimo-v2.6-flash-free. CLICKER_WRITER_MODEL and CLICKER_ANSWER_MODEL override.
  • Each call cold-starts the CLI: about 4–10s. Live: "add a USB-C cable to my cart on eBay" with the Claude Code writer added an item in 16 steps on Windows.

Checks

ruff check ., ruff format --check . and pytest -q (754 passed, 3 skipped, 1 xfailed) on Linux. The Windows code was exercised live as above, but not under pytest on Windows: the suite's machine guard trips there on an existing test (test_pending_abort_after_a_decision_prevents_dispatch, before these changes too).

🤖 Generated with Claude Code

Ancorro and others added 2 commits October 1, 2026 22:03
…ty walk

The loop could only work in the frontmost window, and its one way elsewhere was
use_browser. A goal for another app ("compute 6 times 7" with Chrome in front)
had no move, so the classifier typed into the page or stopped.

switch_app brings another open window forward, or starts one of a few common
apps, chosen in a new app question listing the windows by title. It is offered
only when the adapter lists windows: Windows does; macOS and the OSWorld VM
return none, so their payloads are unchanged. Windows refuses
SetForegroundWindow to a process that is not in front, so the adapter attaches
to the foreground thread's input, then falls back to an Alt tap. A window off
the primary monitor is moved onto it, since only that one is captured.

subtree_key no longer keys a node with no role and no label. In Calculator the
content pane shares its frame with an empty input-sink pane walked before it;
keyed alike, the content pane was dropped as a duplicate with every button in
it, and the app read as three title-bar buttons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLICKER_WRITER_API=claude-code|codex|opencode sends the writer's requests to
that agent's headless CLI on its own login, so no API key is needed. Writing
(text, URLs) uses a small fast model; answering reads the screenshot with a
model that sees images. CLICKER_WRITER_MODEL / CLICKER_ANSWER_MODEL override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Ancorro Ancorro changed the title Windows: switch_app action, and Store-app controls in the accessibility walk Windows: switch_app, Store-app controls, and a writer through agent CLIs Oct 2, 2026
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.

1 participant