Repository navigation
Desktop: keep the AppImage's bundled atk-bridge off unless the user chose - #15275
Conversation
…hose The AppImage bundles Jammy's atk-bridge. Against a newer host AT-SPI registry (KDE Plasma with accessibility on) it logs "get_device_events_reply: unknown signature" and the bundled WebKitWebProcess then aborts with SIGABRT on first input. AppRun now sets NO_AT_BRIDGE=1 when the variable is unset and records that it did. Any value the user set is kept, so NO_AT_BRIDGE=0 brings the bridge back for screen reader users. Host browsers and file managers opened through open_detached get the AppRun's default withdrawn, so their own accessibility is untouched. Fixes unslothai#15260
…ernels (#15286) Follow-up to #15273. `tests/test_pp_fsdp2_gloo.py::test_pp2_x_tp2_matches_one_process[gemma3]` still fails on some CI runners, for example #15275, whose base includes #15273: ``` AssertionError: base_model.model.model.layers.0.self_attn.v_proj.lora_B.default.weight: Tensor-likes are not close! Mismatched elements: 1 / 64 (1.6%) Greatest absolute difference: 1.7233192920684814e-05 at index (14, 1) (up to 8.591873198747636e-06 allowed) ``` ## Cause The bound I set in #15273 came from this host's AVX-512 kernels. Gemma3's tensor-parallel fp32 noise depends on which kernels MKL and oneDNN dispatch to. Worst step-0 grad difference against the one-process reference, as a fraction of the tensor max / relative L2, same seed: | arch, layout | AVX-512 (this host) | MKL + oneDNN held to AVX2 | | --- | --- | --- | | gemma3, pp 2 x tp 2 | 2.8e-5 / 2.4e-5 | 1.6e-4 / 1.4e-4 | | gemma3, pp 2 x dp 2 | 3.8e-7 | 4.1e-7 | | llama, pp 2 x tp 2 | | 2.5e-6 / 2.6e-6 | | qwen3, pp 2 x tp 2 | | 5.8e-6 / 4.5e-6 | The AVX2 run fails main's bounds the same way CI does: 18 of 168 tensors over gemma3's per-element bound, and the relative L2 over the shared 5e-5. A CI runner saw 2e-4 per element. So gemma3 under tensor parallel sits about 30x above llama and qwen3 on the same code. The size moves with the instruction set, the signature of rounding amplified by the model's conditioning rather than a systematic error. The thread count makes no difference (1, 2 and 4 threads give identical numbers). ## Fix | | per element | relative L2 | | --- | --- | --- | | gemma3 (`GRAD_ATOL_REL` / new `GRAD_L2_REL`) | 1e-3 | 5e-4 | | llama, qwen3 (unchanged) | 2e-5 | 5e-5 | llama and qwen3 keep the strict bounds on the same tensor parallel code, which is architecture-generic. A gemma3-specific fault, such as a wrong shard or a missed reduction, is an O(1) difference. ## Verification - `test_pp2_x_tp2_matches_one_process`, AVX2 emulation (`DNNL_MAX_CPU_ISA=AVX2 MKL_ENABLE_INSTRUCTIONS=AVX2 ATEN_CPU_CAPABILITY=avx2`): main 1 failed, 2 passed (the gemma3 case, as on CI); this PR 3 passed. On this host's default kernels both pass. - Whole file: 12 passed under both kernel sets. - Faults injected into gemma3's (pp 2, tp 2) step-0 `v_proj.lora_B` grad under AVX2. Each fails, and the clean results pass: - one entry off by 1e-2 of the tensor max; - the whole tensor with 5e-3 relative noise; - the tensor halved (a missing reduction); - the two tp shards swapped.
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
…de it on relaunch Host-WebKitGTK launches (unslothai#15503) load the host atk-bridge, so they keep the bridge. A relaunch inherits the AppRun's own default and now drops it before deciding again. Managed Python children get the bridge back like host launchers. [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ca5bdb0fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [ "${NO_AT_BRIDGE+x}" != x ]; then | ||
| NO_AT_BRIDGE=1 | ||
| UNSLOTH_APPIMAGE_NO_AT_BRIDGE=1 | ||
| export NO_AT_BRIDGE UNSLOTH_APPIMAGE_NO_AT_BRIDGE |
There was a problem hiding this comment.
Scrub accessibility defaults from plugin-backed host opens
On bundled KDE launches with NO_AT_BRIDGE initially unset, this export also affects host-opening routes that bypass the new scrubber. For example, browser_download_open (browser_downloads.rs:285) and browser_file_open (browser_open_with.rs:141) still call tauri_plugin_opener::open_path directly rather than process::open_detached. When those routes spawn a new GTK host application, it inherits NO_AT_BRIDGE=1 and loses its accessibility bridge despite using the host runtime. Apply equivalent environment scrubbing to the plugin-backed opening paths so the workaround remains confined to the AppImage.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 427c08f: browser_download_open and browser_file_open now go through process::open_detached, which scrubs the AppImage env on Linux and is open::that_detached elsewhere (what the plugin called).
…auncher [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…iffusers is missing (#17685) ## Summary `(Python 3.13, a-f)` fails on main and on every PR based on it since #17595 (seen on the staging runs for #15275 and #16707): 25 tests in `studio/backend/tests/test_diffusion_vae_canvas.py`, for example ``` tests/test_diffusion_vae_canvas.py:126: in test_constant_grid_matches_the_overlap_add_and_stock_does_not tests/test_diffusion_vae_canvas.py:25: in _image_vae_cls core/inference/diffusion_minimax_h3_image.py:211: in vae_class core/inference/diffusion_minimax_h3_image.py:178: in _load_vendored E ModuleNotFoundError: No module named 'diffusers' ``` `vae_class()` returns diffusers' `AutoencoderKLMiniMaxH3Image` or, failing that, the vendored copy in `studio/backend/vendor/diffusers_minimax_h3_image/`. The vendored file builds on diffusers' own base classes (`from diffusers.configuration_utils import ConfigMixin`, `diffusers.models.attention`, ...), so without diffusers both paths fail. The Studio backend CI shards do not install diffusers. The product code is fine: Studio only reaches this VAE when diffusers is installed. Only the test assumed diffusers was there. One test in the file already guards on it (`pytest.importorskip("diffusers")` at line 439). Reproduced on main with `diffusers` blocked: 25 failed, 3 passed, 2 skipped. ## Change `_image_vae_cls()`, the helper every VAE-building test goes through, calls `pytest.importorskip("diffusers")` first. The tests that do not build the VAE (the bad-output probe and the graph race bookkeeping) still run without diffusers. Test-only change. ## Testing - `diffusers` blocked: 3 passed, 27 skipped. main: 25 failed. - With diffusers installed: 30 passed, same as main.
scrub_appimage_python_env_tokio now calls restore_host_accessibility like its std twin, so the backend, auth and preflight children no longer inherit the AppRun's NO_AT_BRIDGE=1 default and marker. The AppRun also says on stderr when it applies the KDE default and how to opt out (NO_AT_BRIDGE=0).
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #15260
Before: on KDE Plasma with accessibility turned on, the Linux AppImage's web view crashed (WebKitWebProcess SIGABRT) as soon as you typed into a field. The only way around it was a wrapper script that exported
NO_AT_BRIDGE=1.After: on a KDE Plasma session (
XDG_CURRENT_DESKTOPcontainsKDE) where the AppImage runs its bundled WebKitGTK, it turns the bundled atk-bridge off by itself whenNO_AT_BRIDGEis unset, which is the reporter's working workaround, and says so on stderr (set NO_AT_BRIDGE=0 to keep it). If you setNO_AT_BRIDGEyourself, your value is kept, soNO_AT_BRIDGE=0turns the bridge back on for screen readers. When the AppImage runs the host's WebKitGTK, and on every other desktop (GNOME, XFCE, unset), the bridge stays exactly as before, so screen readers there still see the window. A relaunch drops the inherited default and decides again. Folders and files the app opens through its own launcher (open_detached) and the Python children it starts don't inherit this default; a screen reader user who setsNO_AT_BRIDGE=0passes that value on everywhere.The
atk-bridge: get_device_events_reply: unknown signaturewarning in the report is a side effect of the Jammy atk-bridge talking to a newer AT-SPI registry and shows up on every desktop; it is not the crash itself.How:
studio/src-tauri/linux/appimage-apprun.sh: with the bundled WebKitGTK on KDE sessions, ifNO_AT_BRIDGEis unset, exportNO_AT_BRIDGE=1along with a marker,UNSLOTH_APPIMAGE_NO_AT_BRIDGE=1, and print one stderr line. An inherited marker (a relaunch) is cleared first, so each launch decides again. at-spi2-core'scheck_envvaronly turns the bridge off foratoi(value) == 1, so0or an empty value leave it on, and AppRun doesn't touch either one.studio/src-tauri/src/process.rs:restore_host_accessibilitydropsNO_AT_BRIDGEonly when the marker is set, then drops the marker. A value the user set still gets passed through. It runs inscrub_appimage_launcher_env(host browsers and file managers viaopen_detached),scrub_appimage_python_envandscrub_appimage_python_env_tokio(Python children).browser_downloads.rs/browser_open_with.rs: opening a download or browser file goes throughopen_detachedinstead oftauri_plugin_opener::open_path, so it gets the same scrubbed environment. Off Linuxopen_detachedisopen::that_detached, as before.Testing:
tests/security/test_release_desktop_appimage.py: the AppRun default and its stderr line onKDE/ubuntu:KDE, no default on GNOME, XFCE,KDEXor withXDG_CURRENT_DESKTOPunset, a user-set0, empty or1value kept with no marker and no stderr line, host WebKitGTK left alone, and a relaunch deciding again.process.rs: unit testchildren_get_back_the_atk_bridge_only_the_apprun_turned_off, covering the launcher, std Python and tokio Python scrubbers.KDEsession the window is no longer in the accessibility tree; onGNOMEit is, same as before;NO_AT_BRIDGE=0onKDEbrings it back.kwin_wayland --virtualsession (Xwayland, at-spi2-core 2.62) with accessibility enabled, real keystrokes into the chat box and an AT-SPI client reading it back for 60s: base and head withNO_AT_BRIDGE=0stay in the tree with no crash; head by default getsNO_AT_BRIDGE=1+ marker in the web process and leaves the tree, with no crash.