fix(cli): diagnose Orca Codex home mismatch#503
Conversation
📝 WalkthroughWalkthroughOpenCodex adds Windows Orca Codex-home mismatch detection, exposes it through status and doctor diagnostics, and reports effective Codex targets during sync and restore operations. JSON output, focused tests, and multilingual documentation are updated. ChangesCodex home diagnostics
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant StatusCollector
participant HomeDiagnostic
participant CodexSync
CLI->>StatusCollector: collectStatus()
StatusCollector->>HomeDiagnostic: collectOrcaCodexHomeDiagnostic()
HomeDiagnostic-->>StatusCollector: codexHome diagnostic
StatusCollector-->>CLI: status JSON and warnings
CodexSync->>HomeDiagnostic: collectCodexHomeDiagnostic()
HomeDiagnostic-->>CodexSync: effective home and mismatch guidance
CodexSync-->>CLI: target home and warning/action output
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/doctor.test.ts`:
- Around line 81-110: Extend behavioral coverage for rendered Orca mismatch
diagnostics across all affected paths. In tests/doctor.test.ts:81-110, execute
runDoctor with a simulated mismatch and assert the targeting section includes
the warning, action, and effective target. In
tests/cli-status-json.test.ts:79-85, provide the complete mismatch diagnostic
contract; at 127-130, assert deterministic mismatch output rather than only
field types. In tests/cli-restore-back.test.ts:18, replace the source-string
check with executed restore-back output assertions and add equivalent coverage
for both syncModelsToCodex branches, extracting or injecting the diagnostic
formatter as needed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2fdcc799-962a-4163-a2a6-49f0ff0c6902
📒 Files selected for processing (9)
src/cli/doctor.tssrc/cli/index.tssrc/cli/status.tssrc/codex/home.tssrc/codex/sync.tsstructure/02_config-and-codex-home.mdtests/cli-restore-back.test.tstests/cli-status-json.test.tstests/doctor.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf26fe3b45
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ca-home-diagnostic
…ca-home-diagnostic
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/reference/cli.md`:
- Around line 68-70: Revise the CLI status wording to state that warnings apply
only to the explicit, high-confidence Orca dual-home mismatch detector, not
every Windows Orca/App mismatch. Apply the same narrowed meaning consistently in
docs-site/src/content/docs/reference/cli.md:68-70,
docs-site/src/content/docs/ja/reference/cli.md:65-66,
docs-site/src/content/docs/ko/reference/cli.md:68-69,
docs-site/src/content/docs/ru/reference/cli.md:74-76, and
docs-site/src/content/docs/zh-cn/reference/cli.md:66-67, preserving each
document’s language.
In `@src/codex/home.ts`:
- Around line 202-203: Update the mismatch recovery action in the action
expression to use a Windows-executable command sequence and a shell-safe
symbolic target such as %USERPROFILE%\.codex, while keeping displayed paths
redacted. Replace the mixed POSIX unset/CMD set instructions with explicit CMD
or PowerShell equivalents, preserving the existing uninstall, rerun, and
reinstall steps.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7162bb2b-3140-4949-b656-ee3a22abf518
📒 Files selected for processing (15)
docs-site/src/content/docs/guides/codex-integration.mddocs-site/src/content/docs/ja/guides/codex-integration.mddocs-site/src/content/docs/ja/reference/cli.mddocs-site/src/content/docs/ko/guides/codex-integration.mddocs-site/src/content/docs/ko/reference/cli.mddocs-site/src/content/docs/reference/cli.mddocs-site/src/content/docs/ru/guides/codex-integration.mddocs-site/src/content/docs/ru/reference/cli.mddocs-site/src/content/docs/zh-cn/guides/codex-integration.mddocs-site/src/content/docs/zh-cn/reference/cli.mdsrc/codex/home.tssrc/codex/sync.tsstructure/02_config-and-codex-home.mdtests/codex-sync-api.test.tstests/doctor.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/codex/home.ts`:
- Line 203: Update the PowerShell recovery text in the service-remediation
message so Remove-Item and the CODEX_HOME assignment are separated with a valid
PowerShell separator such as a semicolon or distinct commands. Preserve the
existing symbolic $env:USERPROFILE target and the parallel Command Prompt
instructions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c800ccc2-40e5-4ccf-a391-184927f3b0ea
📒 Files selected for processing (7)
docs-site/src/content/docs/ja/reference/cli.mddocs-site/src/content/docs/ko/reference/cli.mddocs-site/src/content/docs/reference/cli.mddocs-site/src/content/docs/ru/reference/cli.mddocs-site/src/content/docs/zh-cn/reference/cli.mdsrc/codex/home.tstests/doctor.test.ts
|
The final late CodeRabbit finding about the PowerShell separator is valid. PR #505 contains the minimal follow-up against |
|
Follow-up PR #505 is now merged into |
Summary
CODEX_HOMEsemantics while detecting the high-confidence Windows Orca runtime-home mismatchocx doctorand human/JSONocx statusrestore backoutput with the exact redacted target homeValidation
bun test tests/doctor.test.ts tests/cli-status-json.test.ts tests/codex-sync-api.test.ts tests/cli-restore-back.test.ts(39 passed)bun run typecheckCloses #497
Summary by CodeRabbit
New Features
ocx status,ocx doctor, sync, and restore output.ocx status --jsonnow includes acodexHomeobject witheffectiveCodexHome,appCodexHome,mismatch,warning, andaction.Documentation
Tests
codexHomefields and Windows mismatch scenarios.