Repository navigation
Conversation
4214d7d to
6ef707d
Compare
79a3eea to
d191bce
Compare
Greptile SummaryThe PR adds packaged-Linux display preflight checks and a bundled CLI version path, while preserving the separate Xvfb startup behavior for serve mode.
Confidence Score: 4/5The PR does not appear safe to merge until the outstanding remote-display bypass is resolved, because an unreachable but syntactically valid X11 endpoint can still continue into Chromium startup. The display helper still treats any syntactically valid nonlocal DISPLAY as usable without checking reachability, so the new startup gate does not prevent the unavailable-display failure for that existing reported path. Files Needing Attention: src/main/startup/ensure-virtual-display.ts
|
| Filename | Overview |
|---|---|
| src/main/startup/ensure-virtual-display.ts | Adds local X11 and Wayland validation and Xvfb failure handling; the previously reported remote-display reachability gap remains. |
| src/main/index.ts | Adds synchronous pre-ready exits for failed packaged display preflight and failed serve-mode display setup. |
| src/cli/cli-version.ts | Reads version metadata from the compiled-output package boundary and fails closed on invalid data. |
| src/cli/index.ts | Handles standalone version flags before normal CLI dispatch. |
| config/electron-builder.config.cjs | Stamps the effective packaged application version into the unpacked CLI metadata boundary. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
L[Packaged Linux launch] --> S{Serve mode?}
S -->|No| P[Validate selected display]
P -->|Unavailable| E[Print guidance and exit 1]
P -->|Accepted| C[Continue Chromium startup]
S -->|Yes| X[Reuse X11 or start Xvfb]
X -->|Failure| E
X -->|Success| C
Reviews (22): Last reviewed commit: "fix(linux): fail serve when no display i..." | Re-trigger Greptile
6ef707d to
7e3a2ce
Compare
d191bce to
5efccbb
Compare
7e3a2ce to
de05897
Compare
5efccbb to
37ea874
Compare
de05897 to
3d9f13c
Compare
37ea874 to
444495a
Compare
3d9f13c to
ec38c08
Compare
444495a to
a78c63e
Compare
ec38c08 to
3375af7
Compare
a78c63e to
79e6426
Compare
3375af7 to
746490c
Compare
79e6426 to
362b942
Compare
746490c to
a3d0e25
Compare
362b942 to
b39dec3
Compare
a3d0e25 to
7350a97
Compare
b39dec3 to
33178fb
Compare
7350a97 to
6f3166e
Compare
33178fb to
ca74174
Compare
6f3166e to
1e152b9
Compare
ca74174 to
6cd118b
Compare
1e152b9 to
e40c806
Compare
6cd118b to
9b360ae
Compare
e40c806 to
a91f7e9
Compare
2bc13e6 to
e7c373b
Compare
eb477d9 to
2f1a4c2
Compare
|
Follow-up boundary: issue #17615 confirms that |
e7c373b to
aba62d5
Compare
2f1a4c2 to
759ff29
Compare
aba62d5 to
000f798
Compare
759ff29 to
7e7ca31
Compare
000f798 to
d06b724
Compare
7e7ca31 to
6cc0b29
Compare
d06b724 to
5435a61
Compare
6cc0b29 to
8af9245
Compare
An X server writes its lock beside its socket and both survive a crash (verified against Xvfb under SIGKILL), so a socket with no lock was never left by a crashed server. It is an endpoint published from elsewhere: a container bind-mounting only /tmp/.X11-unix, WSLg, or a foreign PID namespace. Declaring those dead made the desktop gate exit(1) on displays that work, with no workaround, and the serve gate refuse to start. Liveness now splits by ownership. A foreign DISPLAY trusts a lockless socket; Orca's own :99 does not, because removeStaleDisplayArtifacts unlinks the lock before the socket and so manufactures that state itself -- adopting it would resurrect the orphan-socket bug and stop the cleanup from self-healing. The stale-lock rejection is unchanged. Also correct four doc statements this behaviour falsified.
Readiness only checked that /tmp/.X11-unix/X99 exists. A stale socket we could not unlink still exists after our own Xvfb refused to bind, so Orca set DISPLAY to a dead server and Chromium died in Ozone init. Measured on Ubuntu 24.04 against the pre-fix build: with a leftover :99 socket and no lock, serve exits 139 (SIGSEGV), the socket inode is unchanged before and after, and no lock is recreated -- it neither cleaned up nor respawned. To a user that is a crash, not a misconfiguration. This is reachable in the documented topology, where orca-xvfb.service has no User= and runs as root while serve runs as User=orca: /tmp is sticky, so the orca uid cannot unlink a root-owned socket, rmSync fails, and Xvfb exits with the display already active. Readiness now requires the display to actually be live -- our socket plus a lock naming a running process -- so the same state reports an unusable display and exits 1 with the existing diagnosis.
Two display setups this gate could not prove were refused outright, and on the desktop path that is app.exit(1) with no workaround. An X server may bind only the abstract namespace (`@/tmp/.X11-unix/X0`), which leaves no filesystem socket to stat. Abstract addresses are kernel-owned and vanish the moment the owner exits, so an entry in /proc/net/unix is proof of a live server -- no lock file needed and no stale entry possible. Verified on Ubuntu 24.04, where 139 such addresses were present. WAYLAND_SOCKET is an already-connected fd handed over by the compositor, so there is no path to stat and WAYLAND_DISPLAY may be unset entirely. Its presence is the display. Both are consulted only after the filesystem-socket check fails, so no existing verdict changes.
5435a61 to
4f90ecf
Compare
8af9245 to
ee41ace
Compare
Recognising a lockless X socket as live is correct for an endpoint published from elsewhere -- a container bind mount, WSLg -- because an X server writes its lock beside its socket and both survive a crash. It is wrong for VIRTUAL_DISPLAY_NUMBER, because Orca's own teardown unlinks the lock before the socket and so manufactures that exact state. The managed branch was already strict, but a caller that sets DISPLAY=:99 explicitly takes the foreign path and skipped it, accepting a dead display left by Orca's own interrupted cleanup. Route the managed number through the strict probe on both paths. Found by an adversarial audit of the asymmetry introduced earlier in this branch; the documented systemd topology is unaffected because its Xvfb writes a real lock.
ELI5
On headless Linux, Chromium can print a missing-display error and then segfault while tearing down its half-initialized state. Orca now validates the selected X11 or Wayland endpoint before Chromium starts and exits with actionable guidance. The bundled CLI also gains a real
--versionpath that does not need a display.What Changed
Display preflight
hasUsableLinuxDisplay()before Chromium initialization.EPERMcorrectly means the server exists under another user.--ozone-platform/ELECTRON_OZONE_PLATFORM_HINTselection is honored.serveremains excluded: it owns its existing Xvfb bootstrap, and its offscreen windows specifically require X11.CLI version
--versionand-vread the version stamped into the unpacked compiled-output package boundary.afterPackreplaces it withappInfo.version, preserving hourly/daily/adhoc channel accuracy.Why
#13719's
uv_close()backtrace is teardown, not the root cause. The sequence is:A plain GUI launch and a CLI-shaped launch that falls through to Chromium have the same failure. Starting an invisible desktop for non-serve launches would be misleading, so Orca reports the unavailable display instead.
orca-ide serveremains the supported headless service path.Linked Issue
Fixes #13719
Fixes #9212
Refs #17615 (the separate headless
serveX11/Xvfb requirement)Visual Proof
N/A — command-line behavior only; the exact before/after transcript is included below.
Before / after
The supported launcher reports the packaged build without Chromium:
Testing
pnpm tc:nodepnpm tc:cligit diff --checkStack readiness evidence on the published rebased stack (main@212c0e42): 56 changed test files, 785 tests passed, and 4 platform-gated skips. Typecheck, reliability/max-lines/runtime-Electron ratchets, changed-code quality/React Doctor, formatting, oxlint, shellcheck, and
git diff --checkpassed. The full-suite control run had 7 failures in 3 untouched files: the zsh non-ASCII wrapper rename collision, the SSH host-key mock's missingssh2.utils, and a renderer context-menu failure seen only in the full run (the isolated test passed). The zsh and SSH failures reproduce on pristineorigin/main; fresh CI is running on the published heads.Coverage includes live/stale/absent X11, another user's X server, Wayland sockets, forced Ozone selection, remote and SSH-forwarded X displays, non-Linux gating, Xvfb fallback, effective-version stamping, and malformed version metadata.
AI Disclosure
Review
PR 3 of 7, stacked on #15083.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
No wire, mobile, persistence, or provider contract changes; no mobile-facing RPC/protocol/pairing surface was touched.
The display gate is packaged-Linux-only and inert on macOS/Windows.
SSH-forwarded displays are preserved rather than rejected as missing local sockets.
Version stamping uses the existing unpacked package boundary; no artifact-layout migration is introduced.
Residual P2: a bind-mounted local X11 socket whose server PID is outside the container namespace cannot be proven live; an in-container Xvfb or nonlocal
DISPLAYform remains the practical workaround.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)User-facing regressions
Not zero. One class remains unfixed.
1. Abstract-namespace X sockets andRemoved. Abstract addresses are kernel-owned and vanish when their owner exits, so an entry inWAYLAND_SOCKETfd handoff are refused./proc/net/unixis proof of a live server — no lock file needed and no stale entry possible (verified on Ubuntu 24.04, where 139 such addresses were present).WAYLAND_SOCKETis an already-connected fd, so its presence is the display. Both are consulted only after the filesystem-socket check fails, so no existing verdict changes.orca serveexits 1 rather than running degraded whenDISPLAYis set but not verifiably live. Workaround: unsetDISPLAYand let Orca start its own Xvfb.Verified working and explicitly not regressed: X11 over SSH (
DISPLAY=localhost:10.0), XWayland, a root-owned X server (EPERM branch), absolute-pathWAYLAND_DISPLAY, and the documented systemd topology (Environment=DISPLAY=:99,User=orca).Found in review and fixed here, both confirmed on Ubuntu 24.04 hardware:
/tmp/.X11-unix, or WSLg — was declared dead and the app refused to start. An X server writes socket and lock together and both survivekill -9, so a lockless socket can only be a foreign endpoint. Now serves; verified at the X-protocol level withxlsclientsshowing Orca connected with mapped windows.:99socket that serve (running asUser=orca) cannot unlink caused a startup SIGSEGV: the failed removal was swallowed, readiness saw the surviving socket, and Chromium initialised Ozone against a dead display. Measured exit 139 before, clean exit 1 with a diagnosis after.