Skip to content

fix(agent): restore portable Linux client libraries - #1406

Merged
AnthonyRonning merged 2 commits into
masterfrom
codex-linlibs-maple
Nov 1, 2026
Merged

AnthonyRonning merged 2 commits into
masterfrom
codex-linlibs-maple

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Linux bundles can fail at startup with libxkbcommon-x11.so.0: cannot open shared object file after #1403 moved desktop client libraries onto the host. A normal newer Ubuntu desktop need not install that X11 library. This restores portable application dependencies while retaining the host glibc and graphics drivers that fixed the Mesa/LLVM conflict.

  • Build the existing pinned X11/XCB, keyboard, Wayland and ALSA sources against glibc 2.31 and package their required shared-library closure and upstream license/source information. No dependency version or lockfile changes.
  • Give each ELF a relative RUNPATH, audit every payload/library for the glibc floor and complete dependency closure, and reject bundled glibc, ELF loaders and graphics drivers. External CLI processes receive no bundled LD_LIBRARY_PATH.
  • Preserve the Linux updater archive format and legacy loader compatibility entrypoint. Build the runtime only during packaging.
  • Keep ALSA configuration defaults inside the library, discover the host's plugin directory only when unset, and preserve custom or explicitly empty audio overrides.
  • Run the existing downloaded-bundle smoke on pinned stock Ubuntu 20.04 and 24.04 images with no extra desktop packages installed, so CI cannot mask a missing dependency.

Validation:

  • Reproduced build 816's exact exit-127 missing-library error by hiding libxkbcommon-x11 and libxcb-xkb in an isolated native Linux mount namespace.
  • Built all 12 runtime library families from the pinned sources, then made a local unsigned test repack of the same build-816 executable. All 16 bundled DSOs passed the glibc-floor and RELRO/NOW/non-executable-stack checks; none requires newer than glibc 2.30.
  • That repack passed AppRun, direct-payload and legacy-loader identity checks, loading all 16 libraries, and the existing two-client signed-out ACP/host-reuse/stop smoke on both the masked Ubuntu desktop host and pristine Ubuntu 20.04/glibc 2.31 userspace.
  • Default XKB keymap/Compose and actual GPUI first-render passed for the same payload and DSO bytes on the masked host in a separate Xvfb/software-GPU session with empty private state and no network. Loader diagnostics confirmed bundled keyboard libraries alongside host libc and graphics libraries; no LD_LIBRARY_PATH was supplied.
  • The final launcher passed all 33 focused packaging/archive tests on native Linux without skips, including unset/custom/empty audio settings. Its masked-host and pristine-glibc-2.31 startup/ACP smoke also passed. Real ALSA configuration loading succeeded with the config variables unset and no host audio devices mounted. The library runtime was unchanged for this launcher follow-up.
  • The fresh CI Linux package rehearsal passed, including archive validation and both stock Ubuntu container checks. Its unsigned Dev package is built from PR merge ref c3078f5b53180842d0b3075dd174f5fb4f3684ce (PR head aae4a38d merged into master a3e1978).
  • Pinned macOS just ci, normal commit hooks and root just lane repo passed. The other hosted ci:package rehearsals are tracked separately.

The native runtime proof uses a local unsigned repack, not a newly signed production release. No existing application/profile, update feed, signing environment or publisher workflow was changed.

A normal hook replay also exposed the separate macOS host-lock test flake tracked in #1405. Its failed result is preserved; the focused 12-test module and a subsequent normal full commit hook passed. No Rust assertion or hook was changed to get this packaging fix through.

@AnthonyRonning AnthonyRonning added the ci:package Build unsigned packages on this PR label Nov 1, 2026
@AnthonyRonning
AnthonyRonning marked this pull request as ready for review November 1, 2026 04:01
@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Review: no blockers

This fixes the #1403 regression (missing libxkbcommon-x11/libxcb-xkb → exit 127) and keeps the #1166 fix: glibc, the loader and GPU drivers still come from the host.

Diff

  • The runtime (linux-runtime.nix) rebuilds the 12 library families from nixpkgs' pinned sources with zig at glibc 2.31. Data paths point at host locations (/usr/share/X11, /usr/share/alsa, the XKB root), and upstream licenses and source info ship with each library.
  • The audit follows the dependency closure from the payload and every runtime-opened root. It requires $ORIGIN RUNPATHs and SONAMEs that match file names, and rejects bundled glibc, loaders, graphics drivers and unreferenced libraries. It enforces the glibc floor on every ELF.
  • Bundle format v1 and the ld-linux compatibility launcher are unchanged, so existing installs keep updating.
  • The Docker smoke now runs on stock Ubuntu 20.04 and 24.04 with nothing installed. I confirmed both pinned digests are 20.04/glibc 2.31 and 24.04/glibc 2.39. This closes the testing gap that hid the fix(agent): run Linux bundles on the host glibc, like Zed (#1166) #1403 regression.

Testing the CI artifact (maple-agent-dev-0.0.15-c3078f5), emulated x86_64, each distro's own Mesa software Vulkan:

Host Result
Ubuntu 24.04 with the desktop libraries removed #1403 bundle: exit 127, libxkbcommon.so.0 missing. This PR: window opens
Arch (glibc 2.44), Fedora 44, Debian 12, X11/Xvfb window opens
Arch, Wayland (headless Sway) window opens; host Mesa EGL/Vulkan runs on the bundled libwayland-client
Ubuntu 20.04 fails the same way as master (Mesa 21 llvmpipe is too limited for wgpu), now with the clear GPU-driver message
  • Where libraries load from (LD_DEBUG=libs): libxkbcommon(-x11), libxcb(-xkb), libX11, libXi, libasound and, on Wayland, libwayland-client and libffi come from the bundle. libc, libEGL/Mesa, libLLVM and Vulkan come from the host.
  • Symbol compatibility: every host library that links a bundled soname finds all the symbols it needs in our copy. That's 55 libraries on Arch and 62 on Fedora, including the Mesa drivers and ALSA/PipeWire plugins.

Notes, none blocking

  1. Shared libraries: once our libwayland-client, libxcb, libX11, libffi or libasound is loaded, host Mesa and the ALSA/PipeWire plugins bind to our copy. That's safe today because ours are newer than what distros ship (wayland 1.26, xcb 1.17, alsa-lib 1.2.16). It stays safe only while the nixpkgs pin is at least as new as the distros. Zed avoids this by not bundling libwayland or libasound. A symbol check against archlinux:latest would be a cheap CI guard.
  2. Audio was not exercised. Zed excludes libasound from its bundle specifically. Worth playing sound on a real PipeWire desktop before release.
  3. Leftover store paths: five /nix/store paths remain in bundled libraries: an extra XKB search directory in libxkbcommon, an icon search path in wayland-cursor, and the locale-module directory and Xcms.txt in libX11. They don't exist on hosts, so this is harmless. The audit could flag store paths inside bundled ELFs.
  4. Environment leak: AppRun exports ALSA_PLUGIN_DIR, so child CLIs inherit it. It's a host path, so this is harmless.

Not verified: a real GPU or audio. A launch on a hardware Wayland desktop that plays a sound is the remaining check.

@AnthonyRonning
AnthonyRonning merged commit 70c497b into master Nov 1, 2026
24 checks passed
@AnthonyRonning
AnthonyRonning deleted the codex-linlibs-maple branch November 1, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:package Build unsigned packages on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant