Repository navigation
Conversation
📝 WalkthroughWalkthroughThe runtime home service now sweeps stale marketplace staging and backup directories during startup and WSL runtime-home setup. The sweep uses directory name prefixes plus a one-hour age threshold, and it ignores filesystem errors and races. New tests cover aged and fresh staging directories, unrelated directories, missing marketplace trees, and WSL-specific cleanup behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6adb5405-c9e1-4dda-b9ba-87e9d91087ab
📥 Commits
Reviewing files that changed from the base of the PR and between 01417f6 and aaa4c43c9eb0ad369e6ac11d242b34eda52d7da1.
📒 Files selected for processing (2)
src/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/runtime-home-service.ts
aaa4c43 to
ed72a09
Compare
ed72a09 to
8a49e07
Compare
Summary
Codex CLI stages git-sourced marketplace upgrades/adds by cloning the full repo (~100-230 MB each, mostly
.githistory) into<CODEX_HOME>/.tmp/marketplaces/.staging/marketplace-upgrade-*(andmarketplace-add-*) before atomically swapping it into place. If the CLI is killed, crashes, or a clone times out mid-sync, the staging clone is orphaned and can accumulate indefinitely under Orca's managed Codex runtime home.This is an upstream Codex bug (openai/codex#21005, openai/codex#29994). Orca does not pin the user's Codex CLI version, but it owns the runtime home the leak lands in, so this PR bounds the disk growth for Orca-launched Codex sessions.
The sweep removes only aged orphan dirs matching these exact upstream temp prefixes:
.tmp/marketplaces/.staging/marketplace-upgrade-*.tmp/marketplaces/.staging/marketplace-add-*.tmp/marketplaces/marketplace-backup-*It runs for the host runtime home on startup and for WSL runtime homes when the WSL selection is synced.
Screenshots
No visual change.
Testing
pnpm exec vitest run src/main/codex-accounts/runtime-home-service.test.tspnpm exec tsgo --noEmit -p config/tsconfig.node.jsonpnpm exec oxlint src/main/codex-accounts/runtime-home-service.ts src/main/codex-accounts/runtime-home-service.test.tspnpm exec oxfmt --write src/main/codex-accounts/runtime-home-service.ts src/main/codex-accounts/runtime-home-service.test.tsAI Review Report
Reviewed the cleanup for race safety, cross-platform behavior, and repo-fit. The review flagged that checking only the staging root directory
mtimecould delete a long-running clone whose recent writes happen deeper under.git/objects; the implementation now compares the newest mtime anywhere in the candidate subtree before deleting. The review also checked macOS/Linux/Windows path handling, including WSL UNC runtime homes; the code keepspath.join/Node fs handling already used byCodexRuntimeHomeServicefor WSL runtime-home files and leaves shell-specific WSL symlink migration unchanged.Security Audit
This change does not add IPC, network calls, command execution, dependencies, or auth handling. Path deletion is constrained to Orca's managed Codex runtime home, exact known Codex marketplace temp prefixes, and dirs whose newest subtree activity is older than one hour. The sweep is best-effort and fail-open: filesystem errors are logged and never block runtime-home setup or Codex launch.
Notes
The upstream Codex issues remain open and no upstream cleanup PR is currently merged. This Orca-side sweep is defensive and can be removed later if Orca starts pinning a Codex version that includes upstream marketplace temp cleanup.
X: @wolfie_
ELI5
Installing or updating a plugin can leave temporary copies behind. This PR tries to clean them up, but it still needs a way to prove a copy is unused and avoid making Orca pause while scanning it.
Readiness review — 2026-09-08
Held — redesign required. The original cleanup still conflicts with the current runtime-home split. Extracted fixture probe: 10,001 synchronous stats, three listings, 53.24ms blocked for 10,000 fresh files. Cleanup needs bounded asynchronous work outside launch and established ownership/orphan proof before deletion. Age alone does not establish ownership; no data loss was proven. Three counsel seats classify measured performance finding P2. No branch changes or cleanup against user homes performed.
Visual proof
Not applicable as rendered UI proof. Needs bounded async cleanup and ownership proof. No data loss proven. The functional evidence is the tests or probe recorded in the readiness review; an illustrative screenshot would not establish correctness.