Skip to content

fix(computer): evict reindexed window caches, match non-Darwin app title suffixes, and note Windows PostMessage hotkeys - #1094

Merged
jeffrey-bin merged 1 commit into
mainfrom
fix/cua-3os-pr7-reindex-cache-win-ergonomics
Dec 3, 2026
Merged

jeffrey-bin merged 1 commit into
mainfrom
fix/cua-3os-pr7-reindex-cache-win-ergonomics

Conversation

@jeffrey-bin

Copy link
Copy Markdown
Contributor

What and why

Final small ergonomics & cache-correctness PR from our 3-OS real-machine CUA verification (single commit 7703bab83 on main 8f52ed715):

  • Evict reindexed partial diffs from ui_exec window cache (runtime.mjs):
    • When get_window_state returns a reindexed partial diff, evict windowRowCaches so the next observe() (or an auto-diffed observe() / no_change readback, while preserving trailing post-action notes) fetches a complete tree with true shifted element indices instead of reusing stale indices.
  • Non-Darwin trailing title-suffix matching in ui.app() (runtime.mjs):
    • On Windows and Linux, fall back to matching trailing " - <app>" / " — <app>" window title segments when app_name and exact titles miss (excluding browsers, terminals, code editors, Explorer, and 1-char targets to avoid false matches like "notes.md — VS Code").
  • Windows WinUI 3 PostMessage modifier hotkey note (cua.go, cua_windows_policy.go):
    • When a Windows multi-key hotkey, modified press_key, or run_actions batch containing one is delivered via PostMessage, append a single trailing note after the final post-action readback warning that WinUI 3 apps can ignore background modifier state.
  • Documentation & tests (apps/computer/local-daemon/README.md, runtime_test.go, cua_mac_overhaul_test.go):
    • Update README.md for all three behaviors and add cross-platform Go unit tests (TestWindowsPostMessageHotkeyNote and uiruntime tests) covering reindexed eviction, non-Darwin suffix matching/exclusions, and Windows PostMessage hotkey detection.

How it was verified

  • make check-repository-gate BASE=origin/main (PASS: commitlint, env inventory, Prettier, English-only/CJK, doc links, changelog)
  • golangci-lint run --new-from-rev=origin/main ./... (0 issues)
  • 3-OS compile (darwin/arm64, windows/amd64, linux/amd64 go test -c ./internal/linger/localtools)
  • go test -race ./internal/uiruntime + go test -race -run TestWindowsPostMessageHotkeyNote ./internal/linger/localtools (PASS)
  • Bounded 2-round adversarial review against all 4 dimensions: 0 P0 / 0 P1
  • Contracts regenerated (not applicable: no contracts/openapi/ changes)

Boundary

  • No external contract, env variable, or user-message-to-provider_ready critical-path changes.

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approve with nits (1 P2, 1 P3) · merge base 8f52ed7 · 1 commit, 6 files

Findings

P2 · apps/computer/local-daemon/internal/uiruntime/runtime.mjs:535 — parseWindowView does not drop removed - [N] rows for header-only since_status=reindexed diffs. When since_status=reindexed arrives without since_status=diff or a since <id>: line on a non-fallback path (fallbackOnReindexed = false, such as macOS run_actions at cua.go:3009 or explicit observe({since})), isDiff is false while reindexed is true, so line 535 keeps removed - [N] rows in parsed.rows under the new snapshotId and lets a subsequent v.click(...) target a deleted or shifted index. Also on line 561, || reindexed in isFullOrReindexed is dead code because line 557 already deletes the cache whenever reindexed is true. Include reindexed in the diff-line handling (isDiff || reindexed at lines 523, 535, and 548) and remove the dead || reindexed on line 561.

P3 · apps/computer/local-daemon/internal/linger/localtools/cua.go:2235 — isChordKeyString misclassifies trailing-plus chords like "ctrl++" as single keys. For raw press_key({key: "ctrl++"}) (which normalizeWindowsKeyCombo in cua_windows_policy.go:137 explicitly supports for zoom-in), strings.Split(s, "+") yields ["ctrl", "", ""] (1 non-empty segment), returning false and omitting windowsPostMessageHotkeyNote when delivered via PostMessage. Handle trailing "++" (or share a chord-splitting helper with normalizeWindowsKeyCombo).

Checked: withoutStructured strips structuredContent (cua.go:2662) · runActions single trailing note (cua.go:3082) · compactHelpText 100-byte hotkey budget (ui_runtime.go:1095)

Unverified: live Windows cua-driver "via PostMessage" receipt string · Windows test execution of localtools and uiruntime

CI: all 8 checks passed; Windows CI only compiles localtools and uiruntime


Automated review of 7703bab by Antigravity.

…tle suffixes, and note Windows PostMessage hotkeys
@jeffrey-bin
jeffrey-bin force-pushed the fix/cua-3os-pr7-reindex-cache-win-ergonomics branch from 7703bab to e20324a Compare December 2, 2026 23:53
@jeffrey-bin

Copy link
Copy Markdown
Contributor Author

Addressed both nits from the review in commit e20324a9c:

  1. P2 header-only since_status=reindexed removed rows (runtime.mjs): Treated isDiffView = isDiff || reindexed when dropping removed ranges / - [N] rows and normalizing + / ~ prefixes in parseWindowView, removed the dead || reindexed branch on isFullRead, and added a regression test in runtime_test.go verifying removed - [1] rows are dropped while live + [2] rows remain clickable.
  2. P3 trailing-plus chord key strings (cua.go): Handled trailing ++ chords (e.g., "ctrl++") in isChordKeyString (matching normalizeWindowsKeyCombo) while still rejecting bare "+" / "++", with regression assertions in TestWindowsPostMessageHotkeyNote.

Verified locally: golangci-lint run --new-from-rev=origin/main ./..., 3-OS go test -c, go test -race ./internal/uiruntime, go test -race -run TestWindowsPostMessageHotkeyNote ./internal/linger/localtools, and make check-repository-gate BASE=origin/main all PASS.

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approve · follow-up on 7703bab · merge base 8f52ed7 · 1 commit, 6 files

Resolved: header-only reindexed removed rows (runtime.mjs:522, runtime_test.go:4033) · trailing-plus chord detection (cua.go:2244, cua_mac_overhaul_test.go:5203)

Checked: withoutStructured strips structuredContent (cua.go:2675) · runActions single trailing note (cua.go:3097) · compactHelpText 100-byte budget (ui_runtime.go:1095)

Unverified: live Windows cua-driver "via PostMessage" receipt string · Windows test execution of localtools and uiruntime

CI: all 8 checks passed; Windows CI only compiles localtools and uiruntime


Automated review of e20324a by Antigravity.

@jeffrey-bin
jeffrey-bin added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 8d61cb5 Dec 3, 2026
17 checks passed
@jeffrey-bin
jeffrey-bin deleted the fix/cua-3os-pr7-reindex-cache-win-ergonomics branch December 3, 2026 00:11
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