Skip to content

Desktop: keep the AppImage's bundled atk-bridge off unless the user chose - #15275

Merged
wasimysaid merged 7 commits into
unslothai:mainfrom
debojyoti-dev:fix/appimage-atk-bridge-15260
Nov 14, 2026
Merged

wasimysaid merged 7 commits into
unslothai:mainfrom
debojyoti-dev:fix/appimage-atk-bridge-15260

Conversation

@debojyoti-dev

@debojyoti-dev debojyoti-dev commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

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_DESKTOP contains KDE) where the AppImage runs its bundled WebKitGTK, it turns the bundled atk-bridge off by itself when NO_AT_BRIDGE is unset, which is the reporter's working workaround, and says so on stderr (set NO_AT_BRIDGE=0 to keep it). If you set NO_AT_BRIDGE yourself, your value is kept, so NO_AT_BRIDGE=0 turns 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 sets NO_AT_BRIDGE=0 passes that value on everywhere.

The atk-bridge: get_device_events_reply: unknown signature warning 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, if NO_AT_BRIDGE is unset, export NO_AT_BRIDGE=1 along 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's check_envvar only turns the bridge off for atoi(value) == 1, so 0 or an empty value leave it on, and AppRun doesn't touch either one.
  • studio/src-tauri/src/process.rs: restore_host_accessibility drops NO_AT_BRIDGE only when the marker is set, then drops the marker. A value the user set still gets passed through. It runs in scrub_appimage_launcher_env (host browsers and file managers via open_detached), scrub_appimage_python_env and scrub_appimage_python_env_tokio (Python children).
  • browser_downloads.rs / browser_open_with.rs: opening a download or browser file goes through open_detached instead of tauri_plugin_opener::open_path, so it gets the same scrubbed environment. Off Linux open_detached is open::that_detached, as before.

Testing:

  • tests/security/test_release_desktop_appimage.py: the AppRun default and its stderr line on KDE / ubuntu:KDE, no default on GNOME, XFCE, KDEX or with XDG_CURRENT_DESKTOP unset, a user-set 0, empty or 1 value kept with no marker and no stderr line, host WebKitGTK left alone, and a relaunch deciding again.
  • process.rs: unit test children_get_back_the_atk_bridge_only_the_apprun_turned_off, covering the launcher, std Python and tokio Python scrubbers.
  • Released v0.1.910-beta AppImage under Xvfb with an AT-SPI bus (at-spi2-core 2.52 and 2.60.4, the Kubuntu 26.04 version) and an AT-SPI client walking the tree and querying text while typing ASCII, Cyrillic, CJK and emoji into the chat box and the Hugging Face token field: no web process crash on base or head. With this AppRun on a KDE session the window is no longer in the accessibility tree; on GNOME it is, same as before; NO_AT_BRIDGE=0 on KDE brings it back.
  • Released v0.1.917-beta AppImage with the bundled WebKitGTK forced, under a headless kwin_wayland --virtual session (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 with NO_AT_BRIDGE=0 stay in the tree with no crash; head by default gets NO_AT_BRIDGE=1 + marker in the web process and leaves the tree, with no crash.
  • The crash itself was not reproduced without a real Plasma session; the KDE fix rests on the reporter's confirmed workaround.

…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
danielhanchen added a commit that referenced this pull request Oct 25, 2026
…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.
@danielhanchen danielhanchen self-assigned this Oct 26, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T11:20:03.060861Z a5288ba Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@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]
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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).

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 427c08f5eb

ℹ️ 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".

danielhanchen added a commit that referenced this pull request Nov 13, 2026
…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.
danielhanchen and others added 2 commits November 13, 2026 09:10
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).
@wasimysaid

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: a5288bae35

ℹ️ 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".

@wasimysaid
wasimysaid merged commit 2dba556 into unslothai:main Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Linux][Desktop] WebKitWebProcess crashes with SIGABRT when AT-SPI / atk-bridge is active (KDE Plasma)

3 participants