Skip to content

fix(rate-limits): recover WSL Codex usage RPC refresh (#7567) - #7658

Merged
Jinwoo-H merged 2 commits into
stablyai:mainfrom
rodboev:pr/orca-7567-wsl-codex-usage-rpc
Jul 9, 2026
Merged

Jinwoo-H merged 2 commits into
stablyai:mainfrom
rodboev:pr/orca-7567-wsl-codex-usage-rpc

Conversation

@rodboev

@rodboev rodboev commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the Windows+WSL Codex usage refresh path so Orca launches the background Codex app-server RPC through the same interactive WSL shell shape used by WSL Codex login.
  • Keeps the selected WSL CODEX_HOME, hidden rate-limit working directory, host env cleanup, Windows no-PTY-fallback policy, and host/non-WSL command paths unchanged.

Closes #7567.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that catch the WSL launch regression, host-path negative space, and PTY fallback preservation.

Focused validation run after rebasing onto current main:

  • pnpm exec vitest run --config config/vitest.config.ts src/main/rate-limits/codex-fetcher.test.ts - passed, 15 tests.
  • pnpm run typecheck:node - passed.
  • Windows+WSL owner proof - not run; manual-owner-proof remains required on a live Windows 11 WSL2 Codex environment.

AI Review Report

The diff is scoped to the Windows WSL Codex rate-limit child process launcher and its tests. Cross-platform behavior outside that path is unchanged by construction.

Review points:

  • Windows and WSL path handling stay centralized in buildWslCodexCommand.
  • Hidden subprocess launch behavior stays intact through the existing windowsHide and hidden cwd setup.
  • CODEX_HOME remains scoped to the WSL child environment and is stripped from the host env in that path.
  • Host and non-WSL Codex homes still route through the existing host spawn logic.
  • No UI, SSH, browser, shortcut, remote-runtime, or provider-selection code changed.

Security Audit

The change adds no IPC surface, storage format, credential format, network endpoint, dependency, or new subprocess type.

Security properties preserved:

  • The selected Codex home stays scoped to the subprocess environment.
  • Host CODEX_HOME is still removed for WSL children.
  • The WSL launch path stays hidden and background-only.
  • The host command path continues to resolve through the existing Windows spawn helper.

Notes

Thanks to @euclodius for isolating that both the system default WSL Codex home and a separate Orca-managed WSL Codex home can authenticate and return rateLimits from inside WSL.

Live recovery still needs manual-owner-proof on a Windows+WSL profile with shell-initialized Codex.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 73b98072-88d7-4660-8571-f2abf4486315

📥 Commits

Reviewing files that changed from the base of the PR and between 6ba1a63 and 081b724.

📒 Files selected for processing (2)
  • src/main/rate-limits/codex-fetcher.test.ts
  • src/main/rate-limits/codex-fetcher.ts

📝 Walkthrough

Walkthrough

The Codex RPC launch path now builds WSL commands through shared login-shell and escaping helpers, with optional RPC stdio isolation enabled for the WSL RPC path. Tests were updated to assert the new WSL command composition more precisely, cover the PTY fallback command shape, and verify that on Windows with a host Codex home path the RPC path spawns codex directly with CODEX_HOME set in the child environment.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main fix for WSL Codex usage RPC refresh.
Description check ✅ Passed It covers the required summary, testing, AI review, security, and notes, with only the non-critical screenshots section omitted.
Linked Issues check ✅ Passed The changes address the Windows+WSL Codex usage refresh regression by fixing the WSL RPC launch path and adding targeted tests.
Out of Scope Changes check ✅ Passed The diff stays scoped to the WSL Codex rate-limit launcher and its tests, with no unrelated feature or behavior changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@euclodius

Copy link
Copy Markdown

This looks like the right fix for the Codex usage/rate-limit RPC failure in #7567.

One small cross-link to avoid conflating two Codex WSL symptoms: #6907 is still the Codex agent-status/sidebar path, not the usage RPC path. The local #6907 diagnostics suggested Codex sidebar status needs Codex hook events (SessionStart / UserPromptSubmit / Stop) to cross the WSL -> Windows listener boundary. This PR appears scoped to launching the background Codex app-server RPC through the interactive WSL shell for usage refresh, so I would not expect it to close #6907 by itself.

Happy to retest both separately once the relevant PRs land.

@Jinwoo-H Jinwoo-H 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.

Thanks @rodboev — confirmed the WSL usage refresh direction and tested it with a real managed WSL Codex account.

I added follow-up hardening before landing:

  • use Orca's configured interactive login shell rather than Bash-only startup
  • isolate Codex JSON-RPC streams from shell startup files
  • preserve PTY, host, account-home, and bounded-cwd behavior
  • expand Windows/WSL regression coverage

Focused tests, typechecking, current-main integration, and cold/repeat Electron refresh validation pass.

@Jinwoo-H
Jinwoo-H merged commit 33f59ad into stablyai:main Jul 9, 2026
1 check passed
Jinwoo-H added a commit that referenced this pull request Jul 10, 2026
Clean auto-merge, no conflicts (109 files, +7490 from main). Brought in:
- Codex WSL runtime status hooks (#7969); WSL/SSH agent path resolution past
  shell aliases (#7867); WSL source-control path separators (#7966); WSL
  GitLab-auth wake fix (#7967); WSL Codex usage RPC refresh (#7567/#7658)
- Improve workspace cleanup list (#7053) + background removal
- mobile: per-host connection log + Tailscale wedge recovery (#7984/#7980),
  wake slept agents on mobile worktree open (#7906)
- Harden layout validation, watcher lifecycle, connection robustness (#7924)
- Disable experimental worktree card style by default (#7977)

Perf-branch structure preserved (clean auto-merge). typecheck 0 errors; lint 0
errors. CI is the release gate (local runs skipped per env lag).

Co-authored-by: Orca <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…stablyai#7658)

* fix(codex): launch WSL usage RPC through interactive shell (stablyai#7567)

* fix(codex): harden WSL usage RPC shell startup

---------

Co-authored-by: Jinwoo Hong <[email protected]>
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.

[Bug]: Codex status-bar usage refresh fails after v1.4.124 on Windows + WSL

3 participants