Skip to content

Linux desktop support (external inference) — draft for #1077 - #1122

Closed
eXsoR65 wants to merge 29 commits into
ashhart:mainfrom
eXsoR65:linux-port
Closed

eXsoR65 wants to merge 29 commits into
ashhart:mainfrom
eXsoR65:linux-port

Conversation

@eXsoR65

@eXsoR65 eXsoR65 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Lead with this so the engine checklist is not misread: this change touches only app/; no
engine, kernel, quantization or inference code changes.
Items below that assume engine work are
marked n/a with the reason instead of being ticked.

What this changes

Linux as a desktop client: same app and agent loop, user-managed inference from an
OpenAI-compatible endpoint. No engine code, nothing bundled. Refs #1077, scoped per review: client
portability plus an Ubuntu 24.04-baseline AppImage. Rebased by merging upstream/main (f8d254c5,
211 commits); upstream had already landed three of the portability fixes, so those files take
upstream's version.

Contract

  • Behavior: the existing desktop app builds and runs on Linux; inference is an external endpoint
    the user configures. No engine, kernel or quantization change.
  • Reproducer: on Linux the app did not build, run_command failed closed without
    sandbox-exec, and a remote engine's model IDs had to be typed by hand.
    app/docs/linux-port/PHASE1-BASELINE.md records the baseline failures.
  • Owning modules: electron/agent (shell resolution, benchmark cleanup, provider discovery),
    electron/main/host (window options, security controls, renderer failure reporting), src/
    (chrome, engine-surface visibility, host labels), scripts/, .github/workflows/app.yml.
    Nothing under zig/ or the engine adapters.
  • Checks: suite, typecheck, packaged smoke, AppImage clean-install smoke. No performance gate
    applies: no served path changed.

Receipt

  • Environment: head 865336e0 on d1018b31; Debian 13 x86-64 headless, Node 22.19.0, npm
    10.9.8, Electron 42.11.12. By hand: Fedora 42 / Wayland against a TensorFold engine on the LAN
    (Qwen3.8-27B-MLX-4bit), configured as an external provider. No MLX, PyTorch or checkpoint
    involved.
  • Exactness, decode and prompt speed: n/a — no lane, kernel, precision, sampling or prompt-path
    change.
  • Tests: npm test 845 passed, 0 failed; typecheck clean; packaged smoke; clean-install smoke
    of the AppImage itself. Blocks that need sandbox-exec skip with a printed note on this host:
    the seatbelt proofs in planning-sandbox, planning-guard and sandbox-git-control, and the
    CLI-seat dispatch/abort proofs in room-cli-seat.
  • CI: run 39685162467 attempt 2 —
    all four jobs success: desktop (macOS 14), desktop-linux (Ubuntu 24.04), appimage-linux
    (Ubuntu 24.04, artifact uploaded), mobile. The first attempt failed
    electron/document-library/processing.test.ts, an upstream queue test that passes 38/38 locally
    (serial, parallel and under CPU load); it is a timing race this lane exposed, not a change in this
    PR. That job builds the AppImage on Ubuntu 24.04, runs the
    clean-install smoke against the artifact, and uploads tensorfold-linux-appimage (246 MB). These
    ran in the fork: upstream checks stay pending for a first-time fork PR, and the two Linux jobs are
    added by this PR, so they cannot run here before merge.
  • Not run: an interactive X11 session; a hand-driven Mac (macOS is covered by CI only).

Limits

  • LAN providers stay external, as asked: the TensorFold network preset only adds the endpoint.
    Bots and phone guard, which require a local model, do not run against it.
  • Commands stay refused on Linux. The bubblewrap backend is deliberately not in this change and
    is preserved on sandbox-followup for a separate PR once the git and worktree gaps close.
  • No bundled engine, model downloads, GPU discovery or Apple-only features.

Checklist

  • Platforms stated: Debian 13 (build), Fedora 42 Wayland (by hand), CI macOS 14 and Ubuntu 24.04.
    Not run by hand: X11, a physical Mac.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.
  • n/a — Every token still goes through the lane rounds: no lane or scheduler code in this change.
  • n/a — Drafted equals "draft": false: no inference code in this change.
  • n/a — No precision traded for speed: no arithmetic change.
  • n/a — Kernel contract and SUMMARY lines: no kernel added or changed.
  • n/a — Prompt processing no slower: the prompt path is untouched.

Review order

owned-group.ts, cli-path.ts → .github/workflows/app.yml (Linux lane and AppImage job) →
linux-builder-config.cjs and smoke-packaged-linux.mjs → renderer chrome and host labels.
Details in app/docs/linux-port/.

