Skip to content

fix(codex): a transcript lookup miss creates no Codex directories - #29557

Merged
nwparker merged 1 commit into
mainfrom
fix/codex-session-discovery-no-mkdir
Oct 16, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/codex-session-discovery-no-mkdir

Conversation

@nwparker

@nwparker nwparker commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​89 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​89
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20

ELI5

When Orca is waiting for a chat transcript file to appear, it checks every 5 seconds. One of those checks asked a helper for "the Codex folders to look in", and that helper also created Orca's private Codex folder as a side effect. So people who had never used Codex ended up with an empty codex-runtime-home/home folder in Orca's data directory. Looking for a file should never create folders. Now the lookup only computes the folder paths and creates nothing.

What Changed

Before: on a lookup miss, the session-file resolver's per-account tier (codexAccountSessionsDirs → hostAdditionalCodexHomePaths) called getHostCodexHomePathsForSessionDiscovery(). Its first entry came from this.getRuntimeHomePath(), which is getOrcaManagedCodexHomePath(), and that runs mkdirSync. The resolver's own comment already says this poll must not create that folder, and its first tier already used the path-only resolver; the per-account tier added in #28469 went around it. Every miss also ran the per-account ownership checks (synchronous stat, realpath and marker reads, plus a warning) even when the managed accounts folder didn't exist at all.

After:

  • getHostCodexHomePathsForSessionDiscovery() uses the existing path-only resolveOrcaManagedCodexHomePath(). It is the same path string, minus the mkdirSync. Launch, hooks, the config mirror and the session bridge still create the folder through the original getter, exactly when they need it.
  • getManagedAccountHomesForSessionDiscovery() checks the managed accounts root once per call. If it is definitively absent (ENOENT/ENOTDIR), it skips the host-account ownership checks. No host account home can be "owned" without that root, so the result is the same, just without the disk reads and the per-poll warning. Any other error (EPERM, EBUSY, ...) still goes to the ownership check, which reports it as "indeterminate" (#STA-4422). WSL account homes are still listed.

Why

The audit asked for a non-creating resolver, reusing one if it existed. resolveOrcaManagedCodexHomePath() already exists and is what the resolver's first tier and the launch-route prediction already use, so no new read-only variant was needed. All callers of getHostCodexHomePathsForSessionDiscovery() were checked: AI Vault listing, orcad's listCodexSessionHomes, and Codex resume's trusted-home list. They only list or compare paths, and a missing home just lists as empty. None depended on the folder being created.

Linked Issue

Follow-up to #28469 (which added the per-account lookup tier). Found in a post-merge audit.

Visual Proof

N/A: no UI change. The only visible difference is that no stray folder appears in Orca's data directory.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

New src/main/codex-accounts/runtime-home-session-discovery-read-only.test.ts wires the real CodexRuntimeHomeService into the real resolveSessionFilePath. It starts from a userData with no Codex mirror and no accounts folder (but one persisted host account), and runs two lookup misses. It asserts that:

  • nothing new appears in userData;
  • codex-runtime-home/home does not exist;
  • no ownership warning was logged;
  • discovery still lists the mirror path.

I confirmed it fails with the old code. The existing codex-accounts, session-file-resolver, AI Vault resume and Codex resume/startup tests pass (69 files, 530 tests), and so do pnpm tc and check:code-quality:changed.

AI Disclosure

Review

An adversarial review found nothing blocking. It checked every caller for reliance on the mkdir: none, and the path string is identical. It also checked that skipping the account checks when the root is missing can never drop a home that would have been "owned", because ownership requires realpath(root) to succeed. It noted, and I left unchanged: when the root exists but one account's home was deleted, each poll still logs the existing "untrusted" warning, as before.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Host-local only. SSH transcripts are read from the path the remote hook reports and never use this tier. WSL account homes are listed exactly as before.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 67a15c89-bec5-4d92-a5cf-bf8dbc88b271
📥 Commits

Reviewing files that changed from the base of the PR and between 1c03dd79979cdcc90bf1e30d08a03d4a72c60e53 and 320b74b.

📒 Files selected for processing: 3
  • src/main/codex-accounts/runtime-home-service-home-routing.ts
  • src/main/codex-accounts/runtime-home-service-managed-home.ts
  • src/main/codex-accounts/runtime-home-session-discovery-read-only.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fcde68dc-5f2e-4ee6-a587-7ad1d0458518
📥 Commits

Reviewing files that changed from the base of the PR and between 127704b and 1c03dd79979cdcc90bf1e30d08a03d4a72c60e53.

📒 Files selected for processing: 3
  • src/main/codex-accounts/runtime-home-service-home-routing.ts
  • src/main/codex-accounts/runtime-home-service-managed-home.ts
  • src/main/codex-accounts/runtime-home-session-discovery-read-only.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Session discovery now starts from the Orca-managed Codex home. Managed-account home resolution skips host ownership checks when the managed-accounts root is definitively absent, while retaining WSL homes. A new test checks repeated lookup misses, absence of warnings, and that lookup does not create a runtime home or change user-data contents.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 1c03d

No actionable issue is identified that would prevent merging after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description is complete and follows the repository template. It explains the user impact, changes, rationale, linked issue context, testing, compatibility considerations, and checklist status. The…
Title check Passed The title clearly and concisely describes the primary change: preventing transcript lookup misses from creating Codex directories.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the user impact, changes, rationale, linked issue context, testing, compatibility considerations, and checklist status. The issue is referenced as a follow-up to #28469 rather than using a Fixes link, and the AI Disclosure section is blank, but these omissions do not prevent a mostly complete assessment.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The per-account tier of the session-file resolver listed homes through
getHostCodexHomePathsForSessionDiscovery, which reached the mkdir-ing
getOrcaManagedCodexHomePath. The transcript poll runs every 5 s on a miss, so
users who never used Codex got userData/codex-runtime-home/home created. Use
the path-only resolver for discovery, and skip the per-account ownership
checks while the managed accounts root does not exist.

Follow-up to #28469.
@nwparker
nwparker force-pushed the fix/codex-session-discovery-no-mkdir branch from 1c03dd7 to 320b74b Compare October 16, 2026 09:15
@nwparker
nwparker merged commit d9521f9 into main Oct 16, 2026
31 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.

1 participant