Skip to content

Isolate Electron runtime temp files per user#1070

Merged
ilysenko merged 1 commit into
ilysenko:mainfrom
oksure:fix/private-electron-tmpdir
Jul 18, 2026
Merged

Isolate Electron runtime temp files per user#1070
ilysenko merged 1 commit into
ilysenko:mainfrom
oksure:fix/private-electron-tmpdir

Conversation

@oksure

@oksure oksure commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • default Electron temporary files to a private per-user directory under XDG_RUNTIME_DIR
  • fall back to the app state directory when no writable runtime directory exists
  • preserve an explicitly configured TMPDIR
  • document the multi-user IPC failure mode

Problem

On a multi-user Linux host, Electron creates /tmp/codex-ipc/ipc-<uid>.sock. The first user to launch Codex owns the shared /tmp/codex-ipc parent, so another user can fail with EACCES while creating their UID-specific socket. Single-instance routing then fails, duplicate Codex Desktop processes can start, and Remote Control can immediately turn itself off.

Verification

  • bash -n launcher/start.sh.template
  • bash tests/scripts_smoke.sh
  • reproduced the original cross-user ownership failure and verified Remote Control reconnects after IPC isolation

The full smoke suite passes.

Copilot AI review requested due to automatic review settings July 18, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Linux launcher to default Electron’s temporary directory to a per-user location (preferably under XDG_RUNTIME_DIR) to avoid multi-user /tmp IPC directory ownership collisions that break single-instance routing and Remote Control.

Changes:

  • Add launcher logic to set a private default TMPDIR under $XDG_RUNTIME_DIR/$CODEX_LINUX_APP_ID/tmp, with fallback to $APP_STATE_DIR/tmp, while preserving an explicitly set TMPDIR.
  • Add a smoke test that validates the new defaulting/fallback behavior and directory permissions.
  • Document the multi-user EACCES ... /tmp/codex-ipc/ipc-<uid>.sock failure mode and mitigation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
launcher/start.sh.template Introduces configure_runtime_tmpdir to isolate Electron temp files per user and avoid shared /tmp IPC ownership issues.
tests/scripts_smoke.sh Adds a smoke test to validate the launcher’s TMPDIR isolation behavior (runtime dir, fallback, and respecting explicit TMPDIR).
docs/troubleshooting.md Documents the symptom and why updating/restarting resolves it via the new TMPDIR behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +46
if [ -n "${XDG_RUNTIME_DIR:-}" ] && [ -d "$XDG_RUNTIME_DIR" ] && [ -w "$XDG_RUNTIME_DIR" ]; then
TMPDIR="$XDG_RUNTIME_DIR/$CODEX_LINUX_APP_ID/tmp"
else
TMPDIR="$APP_STATE_DIR/tmp"
fi
mkdir -p "$TMPDIR"
chmod 700 "$TMPDIR"
export TMPDIR

@ilysenko ilysenko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head 189710f. No blockers found; CI is green and the launcher TMPDIR isolation is appropriate for core/default behavior.

@ilysenko
ilysenko merged commit 93c372e into ilysenko:main Jul 18, 2026
6 checks passed
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.

3 participants