Skip to content

Desktop: run the AppImage on the host's WebKitGTK 2.54+ when available - #15503

Merged
shimmyshimmer merged 6 commits into
unslothai:mainfrom
Etherll:fix/inline-appimage-host-webkit-a27f982f3f41
Oct 30, 2026
Merged

shimmyshimmer merged 6 commits into
unslothai:mainfrom
Etherll:fix/inline-appimage-host-webkit-a27f982f3f41

Conversation

@Etherll

@Etherll Etherll commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

The AppImage bundles WebKitGTK 2.50.4 from its Ubuntu 22.04 build base. That version saturates the web process at fractional Wayland scales. WebKitGTK 2.54 does not, but no distribution package of it builds on a base that keeps the glibc 2.35 floor.

AppRun now probes the host. It runs an unbundled, byte-identical copy of the executable (usr/bin/host/unsloth-studio, whose $ORIGIN/../lib reaches nothing) with --unsloth-webkit-probe under a 5 s timeout. The copy only loads if every linked host library and symbol resolves (the binary is BIND_NOW). It also dlopens the tray library setup_tray needs and prints the WebKitGTK version that loaded.

  • If that version is 2.54 or newer, AppRun undoes the gtk/gstreamer hook exports that pin GTK, GIO, GSettings and GStreamer to the bundle, and execs the host copy, so the whole stack comes from the host.
  • Otherwise it keeps the current bundled launch.
  • UNSLOTH_APPIMAGE_WEBKIT=auto|host|bundled overrides the choice.
  • The chosen mode is logged by AppRun and the app, shown in diagnostics, and a host-mode AppImage gets the native rendering plan in linux_webkit.rs.

The finalizer adds the host copy. The verifier checks it whenever a launcher refers to it, so the already shipped release still verifies. The clean-machine AppImage CI asserts the mode and the mapped libraries, with new Fedora 44 and Debian 13 lanes (expect host) and an Ubuntu 24.04 lane (WebKitGTK 2.52.6, bundled unless forced).

Draft #15482 (GPU rendering setting) also touches linux_webkit.rs, so whichever lands second will need a rebase.

Testing

Run locally:

  • cargo test in studio/src-tauri: 775 of 777 pass. The 2 failures are debian_update dpkg tests that also fail on main.
  • Probe on a host: prints webkit=2.54.2 in 72 ms.
  • 65 Python tests: AppRun mode matrix under dash and bash, an A/B against the main AppRun (bundled mode differs only by UNSLOTH_APPIMAGE_WEBKIT_MODE=bundled and one stderr line), verifier and finalizer fixtures, and contract tests.

Not run yet:

  • Building the AppImage (fork CI).
  • The new Fedora 44, Debian 13 and Ubuntu 24.04 lanes.
  • The built AppImage on a host at fractional scale.

Etherll and others added 2 commits October 27, 2026 08:32
…ck is complete

The AppImage bundles WebKitGTK 2.50.4 from its Ubuntu 22.04 build base, which saturates the
web process at fractional Wayland scales; WebKitGTK 2.54 does not, but no distribution package
of it builds on a base that keeps the glibc 2.35 floor.

AppRun now probes the host: an unbundled, byte-identical copy of the executable
(usr/bin/host/unsloth-studio, whose $ORIGIN/../lib reaches nothing) runs with
--unsloth-webkit-probe under a 5 s timeout. It loads only because every linked host library and
symbol resolved (the binary is BIND_NOW), dlopens the tray library setup_tray needs, and prints
the WebKitGTK that loaded. When that is 2.54 or newer, AppRun undoes the gtk/gstreamer hook
exports that pin GTK, GIO, GSettings and GStreamer to the bundle and execs the host copy, so the
whole stack comes from the host; otherwise it keeps today's bundled launch.
UNSLOTH_APPIMAGE_WEBKIT=auto|host|bundled overrides the choice. The mode is logged by AppRun and
the app, shown in diagnostics, and a host-mode AppImage gets the native rendering plan.

The finalizer adds the copy, the verifier checks it whenever a launcher refers to it (so the
shipped release still verifies), and the clean-machine AppImage CI asserts the mode and the
mapped libraries, with new Fedora 44 and Debian 13 lanes (host) and an Ubuntu 24.04 lane
(2.52.6, bundled unless forced).
…ard job

It reads desktop-app-clean-machine-ci.yml, so a PR that edits only that workflow has to collect it
(test_workflow_guards_run_unfiltered).
fedora:44 ships no diffutils, so the clean-machine audit failed with "cmp: command not found" and
reported the identical host copy as different. Fall back to sha256sum, failing closed.
@Etherll
Etherll marked this pull request as ready for review October 27, 2026 15:06
@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T15:06:49.684394Z
We couldn’t complete this review. Comment @codex review to try again.
8839511 Draft marked ready
ℹ️ 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.

