Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedmznouira(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/8956/headopened View on GitHub

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.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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 31c1c5996f88e3acf1566adc11c9b51ac7561554 and 892f7a4d685c8d92a4ab15d84f1881b059f29985.

      📒 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 nameStatusExplanation
      Title check✅ PassedThe title clearly identifies the Codex probe cwd fix for WSL drvfs mounts, which is the main change.
      Description check✅ PassedThe 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✅ PassedThe 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✅ PassedAll 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✅ PassedNo 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.
    3. 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 @@
      1+// @effect-diagnostics nodeBuiltinImport:off
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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
      1-// @effect-diagnostics nodeBuiltinImport:off
      1+// @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
    4. 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. 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.

    6. 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.

    7. juliusmarminge closed this

Sign in to join this conversation.