Repository navigation
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
louistiti
force-pushed
the
fix/gnome-window-snapshot-decoding
branch
from
October 7, 2026 08:46
613e10e to
69476a4
Compare
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
louistiti
marked this pull request as ready for review
October 7, 2026 08:50
Collaborator
|
Thanks for the PR. I've labelled and assigned it for review. CI and the CLA check will run on the branch; please sign the CLA if the bot asks, and we'll follow up with review comments. |
6 of 7 tasks
cursor Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
Parse the typed GetRects reply as raw JSON instead of slicing a bracket span, and reuse that parser for focus. Salvaged from #4809, including the malformed-snapshot fixtures and the Nix dbus check input. Co-authored-by: injaneity <[email protected]>
f-trycua
added a commit
that referenced
this pull request
Oct 8, 2026
…er (#4879) * perf(cua-driver): reuse one session-bus connection for the GNOME helper Every WinRects call spawned a gdbus subprocess, and owner attestation alone makes three D-Bus calls before the real one. A live preview pays that on every frame. Replace the subprocess with one zbus connection on a dedicated single-thread Tokio runtime, so callers inside or outside Tokio can block on it without nesting runtimes. Bodies are typed on the wire, and replies keep the textual shape the existing parsers read (GetRects now arrives as raw JSON, which also avoids gdbus quoting). A timeout or transport error drops the connection and the next call reconnects; a mutation is never replayed. An error reply, such as no helper on the bus, keeps the connection. T3 Code measured window capture going from 381 ms to 58 ms with this transport. Ported from their Linux patch to Cua Driver 0.34.0 (pingdotgg/t3code#16975, MIT, Copyright (c) 2026 T3 Tools Inc.); the reply-versus-transport split is new here. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(cua-driver): cover GetRects titles gdbus would have escaped Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(cua-driver): strict GetRects parsing and run the bus test in Nix Parse the typed GetRects reply as raw JSON instead of slicing a bracket span, and reuse that parser for focus. Salvaged from #4809, including the malformed-snapshot fixtures and the Nix dbus check input. Co-authored-by: injaneity <[email protected]> * test(cua-driver): start the private test bus from its own config dbus-daemon --session needs the system session.conf, which the Nix build sandbox lacks; the daemon then exits without an address. Write a minimal session config listening in a temp dir instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Louis Grenard <[email protected]>
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetRectsas its declared D-Bus string using the existingzbusdependency. Parse the decoded JSON directly for listing, geometry, trusted window lookup and focus verification. Preserve the verified unique helper owner, browser-helper version checks and bounded call behavior. Declare D-Bus as a native test dependency in the Nix unit-check derivation so the private-session transport test can execute in its sandbox.Reproduction and user impact
On GNOME/Wayland with the WinRects helper active:
Tomorrow's meeting.GetRectsstill returns both windows, butgdbus callrenders the JSON inside a GVariant string with an additional escaping layer. The existing first-[/last-]extraction leaves that escaping intact, soserde_jsonrejects the entire snapshot before PID filtering.Plain titleand repeat: the parser succeeds.This pattern was observed in a real GNOME session: punctuation in a terminal title broke discovery and window targeting for an unrelated Feishu window. Titles and IDs above are synthetic. No private session data is included.
A headless reproduction using GLib-generated GVariant replies and the actual upstream Rust
parse_window_originfunction confirms the bug in bothcua-driver-rs-v0.34.0and current main:Plain title(14, 12)(14, 12)Tomorrow's meeting(14, 12)NoneA "quoted" title(14, 12)None飞书(14, 12)(14, 12)The replacement regression uses a mock D-Bus service and checks that punctuation, backslashes, newlines and Unicode survive the transport, and that a separate target window can still be filtered and located.
Before / after illustration
These AI-generated diagrams explain the reproduced parser behavior. They are not desktop screenshots or evidence of a live Feishu replay. The desktop stays visible in both; only authoritative window metadata becomes unavailable/available. Assets live on a separate fork branch and are not part of the source diff.
Related work
No duplicate parsing fix was found in the reviewed open and closed PRs. #2995 changes GNOME compatibility/geometry but retains display-text parsing; #4011 changes cursor dispatch; #3887 addresses fractional scaling. This PR does not resolve those separate issues.
RFC: not required; this repairs decoding of an existing native D-Bus reply without changing a public SDK, CLI, MCP, helper protocol, compatibility policy or permission boundary. This is a small, unselected contribution pending maintainer review.
Compatibility and risk
GetRects() -> stringcontaining JSON.Validation
Candidate:
7dc974445297fd0408878efe520651c963cc6670, based on maina7524cfd1d3e959963b43954d43f27c4bd260f08. Rust 1.97.1; no dependency changes.The original Rust checks below ran on
613e10ea97d637de9e16af20f2f4d53b2c5b326f. Commit69476a44bdcc69512f05806c9e7f08b10244025dcorrected only the committer identity/signature and retained its tree. The current candidate adds onlynativeCheckInputs = [ pkgs.dbus ];and its explanatory comment in the Nix unit-test derivation; all Rust sources remain identical. GitHub verifies both follow-up signatures as valid.cargo fmt --all -- --checkandgit diff --check: passed.cargo test --locked -p platform-linux --lib wayland::shell_helper::tests -- --nocapture: eight ordinary tests passed; the private-bus child regression also passed.cargo test --locked -p platform-linux --lib: 637 passed, one failed, 11 ignored. The normal private-bus regression passed and invokes its ignored transport owner test underdbus-run-session; CI's whole-crate test command therefore exercises the regression without a desktop bus or extra runner filter.cargo test --locked -p platform-linux --all-targets -- --test-threads=1: the same unchangedoverlay::tests::unreported_arrival_releases_the_waiter_after_the_capassertion failed atoverlay.rs:3853. The overlay test also failed when rerun alone with--exact. Cargo stopped after the library suite, so subsequent targets are not claimed as passing.cargo clippy --locked -p platform-linux --lib --tests --no-deps -- -D warnings: failed on six distinct diagnostics in unchangedtools/impl_.rs,input/mod.rs,wayland/mod.rsandwayland/hyprland.rs(11 emitted diagnostics across targets). None points to the changed helper. No clean lint pass is claimed.69476a4: the ordinary Linux Rust job passed, includingtyped_window_snapshot_runs_on_private_bus. The Nix unit job stopped before decoder assertions becausedbus-run-sessionwas absent (637 passed, 1 failed, 11 ignored). The previously observed local overlay failure passed in CI. The current candidate supplies the missing executable as a check-only dependency and keeps the transport regression enabled.7dc9744:nixfmt --check nix/cua-driver/tests/rust-unit.nix,cargo fmt --all -- --check, andgit diff --checkpassed. Nix is unavailable locally. The new Nix CI run is awaiting upstream maintainer approval for the fork update; no successful Nix result is claimed yet.Contributor and release checks
no-releasedoes not apply.Agent assistance was used for investigation, drafting and validation. The human submitter remains responsible for reviewing the diff and the evidence.