@oobabooga oobabooga self-assigned this Oct 29, 2026
@oobabooga

Copy link
Copy Markdown
Member

Reached Codex review convergence at oobabooga#430.

@shimmyshimmer
shimmyshimmer merged commit 05ede7c into unslothai:main Oct 30, 2026
51 checks passed
danielhanchen added a commit to NilayYadav/unsloth that referenced this pull request Nov 1, 2026
…) (unslothai#16322)

Fixes unslothai#16318. Same cause as the flicker in unslothai#16028.

On NVIDIA X11 the app turns WebKit compositing off below driver 610,
which avoids the 580 driver's `sync_file` leak (unslothai#10795). The plan it
uses (`WEBKIT_DMABUF_RENDERER_FORCE_SHM` +
`WEBKIT_FORCE_DMABUF_RENDERER` + `WEBKIT_DISABLE_COMPOSITING_MODE`)
works up to WebKitGTK 2.52, but on 2.54 the window stops presenting what
WebKit draws. The report's video alternates between the UI and a blank
off-white window 82 times in 11 seconds.
`WEBKIT_DISABLE_COMPOSITING_MODE=1` alone is enough to trigger it on
2.54 with NVIDIA's libraries; with Mesa it renders.

Who gets it: NVIDIA X11 hosts below driver 610 with a system WebKitGTK
2.54 (Debian 13, Fedora 43/44, Arch). Deb users there have had it since
their distribution moved to 2.54. AppImage users there got it in
v0.1.913, when the AppImage started running on the host's WebKitGTK 2.54
(unslothai#15503); v0.1.912's bundled 2.50.4 renders. The "Off" setting, "On"
below driver 610 and `UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1` all reached
the same plan, so none of them helped.

## Fix

Every NVIDIA X11 path that turns compositing off now turns the DMA-BUF
renderer off instead on WebKitGTK 2.54 and newer: Auto below driver 610,
Off, On below 610, and `UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1`. This is
the `WEBKIT_DISABLE_DMABUF_RENDERER=1` workaround the report confirmed.
Below 2.54 those paths keep the shared-memory plan, which renders there
and is what unslothai#10964 chose because disabling DMA-BUF could leave Debian
and Ubuntu's patched WebKit without a transport. Wayland, non-NVIDIA
hosts and NVIDIA X11 at driver 610 or newer are unchanged.

## A/B results

v0.1.912 and v0.1.913 release builds, and this branch before and after
the follow-up commit, built with the Linux x64 steps of
`release-desktop.yml`, ran in Debian 13, Fedora 44 and Ubuntu 24.04
containers with NVIDIA's userspace on an Xvfb display, with a fake
driver 595 version file for the below-610 paths. Without a compositor,
the broken presentation shows as a window that stays blank rather than
flickering.

| WebKitGTK | Auto, driver 595 | On, driver 595 | Off |
`UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1` |
| --- | --- | --- | --- | --- |
| 2.54.0 (Debian 13), v0.1.913 | Blank | Blank | Blank | Blank |
| 2.54.0 (Debian 13), this PR | Renders | Renders | Renders | Renders |
| 2.54.2 (Fedora 44), this PR | Renders | Renders | Renders | Renders |
| 2.52.6 (Ubuntu 24.04), this PR | Renders, unchanged plan | Renders,
unchanged plan | Renders, unchanged plan | Renders, unchanged plan |
| 2.50.4 (bundled), this PR | Renders, unchanged plan | Renders,
unchanged plan | Renders, unchanged plan | Renders, unchanged plan |

The first commit alone left On below 610 and
`UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1` blank on 2.54.0 and 2.54.2. The
v0.1.912 deb is blank on Debian 13's 2.54.0 as well.

Disabling DMA-BUF also stays clear of the 580 leak. On a GeForce MX150
with driver 580.178.04, the same continuous-scroll workload grew the web
process to 367 `sync_file` descriptors in about 2 minutes with
compositing on, and stayed at 0 for 5 minutes with
`WEBKIT_DISABLE_DMABUF_RENDERER=1`, at 59 fps.

## Validation

- **Rust tests:** all 837 `studio/src-tauri` binary tests pass,
including a new case for each of the four paths on 2.50.4, 2.52.6,
2.54.0 and 2.54.2.
- **Builds:** `verify-complete-appimage.sh` passed on both A/B builds.
- **Not tested:** the flicker itself on an NVIDIA X server below driver
610 with WebKitGTK 2.54 (the test machine has driver 615), and Debian or
Ubuntu's NVIDIA DMA-BUF patch on real NVIDIA hardware with WebKitGTK
2.52 or older.

---------

Co-authored-by: oobabooga <[email protected]>
Co-authored-by: Daniel Han <[email protected]>
danielhanchen added a commit to debojyoti-dev/unsloth that referenced this pull request Nov 13, 2026
…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]
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.

5 participants