Skip to content

fix(cua-driver): bound Linux snapshots after app exit - #2822

Merged
f-trycua merged 1 commit into
trycua:mainfrom
aryasaatvik:fix/linux-atspi-zombie-snapshots
Aug 4, 2026
Merged

fix(cua-driver): bound Linux snapshots after app exit#2822
f-trycua merged 1 commit into
trycua:mainfrom
aryasaatvik:fix/linux-atspi-zombie-snapshots

Conversation

@aryasaatvik

@aryasaatvik aryasaatvik commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Prevent Linux snapshots from accepting exited or mismatched GUI targets and keep AT-SPI traversal plus geometry resolution within one operation deadline.

Root cause

A zombie remains present under /proc until reaped, so PID existence alone does not prove a process is usable. A PID can also be recycled after exit, making a live-process check insufficient unless the requested X11 window still belongs to that PID. Separately, traversal and bounds collection could each consume timeout budget unless they share one absolute deadline.

Changes

  • treat /proc states Z (zombie), X (dead), missing, and malformed status as non-live
  • filter non-live windows from list_windows
  • reject get_window_state before AT-SPI when the process is non-live or the current X11 window owner does not match the requested PID; revalidate Wayland targets against current enumeration
  • use one absolute Tokio deadline across AT-SPI traversal and bounds collection
  • add deterministic status parsing, real fork/zombie/reap lifecycle, mismatched-owner, and paused-time shared-budget tests
  • add a typed hosted GTK3 X11/AT-SPI regression that snapshots a healthy app, exits it, proves the stale target fails in under one second, and then snapshots a fresh app successfully; bind its behavior recording to the fresh-app recovery snapshot

Integration

The final candidate is rebased onto the merged AT-SPI application-selection fix. The one overlapping test-module conflict was resolved by retaining its duplicate-application and enabled-state coverage alongside this PR's one-deadline traversal/bounds test; production behavior from both changes remains intact.

Validation

Final candidate: d7b44e09a9bed624b075e253889a81ba8f3da69e

  • cargo fmt --manifest-path libs/cua-driver/rust/Cargo.toml --all -- --check
  • git diff --check
  • hosted Linux unit/compile passed at the final candidate, including the deterministic liveness and shared-deadline coverage
  • authoritative exact-candidate native run 30912689445 passed:
    • GTK3: 37 passed, 0 failed
    • strict GTK4 target selection: 1 passed, 0 failed
    • typed report: 32 delivered, 7 intentional refusals, 0 failed, 0 skipped
    • linux-gtk3-stale-target-recovery-ax-not-applicable delivered with the AX-state oracle and bound trajectory video
    • no-overlay contract, all videos, and matrix summary passed
  • regular PR checks passed for Linux and Windows unit/compile, all hosted Rustfmt targets, generated contract/client parity, release metadata, docs sync, contributor attribution, Nix compositor/package/policy lanes; final Nix Rust unit completion is retained as the last merge gate

Scope

Linux process/window liveness and AT-SPI snapshot budgeting only. This intentionally does not alter AT-SPI application candidate selection or other Linux input/capture behavior.

Authorship

Preserves Saatvik Arya as commit and squash author; adaptation is credited by the existing Francesco coauthor trailer.

@aryasaatvik
aryasaatvik marked this pull request as ready for review August 3, 2026 19:09
@aryasaatvik
aryasaatvik requested a review from f-trycua as a code owner August 3, 2026 19:09
@f-trycua
f-trycua marked this pull request as draft August 4, 2026 10:29
@f-trycua
f-trycua force-pushed the fix/linux-atspi-zombie-snapshots branch 4 times, most recently from 9731c7b to 344790d Compare August 4, 2026 12:12
Reject dead and mismatched Linux window targets before AT-SPI, and keep one absolute timeout across traversal and geometry collection.

Add deterministic process-state, real-zombie, PID-owner, shared-budget, and hosted GTK3 stale-target recovery coverage.

Co-authored-by: Francesco Bonacci <f@trycua.com>
@f-trycua
f-trycua force-pushed the fix/linux-atspi-zombie-snapshots branch from 344790d to d7b44e0 Compare August 4, 2026 13:11
@f-trycua
f-trycua marked this pull request as ready for review August 4, 2026 13:28
@f-trycua
f-trycua merged commit d1c5a7a into trycua:main Aug 4, 2026
24 checks passed
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.

2 participants