Isolate Electron runtime temp files per user#1070
Merged
Merged
Conversation
There was a problem hiding this comment.
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
TMPDIRunder$XDG_RUNTIME_DIR/$CODEX_LINUX_APP_ID/tmp, with fallback to$APP_STATE_DIR/tmp, while preserving an explicitly setTMPDIR. - Add a smoke test that validates the new defaulting/fallback behavior and directory permissions.
- Document the multi-user
EACCES ... /tmp/codex-ipc/ipc-<uid>.sockfailure 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 |
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.
Summary
XDG_RUNTIME_DIRTMPDIRProblem
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-ipcparent, so another user can fail withEACCESwhile 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.templatebash tests/scripts_smoke.shThe full smoke suite passes.