Files
minesweeper/sidecar
pastilhasandClaude Opus 5 34fad8be35 refuse a command when a dialog is in the way
Found by `POST /difficulty` failing three times against a "you have the fastest
time for intermediate level" prompt that had been sitting there waiting for a
name.

Failing was not the problem. What the three attempts DID was: a modal dialog
swallows the click meant for the menu bar, the menu never opens, and the second
click — aimed at where a menu item would have been — lands on the BOARD. Three
times. On a live game that reveals cells and can lose it.

So both commands now look for any named top-level window that is not the game,
and refuse with its title rather than clicking harder. Named windows only, since
wine litters the display with 1x1 stubs.

Verified against a real one: with the Open Recording dialog up, both
/difficulty and /replay return `"Open Recording" is open on the board — dismiss
it first`, and the board is untouched.

The lesson generalises past this plugin: driving another program's UI by
synthetic clicks means every command needs to check the world is still the shape
it assumed. A retry loop without that check is not resilience, it is the same
mistake three times.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Officer-Session: de3ed4e6-f88a-429c-94e6-a760336ba83b
2026-08-23 23:34:05 +00:00
..