Skip to content

fix: protect active arg0 helper dirs#17570

Open
viyatb-oai wants to merge 4 commits into
mainfrom
codex/viyatb/fix-arg0-stale-shims
Open

fix: protect active arg0 helper dirs#17570
viyatb-oai wants to merge 4 commits into
mainfrom
codex/viyatb/fix-arg0-stale-shims

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Apr 12, 2026

Summary

This keeps live arg0 helper directories from being removed during startup cleanup. Each new helper dir now writes a .pid owner sentinel, and the janitor skips directories whose owner process is still running before falling back to the existing lock-based stale cleanup.

Issues Fixed

Root Cause

Codex Desktop sessions can cache helper paths such as ~/.codex/tmp/arg0/codex-arg0*/codex-linux-sandbox. The arg0 janitor previously trusted the helper directory lock as the only signal that another process still owned the directory. On WSL-backed workspaces with CODEX_HOME on the Windows-mounted home, those advisory locks can be unreliable, so a later startup could remove another live session's helper directory. Non-escalated unified exec and apply_patch then fail with ENOENT until the app restarts.

Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai changed the title [codex] protect active arg0 helper dirs fix: protect active arg0 helper dirs Apr 12, 2026
@viyatb-oai viyatb-oai marked this pull request as ready for review April 13, 2026 21:23
@viyatb-oai viyatb-oai requested a review from bolinfest April 13, 2026 21:23
@github-actions
Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this May 20, 2026
@viyatb-oai viyatb-oai reopened this May 26, 2026
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.

Unified exec caches stale ~/.codex/tmp/arg0 session path and fails with ENOENT until app restart

1 participant