feat: bundle static tmux in macOS/Linux installers as a private fallback#2488
Open
Lucifer4255 wants to merge 6 commits into
Open
feat: bundle static tmux in macOS/Linux installers as a private fallback#2488Lucifer4255 wants to merge 6 commits into
Lucifer4255 wants to merge 6 commits into
Conversation
Resolve tmux in one place shared by the spawn prerequisite gate, the tmux runtime adapter, and ao doctor: AO_TMUX_BIN override, then system PATH, then the app-bundled binary (AO_BUNDLED_TMUX), then the existing RUNTIME_PREREQUISITE_MISSING error. Resolution re-runs per command so a tmux installed after daemon start wins on the next spawn. Nothing is ever installed to the user's system.
Manual-dispatch workflow compiling tmux + libevent + ncurses from checksum-verified source tarballs, natively per target (macOS arm64/x64, Linux x64 musl-static), and publishing a tmux-artifacts-v<ver>-<rev> release with checksums and provenance notes for the packaging fetch step.
…kage hook fetch-tmux.mjs downloads the checksum-pinned artifact from the tmux-artifacts release into frontend/tmux-dist before packaging/signing, ships it as an extraResource, and deb/rpm additionally declare a system tmux dependency. Checksums are placeholders until the first artifacts release is cut.
bundledTmuxPath locates the tmux-dist extraResource for packaged macOS/Linux builds; the daemon uses it only when no system tmux is on PATH. Dev and Windows pass nothing.
Updated fetch-tmux.mjs to improve checksum verification with optional sha256 pins for provenance. Introduced functions to parse checksums and resolve expected hashes. Added a new test suite for these functionalities to ensure correctness.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2443.
On macOS/Linux, session spawn is tmux-only, but the packaged app ships no tmux — a clean machine fails pre-spawn with
RUNTIME_PREREQUISITE_MISSING(#2256/#2259 made that failure clear; this makes it go away). Implements the private bundled fallback discussed in the issue: never a system install, never mutating the user's machine.Resolution order (re-evaluated on every command)
AO_TMUX_BIN— explicit override; a set-but-broken value fails loudly instead of falling throughPATH— always wins when present. Existing users see zero behavior change, and installing tmux later takes effect on the next spawnResources/tmux-dist/tmux(stamped into the daemon env asAO_BUNDLED_TMUXby the Electron supervisor; accepted only if an executable regular file)RUNTIME_PREREQUISITE_MISSINGerror (wire code unchanged, no API contract regen)What's in here
tmux.ResolveBinary/NewResolvershared by all consumers — the tmux runtime adapter (per-command resolution), the spawn prerequisite gate (validateRuntimePrerequisites), andao doctor(PASS output now shows provenance:via PATH | bundled | AO_TMUX_BIN) — so they can never disagree on which binary is used.AO_TMUX_BIN/AO_BUNDLED_TMUXare read centrally inconfig.Load()..github/workflows/tmux-artifacts.ymlbuilds tmux 3.5a + libevent 2.1.12 + ncurses 6.5 from sha256-verified source tarballs, natively per target (macOS arm64/x64: static deps, dynamic only against libSystem; Linux x64: musl fully-static on alpine with compiled-in terminfo fallbacks), and publishes atmux-artifacts-v<ver>-<rev>release withchecksums.txt+ provenance/license notes (tmux ISC, libevent BSD-3, ncurses MIT-X11).fetch-tmux.mjsruns inprepackage/premake/publish(before signing, so the binary is sealed into the macOS signature), verifies the download against the releasechecksums.txtwith optional in-repo pins as a cross-check, and shipstmux-distas anextraResource.AO_SKIP_TMUX_FETCH=1escape hatch for offline dev packaging. deb/rpm additionally declare a system tmux dependency as a cheap complement.frontend/docs/desktop-release.md; landing docs updated so "install tmux" is CLI-only guidance.Testing
go test ./...green — new table-driven resolver tests (override wins / system beats bundled / bundled accepted when PATH empty / non-executable rejected / sentinel errors), per-command re-resolution tests in the tmux adapter, spawn-gate tests (bundled accepted, resolver failure creates no session row), doctor provenance tests.bundledTmuxPathand checksum-parsing/pin-resolution suites.aobinary across all four states:WARN tmux: not found in PATH (the desktop app falls back to its bundled tmux; …)
PASS tmux: …/faketmux/tmux (tmux 3.5a, via bundled)
PASS tmux: /opt/homebrew/bin/tmux (tmux 3.7b, via PATH)
PASS tmux: …/faketmux/tmux (tmux 3.5a, via AO_TMUX_BIN)
Follow-ups before release
tmux-artifactsworkflow once to cuttmux-artifacts-v3.5a-1, then (optionally) copy the per-asset sha256 pins intofetch-tmux.mjs.Resources/, the fallback is an explicitbinarieslist inosxSign.desktop-release.md.