ps -o comm= returns the full executable path on macOS but the 15-char
truncated task name on Linux, so the owned-group member verification
always failed and cancel reported cleanupFailed. Resolve the member
executable through /proc/<pid>/exe on Linux; keep the comm path
comparison on other platforms.
The sandbox exec paths and SHELL env hardcoded /bin/zsh, which stock
Linux installs lack, so run_command could not execute at all. Resolve
zsh first (unchanged macOS behavior), then bash, then sh. bash/sh run
with -c rather than -lc because a login bash re-clobbers the PATH that
ensureCliPath already augmented. The system prompt now names the
resolved shell. Tests on hosts without sandbox-exec use the documented
VONTRA_ALLOW_UNSANDBOXED_COMMANDS development escape hatch, matching
the existing sandbox.test.ts pattern.
- build-computer-helper.test.mjs pins platform: 'darwin' for the mocked
  toolchain cases (the injection point already existed); the explicit
  'linux' rejection case still exercises the real default.
- planning-sandbox.test.ts accepts the extra '/usr' interpreter root
  that usrmerge Linux produces (/bin/sh resolves to /usr/bin/dash)
  while still asserting the home dir is never a root.
- email-outlook-optin.test.ts gates the opt-in probe assertion to
  macOS, where the Outlook store layout exists by design, and asserts
  the no-op behavior elsewhere.
run_command failed closed on Linux because only macOS sandbox-exec was
supported. linux-sandbox.ts builds a bwrap namespace mirroring the SBPL
profile contract: deny-by-default filesystem with the profile's read
roots bound read-only, cwd/tmp writable only when the profile allows,
usrmerge symlink compatibility, and an unshared network namespace unless
the profile allows network. A writable .git bind pins it against
rename/replace while config, config.worktree, hooks and info are
read-only mountpoints (which also reject unlink with EBUSY), matching
gitControlWriteDeny; refs and objects stay writable so git works.
Known gaps versus SBPL: a worktree pointer's external gitdir and
nested-repo .git entries are not pinned, and a brand-new .git cannot be
denied where none exists.

Stacked on linux-sandbox-shell-discovery. Security controls now report
commandSandboxAvailable when bwrap works; the MCP sandbox claim stays
macOS-only because mcp-client spawns sandbox-exec directly. The CLI-seat
real-dispatch and abort proofs are gated to hosts with the planning
seatbelt until planning-sandbox gains a Linux backend.
Linux gets the window manager's title bar and controls instead of
hiddenInset traffic lights; macOS and Windows window options are
unchanged and no new IPC was added. The three headers that reserved
96px for traffic lights now use normal padding on Linux only.
An explicit Linux builder config replaces the Mac release config
rather than overlaying it, so the engine and computer-use resources are
absent, packaging never publishes, and Mac signing/notarization stay
untouched. A packaged smoke command launches the artifact headlessly
with an isolated profile and probes /health.
The bubblewrap backend is not qualified: the capability probe omits
loader roots, mount ordering can hide a read-only workspace beneath a
writable temporary parent, and git-control confinement misses absent
and nested metadata. Availability stays false so Linux commands keep
the existing fail-closed behavior, and the test now states that its
argument checks are not confinement proof. The packaged Mac profile
test keeps the original inode alive instead of skipping on Linux.
Match the Mac smoke contract: health must report ok and listening, the
UI must return a nonempty 200, and an unauthenticated /v1/snapshot must
return 401 without its body being read.
…he real argv

Mount decisions now collapse to one final mode per resolved path and
are emitted parent-first, so a read-only workspace below a writable
temporary parent stays read-only. The capability probe runs the
production argv with a read-only fixture instead of a hand-written
minimal namespace that omitted loader roots. The backend remains
disabled; git-control confinement is still unqualified.
Capture the contribution plan, the verified baseline, the current
status with evidence, and the outstanding Linux sandbox blockers next
to the app documentation.
Add a Linux desktop lane beside the macOS one: install bubblewrap,
restore the locked trees, run the runtime suite, typecheck, and check
patch whitespace. The suite passes on Linux with the fail-closed
command sandbox.
mkdtemp returns the /var form on macOS while the profile roots are
realpathed to /private/var, so the new replacement case compared two
spellings of the same directory and failed on CI. Use realpath for the
retained fixture and both parent assertions.
The bubblewrap backend now runs a real conformance test: workspace
writes, refusal outside the mounted roots, read-only profile refusal,
git hooks/config pinning, network denial versus the network-fetch
profile, and prompt cancellation. It passes on this Debian host.

Because git metadata for absent, nested and worktree repositories is
still unprotected, the backend stays behind TENSORFOLD_LINUX_SANDBOX=1
instead of defaulting on. The Linux CI lane runs the conformance test
so the evidence stays current.
…gine

