Skip to content

fix(server): use Linux home for Codex probe cwd on WSL drvfs mounts - #8956

Closed
mznouira wants to merge 2 commits into
pingdotgg:mainfrom
mznouira:fix/wsl-codex-probe-cwd
Closed

mznouira wants to merge 2 commits into
pingdotgg:mainfrom
mznouira:fix/wsl-codex-probe-cwd

Conversation

@mznouira

@mznouira mznouira commented Aug 31, 2026 •

Copy link
Copy Markdown

Summary

Fixes Codex provider status timeouts on T3 Code desktop when the WSL backend runs with process.cwd() on a Windows profile mounted at /mnt/c/....

Closes #8955

When probing Codex app-server status, skills/list can hang for many seconds on drvfs paths. T3's auth probe times out after 10s, which surfaces as "Timed out while checking Codex app-server provider status." even though Codex is installed and authenticated.

This change introduces resolveCodexProbeCwd() and uses $HOME (or Node homedir) for Codex provider probes when the server cwd is under /mnt/.

Test plan

  • bun run test src/provider/Layers/codexProbeCwd.test.ts
  • bun run test src/provider/Layers/ProviderRegistry.test.ts -t "uses Linux home for Codex probe cwd"
  • Manual: T3 Code desktop on WSL-only backend → Codex provider shows Ready instead of timing out

Made with Cursor

Note

Use Linux home as Codex probe cwd on WSL /mnt/ drvfs mounts

  • Introduces resolveCodexProbeCwd in codexProbeCwd.ts, which returns the server cwd as-is unless it starts with /mnt/, in which case it prefers the expanded HOME env var (falling back to NodeOS.homedir() when HOME is blank)
  • Updates checkCodexProviderStatus in CodexProvider.ts to pass the resolved cwd to the probe instead of process.cwd()
  • Adds unit tests for resolveCodexProbeCwd edge cases and an integration test that spies on process.cwd to verify HOME is used on /mnt/ paths
  • Risk: if HOME is unset and NodeOS.homedir() also returns empty on a /mnt/ path, the original /mnt/ cwd is returned unchanged — probe behavior on drvfs stays as before in that edge case

Macroscope summarized a9cd5cc.

Summary by CodeRabbit

  • Bug Fixes

    • Improved Codex provider detection when the server runs from a Windows-mounted path in WSL.
    • Probes now use the appropriate home directory, including support for configured and fallback home paths.
    • Preserved existing behavior for native Linux paths and expanded home-directory shortcuts.
  • Tests

    • Added coverage for WSL-mounted paths, home-directory resolution, tilde expansion, and fallback behavior.

When the desktop WSL backend starts with process.cwd() on /mnt/c/…,
Codex app-server skills/list can hang long enough to exceed the auth
probe timeout. Prefer HOME for provider probes in that case.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 31, 2026
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 404a7b25-4be1-47ec-8a3b-8c445f0bd73d

📥 Commits

Reviewing files that changed from the base of the PR and between 31c1c59 and 892f7a4.

📒 Files selected for processing (4)
  • apps/server/src/provider/Layers/CodexProvider.ts
  • apps/server/src/provider/Layers/ProviderRegistry.test.ts
  • apps/server/src/provider/Layers/codexProbeCwd.test.ts
  • apps/server/src/provider/Layers/codexProbeCwd.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Codex provider status check now resolves /mnt/ working directories to a Linux home directory before probing. Tests cover native paths, HOME handling, tilde expansion, fallback behavior, and provider integration.

Changes

Codex provider probe working directory

Layer / File(s) Summary
Working-directory resolution and unit coverage
apps/server/src/provider/Layers/codexProbeCwd.ts, apps/server/src/provider/Layers/codexProbeCwd.test.ts
Adds resolveCodexProbeCwd, which preserves native paths and resolves /mnt/ paths through HOME or the Node home directory. Tests cover the supported path and fallback cases.
Provider status integration
apps/server/src/provider/Layers/CodexProvider.ts, apps/server/src/provider/Layers/ProviderRegistry.test.ts
checkCodexProviderStatus passes the resolved cwd to the Codex probe. Integration coverage verifies that a /mnt/ cwd uses the configured Linux home directory.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 892f7

This localized change redirects Codex status probes to the Linux home directory on WSL-mounted paths, with targeted tests covering the behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: t3dotgg, juliusmarminge

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Codex probe cwd fix for WSL drvfs mounts, which is the main change.
Description check ✅ Passed The description explains the problem, the solution, the linked issue, and the test plan. UI changes are not applicable, and the remaining manual test is clearly identified.
Linked Issues check ✅ Passed The changes directly address issue #8955 by using the Linux home directory for Codex probes when the server cwd is under /mnt/, while preserving existing behavior for other paths.
Out of Scope Changes check ✅ Passed All changes are limited to the Codex probe cwd helper, its provider integration, and focused unit and integration tests. No unrelated changes are present.
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 4…
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 4 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


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

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One finding: the new diagnostic suppression in apps/server/src/provider/Layers/codexProbeCwd.ts lacks an adjacent rationale comment.

Posted via Macroscope — Effect Service Conventions

@@ -0,0 +1,25 @@
// @effect-diagnostics nodeBuiltinImport:off

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This new diagnostic suppression has no adjacent explanation of why the diagnostic must be disabled here (the JSDoc below documents the WSL behavior, not the suppression). Consider adding a trailing rationale, matching the repo pattern in e.g. apps/server/scripts/t3-sqlite-state.ts.

Suggested change
// @effect-diagnostics nodeBuiltinImport:off
// @effect-diagnostics nodeBuiltinImport:off - node:os resolves the Linux home fallback in a pure helper that runs outside any Effect runtime.

Posted via Macroscope — Effect Service Conventions

@macroscopeapp

macroscopeapp Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This is a narrowly scoped WSL-specific Codex probe fix with focused tests and limited runtime blast radius. It also adds a production-file static-analysis suppression directive, which requires human review under the repository’s review policy.

You can add or adjust custom eligibility rules. Learn more.

@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for the PR. We're not taking changes to the orchestration and provider layers right now: that part of the server is being rewritten for V2, and merging into the current code would either conflict with or be thrown away by that work.

Closing for now. If this is still an issue once V2 lands, please reopen (or open a fresh PR against the new code) and we'll take a proper look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex provider probe times out on WSL when server cwd is on /mnt/c drvfs

2 participants