Skip to content

fix: re-read a restored window until the Dock animation ends - #22

Merged
iamnbutler merged 1 commit into
mainfrom
restore-readback
Oct 15, 2026
Merged

iamnbutler merged 1 commit into
mainfrom
restore-readback

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

In the Ace desktop tools study (githubnext/ace#427, D9b), restoring a minimized TextEdit window reported outcome unknown with "The confirmed window mutation could not prove its requested postcondition." An observation right after showed the window restored, on screen and active.

Cause. For an exact minimized restore, the service sets AXMinimized false once, then "confirms" by repinning the WindowServer bounds. Minimizing leaves those bounds unchanged, so it returns at once. The bridge's single readback (windowMutationResponse) then sees the WindowServer row still off screen, falls back to an Accessibility scan, and that scan still reports the window minimized while the Dock's unminimize animation (about 0.3–0.5 s) runs. validatePostMutationWindow throws receiptMismatch("post-mutation window postcondition"), which the bridge maps to indeterminate.

Fix. A new last patch, peekaboo-restore.patch, moves the readback and validation into a helper and reads again only when a restoreWindow readback fails that requested-state postcondition, at most 8 times 100 ms apart (same shape as #19). Each read posts no input and repeats the full identity, process-generation and bounds validation. Identity, lookup and continuity failures fail on the first read, and a window that stays minimized for the whole bound still ends unknown. It is appended to src/build.ts (and dist/build.js) so the existing stack stays a valid prefix; the README documents it.

Verification

  • node dist/build.js --out … --scratch … builds with the full stack.
  • With the full stack: PeekabooCore swift test --filter "PeekabooBridgeHandlerMutationSemanticsTests|PeekabooTests.PeekabooBridgeTests" passes (97 swift-testing), including the new test "confirmed restore reads a still minimized window again until its postcondition holds" (minimized, minimized, restored completes after 3 reads; persistently minimized stays indeterminate after 9).
  • npm run check (dist matches tsc).
  • No live window operations: another agent was using the screen. A live restore of a minimized TextEdit window still needs checking.

Restoring a minimized TextEdit window reported outcome unknown with "The
confirmed window mutation could not prove its requested postcondition."
although the window was restored, on screen and active right after
(githubnext/ace#427, D9b). The service confirms an exact minimized restore
by repinning WindowServer bounds, which minimizing leaves unchanged, so it
returns at once; the bridge's single readback then falls back to an
Accessibility scan that still reports the window minimized while the Dock's
unminimize animation runs.

A new last patch, peekaboo-restore.patch, reads the window again only when a
restoreWindow readback fails its requested-state postcondition, at most 8
times 100 ms apart. Each read posts no input and repeats the full identity,
process-generation and bounds validation; identity and lookup failures and a
window that stays minimized remain indeterminate.

Why: native/patches/peekaboo-restore.patch | Only the read-only restore postcondition mismatch is re-read; identity failures and a window that stays minimized stay indeterminate.
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