The desktop does not bundle an engine on Linux, so inference comes from
an OpenAI-compatible provider. Record the serve flags, the /v1/models
check, LAN versus SSH-tunnel trade-offs, and how provider
classification differs between a LAN address and loopback.
On Linux the built-in engine entry only reports the bundled local
engine, so a TensorFold server on another machine had to be entered by
hand as an unlisted model id. Add a local preset for it, let provider
discovery probe any OpenAI-compatible endpoint (kind: custom) with the
typed address and API key, and pass those fields from onboarding
detection instead of always probing localhost. The preset reuses
registered UI strings, so no translations are added.
Linux ships no engine, so the Models workspace showed an unavailable
engine, download and Workers tabs, and an Apple-silicon recommendation
that cannot apply. Hide the Models entry and render a provider-only
fallback when the engine is unavailable off macOS; a user who supplies
an engine binary still gets the full workspace. The picker's local scope
no longer says "On this Mac" off macOS, using the registered neutral
labels instead.
Bots work off macOS too, but the page described the host as a Mac and
offered an execution target that only exists there. Label the local
target "Local" off macOS, hide the macOS-only VM target, and drop the
macOS-only explanatory sentences while keeping the neutral one.
Each child transpiles this module with jiti. Under a loaded CI host the
old 5 s budget aborted a child before it produced an assertion, so the
suite failed for scheduling rather than behaviour. 30 s still fails a
genuine hang.
Electron aborts on Wayland with "'--ozone-platform=wayland' is not
compatible with Vulkan". Detect a Wayland session (explicit ozone flag,
XDG_SESSION_TYPE or WAYLAND_DISPLAY) before GPU init and merge Vulkan
into --disable-features, keeping other disabled features and leaving
X11 and macOS untouched.
A renderer exception, a failed page load, or a main process that never
answers left the static splash on screen with no explanation. Report
renderer errors, unhandled rejections and a ten-second stall in a
visible panel, and report did-fail-load and render-process-gone from
the window runtime to the terminal and a dialog.
Adding useEngine() below the loading-state return changed App's hook
count once settings arrived, so every Linux startup died with React
ashhart#310 and the window stayed on the boot splash. Move it above the
return and pin the ordering with an AST test that fails if any hook is
declared after that return.
Bots require a local model (privateContext 'bot'), so a TensorFold
engine on the LAN was planning-only and could not run a bot at all.
Mark that preset trustedNetwork and classify it as trusted-local while
its address stays loopback, RFC1918, IPv6 unique-local or .local; a
public address stays external, CLI transports stay external, and any
hand-added LAN provider remains external.
The thread trust badge, the bot chip in the title bar, the composer's
bot footer and the bot chat card all said "this Mac" on Linux. Use the
registered neutral labels off macOS, and label a trusted network engine
as "Network" rather than claiming it runs on this machine.
Collapse multi-line comment blocks in the new Linux modules to one
line of at most 120 columns.
@eXsoR65
eXsoR65 marked this pull request as ready for review October 21, 2026 15:09
Per review: LAN providers stay external, and commands stay refused
until the git and worktree sandbox gaps are closed, so the bubblewrap
backend is out of this change (preserved on sandbox-followup). Add an
Ubuntu 24.04 AppImage job that builds the artifact, runs a clean-install
smoke of the AppImage itself, and uploads it.
Upstream independently landed the Linux benchmark-cleanup fix, the
smoke-profile cleanup change and the CLI-seat seatbelt gating, so those
files take upstream's version and this branch keeps only the packaging,
CI, renderer and documentation work.
ashhart added a commit that referenced this pull request Oct 22, 2026
…d loads

The five mechanical findings of the maintainer review of #1122, each with a
test that fails without it.

- Models returned before its hooks, so React reported #310 when the engine
  appeared. The gate moves above the workspace into a component with no hooks.
  The workspace body is unchanged line for line, and its own test only learned
  to render the child the gate now returns. The new test is the rule the pull
  request carries for its own files: src/Models.hooks-order.test.ts.
- The port baseline named a person's home directory and a personal fork account.
  Both are the operator's own words now, and scripts/linux-port-docs.test.mjs
  holds every port document to naming no account but the repository's own.
- The baseline called its setup reproducible because of two files the
  repository does not hold. It describes the setup in prose, and the same test
  holds the instructions to naming only what the repository holds.
- The sandbox review claimed the bubblewrap backend the scoping commit took
  out. It says the backend is not part of this change, and the same test holds
  that claim to the tree.
- A cancelled main-frame load raised the renderer's error box. Electron reports
  a replaced load as ERR_ABORTED (-3), which the handler now ignores. A real
  load failure and a child frame are reported as before.

Replacing the merge of main with a replay also left three conflicts on the
contributor's side where their own merge had taken main's. In
scripts/smoke-packaged-mac.test.mjs that declared a name twice, so the file
failed to parse and its test never ran. All three are restored to the merge's
result, and the tree is now the pull request's tree plus this commit.

The document guard resolves exact repository paths at each instruction's working
directory and derives its account allowlist only from canonical release URLs.
Two regressions reject a missing-directory basename match and shell-path tokens
that previously became project accounts.
@ashhart

ashhart commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Thank you, @eXsoR65: the Linux desktop client is on main now. Your 28 commits landed with their authorship and messages, replayed onto current main in place of the branch's merge of main, followed by one maintainer commit, 4bdabeb. That commit moves the Models page's early return above its hooks, keeps the port documents to names and setup the repository holds, and ignores a cancelled main-frame load instead of raising the error box. One port document had a local path when it was first added; we wrote that line the way the later version does, so the history carries none. It ships in the next release, and thanks for the AppImage test build.

  • Synthema, Ash's AI Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants