Skip to content

fix(cli): diagnose Orca Codex home mismatch#503

Merged
Ingwannu merged 5 commits into
devfrom
agent/fix-issue-497-orca-home-diagnostic
Jul 26, 2026
Merged

fix(cli): diagnose Orca Codex home mismatch#503
Ingwannu merged 5 commits into
devfrom
agent/fix-issue-497-orca-home-diagnostic

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • preserve explicit CODEX_HOME semantics while detecting the high-confidence Windows Orca runtime-home mismatch
  • surface the effective/app homes and actionable service-migration warning in ocx doctor and human/JSON ocx status
  • redact OS usernames from every new displayed/JSON/logged Codex-home path
  • qualify sync and restore back output with the exact redacted target home
  • document the behavior in English, Korean, Japanese, Chinese, and Russian CLI/Codex integration guides

Validation

  • 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 typecheck
  • docs-site production build (131 pages) passed

Closes #497

Summary by CodeRabbit

  • New Features

    • Added Codex home targeting diagnostics to ocx status, ocx doctor, sync, and restore output.
    • Windows Orca/App home mismatches now emit warnings with redacted effective/app homes and remediation action guidance.
    • ocx status --json now includes a codexHome object with effectiveCodexHome, appCodexHome, mismatch, warning, and action.
  • Documentation

    • Updated Codex integration and CLI reference docs (including examples) to describe the new diagnostics and recovery flow.
  • Tests

    • Extended CLI/API and doctor tests to validate the new codexHome fields and Windows mismatch scenarios.

@Ingwannu
Ingwannu requested a review from lidge-jun as a code owner July 26, 2026 13:02
@github-actions github-actions Bot added the bug Something isn't working label Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

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

Changes

Codex home diagnostics

Layer / File(s) Summary
Diagnostic contract and detection
src/codex/home.ts, tests/doctor.test.ts
Adds OrcaCodexHomeDiagnostic, detects Windows Orca runtime-home mismatches against the app .codex home, and tests mismatch, aligned, and custom-home cases.
Status and doctor reporting
src/cli/status.ts, src/cli/doctor.ts, src/cli/index.ts, tests/cli-status-json.test.ts, docs-site/src/content/docs/{ja,ko,...}/reference/cli.md
Adds codexHome to status JSON and reports effective homes, warnings, and actions in status and doctor output.
Sync and restore target messaging
src/codex/sync.ts, src/cli/index.ts, tests/codex-sync-api.test.ts, tests/cli-restore-back.test.ts
Logs effective Codex targets during both sync paths and restore-back, with default and mismatch logging assertions.
Policy and CLI documentation
structure/02_config-and-codex-home.md, docs-site/src/content/docs/guides/*, docs-site/src/content/docs/{ja,ko,ru,zh-cn}/guides/*, docs-site/src/content/docs/reference/cli.md, docs-site/src/content/docs/{ja,ko,ru,zh-cn}/reference/cli.md
Documents Windows Orca/App home behavior, redacted diagnostic paths, remediation guidance, and the extended status JSON shape across localized guides and references.

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
Loading

Possibly related PRs

Suggested labels: enhancement, documentation

Suggested reviewers: lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: diagnosing the Orca Codex home mismatch in the CLI.
Linked Issues check ✅ Passed The changes satisfy #497 by detecting the Windows Orca/app-home mismatch, redacting paths, warning on migration, and preserving explicit custom homes.
Out of Scope Changes check ✅ Passed The added tests, docs, and CLI/status updates all support the mismatch-detection fix and do not introduce obvious unrelated scope.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-issue-497-orca-home-diagnostic

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 911373d and cf26fe3.

📒 Files selected for processing (9)
  • src/cli/doctor.ts
  • src/cli/index.ts
  • src/cli/status.ts
  • src/codex/home.ts
  • src/codex/sync.ts
  • structure/02_config-and-codex-home.md
  • tests/cli-restore-back.test.ts
  • tests/cli-status-json.test.ts
  • tests/doctor.test.ts

Comment thread tests/doctor.test.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/codex/sync.ts
Comment thread src/cli/index.ts
Comment thread src/codex/sync.ts Outdated
Comment thread src/codex/home.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between cf26fe3 and 8efe4f1.

📒 Files selected for processing (15)
  • docs-site/src/content/docs/guides/codex-integration.md
  • docs-site/src/content/docs/ja/guides/codex-integration.md
  • docs-site/src/content/docs/ja/reference/cli.md
  • docs-site/src/content/docs/ko/guides/codex-integration.md
  • docs-site/src/content/docs/ko/reference/cli.md
  • docs-site/src/content/docs/reference/cli.md
  • docs-site/src/content/docs/ru/guides/codex-integration.md
  • docs-site/src/content/docs/ru/reference/cli.md
  • docs-site/src/content/docs/zh-cn/guides/codex-integration.md
  • docs-site/src/content/docs/zh-cn/reference/cli.md
  • src/codex/home.ts
  • src/codex/sync.ts
  • structure/02_config-and-codex-home.md
  • tests/codex-sync-api.test.ts
  • tests/doctor.test.ts

Comment thread docs-site/src/content/docs/reference/cli.md Outdated
Comment thread src/codex/home.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8efe4f1 and cf7c30a.

📒 Files selected for processing (7)
  • docs-site/src/content/docs/ja/reference/cli.md
  • docs-site/src/content/docs/ko/reference/cli.md
  • docs-site/src/content/docs/reference/cli.md
  • docs-site/src/content/docs/ru/reference/cli.md
  • docs-site/src/content/docs/zh-cn/reference/cli.md
  • src/codex/home.ts
  • tests/doctor.test.ts

Comment thread src/codex/home.ts
@Ingwannu
Ingwannu merged commit 94b1437 into dev Jul 26, 2026
14 checks passed

Copy link
Copy Markdown
Owner Author

The final late CodeRabbit finding about the PowerShell separator is valid. PR #505 contains the minimal follow-up against dev: replace the prose and with an executable PowerShell semicolon and regression-test the exact separator. Local focused tests (26) and TypeScript typecheck pass; I will merge it only after its required CI is green.

Copy link
Copy Markdown
Owner Author

Follow-up PR #505 is now merged into dev (9d1bb146). The PowerShell remediation uses a valid semicolon separator, the focused doctor regression is pinned, and all 12 required CI checks passed across Ubuntu, macOS, and Windows.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant