Skip to content

fix(scenarios): Get the Windows possession-live leaf passing on a desktop - #2136

Merged
omesser merged 9 commits into
mainfrom
cursor/possession-live-notepad-hwnd-bf49
Nov 6, 2026
Merged

omesser merged 9 commits into
mainfrom
cursor/possession-live-notepad-hwnd-bf49

Conversation

@omesser

@omesser omesser commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Why

The Windows possession-live leaf never passed on a desktop, so possession on Windows had no live proof (#1927). Live runs on DESKTOP-UQIE144 found six separate leaf bugs, each failing a different step. None of them was an app bug.

Step that failed Cause Fix
Finding Notepad Windows 11 Store Notepad is two processes, and the pid Start-Process returns owns no window. Match the visible, uncloaked window whose title holds the scratch file name, and take its owner.
The Possess click Greet chains to patrol, which walks BMO off the spot the click aims at. Run a copy of BMO with every ambient behavior weight at 0 except fidget, the same rewrite New-StillCharacters uses.
The click into Notepad Notepad opened on the second display behind a Chrome window, so the click went to Chrome. Bring Notepad to the front once it is found, with the pill leaf's Bring. Before the click, fail with the covering process's name if the window at the click point is not Notepad's.
Reading the paused card The one UIA dump held the overlay's Web content pane with none of the card in it. Poll the dump for up to 3 s, as the x11 leaf does.
The card click The click went out before click-through turned off, so it fell through the overlay. Wait for the hit-test line at the card point to report click-through OFF.
Right after Possess, and Escape after the card A key sent before the Shell's follow-up pill open SetForegroundWindow raise loses its keydown. The trace shows right up or escape up with no matching down. The Possess wait also matched the menu's own window focus, which comes before possession. Send keys only after that raise is traced.

What changed

Only scripts/scenarios/manual-only/possession-live.win.ps1. FIDGET_SCENARIO_STILL_MANIFEST prints the still-BMO rewrite and exits, so the weight rule can be checked without a desktop. No Engine, Shell, macOS or X11 change.

How to verify

On a Windows desktop where Notepad is not already open:

cargo run -p fidget-verify -- scenario possession-live --go

At 6bb8a901 on DESKTOP-UQIE144 it passed 3/3, at about 6 s a run. 92131219 tightens two of those waits after review: a raise has to log -> 1, and the card wait counts new click-through OFF lines. It passed 3/3 live too. Fixture mode still passes.

Notes

At 366d7275, one run in three exited before process.log appeared, with an empty app.err. It did not recur in the nine runs after that, and this change does not explain it.

PSScriptAnalyzer and codespell are not installed on the host. CI's ubuntu job runs both.

— Claude Code agent (Opus), on @omesser's behalf.

cursoragent and others added 2 commits November 5, 2026 17:56
Store Notepad's Start-Process pid never owns the window. Match the open
document, then take that window's process.

Co-authored-by: Oded Messer <odedmesser@gmail.com>
A cloaked window still reports visible, so the first title hit can be the
wrong hwnd. The focus check uses the same owner read.

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

This comment was marked as outdated.

cursoragent and others added 2 commits November 5, 2026 18:15
Cleanup stops the Notepad this run found and the process Start-Process
returned. A title match owned by something else is cleared before Fail.

Co-authored-by: Oded Messer <odedmesser@gmail.com>
Swallowing that error skipped the process. The leaf already let it throw.

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

This comment was marked as outdated.

ax-window waits for a hit-test line before the Possess click. The leaf never turned that trace on.

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

This comment was marked as outdated.

cursoragent and others added 2 commits November 5, 2026 21:29
Greet chains to a patrol as soon as BMO lands, so the click aims at a spot
the sprite has left. Ambient behaviors other than fidget stay at weight 0.

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

This comment was marked as outdated.

Four live-run failures on DESKTOP-UQIE144, each a leaf timing or setup gap:
raise Notepad and check the click point is Notepad's, poll the card dump,
wait for click-through over the card, and send keys only after the Shell's
post-possession and post-resume raise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omesser omesser changed the title fix(scenarios): Find Windows Notepad by the document title fix(scenarios): Get the Windows possession-live leaf passing on a desktop Nov 6, 2026
@omesser

omesser commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Live run on DESKTOP-UQIE144

Tip 6bb8a901: cargo run -p fidget-verify -- scenario possession-live --go, three runs back to back.

Run Result Evidence dir (local)
1 PASS, 5977 ms fidget-scenario-possession-live-20261106-090942
2 PASS, 6030 ms fidget-scenario-possession-live-20261106-090951
3 PASS, 5982 ms fidget-scenario-possession-live-20261106-090959

Every run printed every ok: line. Those cover possession, Right walking the sprite with the jump held, the card click resuming, Escape releasing, and the letter landing.

The sets before this one show how the fixes got here. Each set failed at a later step than the one before.

Tree Result First failing step
366d7275 0/3 One early exit (no process.log), then the card dump twice
+ card poll 0/3 Notepad did not take focus. Notepad had opened on display 2, behind Chrome.
+ Bring Notepad, card click waits 2/3 the held Right did not walk. right down was lost before the post-possession raise.
+ wait for the raise (6bb8a901) 3/3 none

Fixture mode passes, and the script parses. PSScriptAnalyzer is not installed on this host, so CI's ubuntu job lints it.

Asking for a new Soft-gate.

— Claude Code agent (Opus), on @omesser's behalf.

omesser

This comment was marked as outdated.

…ough line

Review follow-ups: the header names the Notepad raise and the new failure
paths, a refused SetForegroundWindow (-> 0) no longer counts as the overlay
taking the keyboard, the card wait counts fresh click-through OFF lines
instead of matching exact coordinates, and a covering window with no process
name still names its pid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

Soft Open

Tip: 92131219

What changed

  • Stricter waits: the raise wait now needs a successful -> 1 SetForegroundWindow line, and the card wait counts new click-through OFF lines.

What is wrong

  • No live run at this tip: the body says 92131219 has not run on a desktop. The 3/3 pass was at 6bb8a901, and this tip changes the waits that gate the keys and the card click.

Soft-FIX

  • Live proof: run possession-live --go on DESKTOP-UQIE144 at this tip and record the result in the body.

Non-blocking

  • Card wait lost its point check: any new click-through OFF line now passes, even one not at the card's coordinates. Keeping the cursor match with the count would be tighter.

Verified by reading the diff against 6bb8a901 and the PR body.

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

@omesser

omesser commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Live run at the new tip

Tip 92131219 (review follow-ups), cargo run -p fidget-verify -- scenario possession-live --go on DESKTOP-UQIE144, three runs back to back:

Run Result Evidence dir (local)
1 PASS, 6032 ms fidget-scenario-possession-live-20261106-091755
2 PASS, 6036 ms fidget-scenario-possession-live-20261106-091804
3 PASS, 6004 ms fidget-scenario-possession-live-20261106-091812

Every ok: line printed in every run. That makes six live passes in a row across 6bb8a901 and 92131219.

— Claude Code agent (Opus), on @omesser's behalf.

@omesser
omesser merged commit 92c16e5 into main Nov 6, 2026
10 checks passed
@omesser omesser added windows Run the Windows compile job on this pull request testing Tests and verification scenarios labels Nov 6, 2026
@omesser
omesser deleted the cursor/possession-live-notepad-hwnd-bf49 branch November 6, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Tests and verification scenarios windows Run the Windows compile job on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants