Skip to content

fix(doctor): name the cause of an ownership-unknown native-main fence - #8988

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
scy7796:fix/doctor-native-main-ownership-reason
Nov 21, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
scy7796:fix/doctor-native-main-ownership-reason

Conversation

@scy7796

@scy7796 scy7796 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When native-main admission is fenced for ownership-unknown or foreign-ownership, ocx doctor prints only the category. The service-manager inspection behind the fence returns a specific reason, but the admission route carries only the category, by design, so it does not expose paths. On my machine the fence stayed up for several days: Claude and Codex only showed "native-main profile maintenance is active; retry", and doctor showed reason: ownership-unknown. The cause was a service wrapper that had been edited by hand, so the probe no longer recognized it as generated.

For those two fence reasons only, doctor now repeats the same read-only inspectNativeCodexOwnership() locally and prints one more line under the fence:

  !!  native-main admission is fenced (reason: ownership-unknown)
       Native model requests return 503 until this clears. Resolve native Codex ownership evidence, then restart the proxy.
       Local re-check (unknown): the launcher wrapper does not look like a generated opencodex service wrapper: C:\Users\...\.opencodex\opencodex-service.cmd

The admission route and the proxy are unchanged. The re-check runs in the doctor process with doctor's own environment, so it can disagree with the running proxy if their homes differ; that is why the line says "Local re-check". An inspection that throws is printed as inspection failed: ... and does not stop doctor.

Verification

On Windows 11 (26200), Bun 1.4.4, at d61cca122:

  • bun test tests/codex-integration/doctor.test.ts: 87 pass, 7 fail. Before the change: 85 pass and the same 7 fail. All 7 are runDoctor end-to-end tests that hit the 5 s timeout on this machine (reclaim wiring, spill report wiring, unclean prior exit). The 2 new tests pass: formatting and fence selection, and a throwing re-check. The existing runDoctor reports a separate fenced service process test now also checks that the Local re-check ( line is printed.
  • The reason in the example above is what inspectNativeCodexOwnership() returned on 2.100.0 and 2.100.1 for that wrapper (a --preload argument added to the launch line).
  • bun run typecheck passes.
  • I did not run the full bun run test, because a full run takes longer than 15 minutes on this machine. The rest is left to CI.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

🤖 Generated with Claude Code

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features
    • Admission diagnostics can now include a local ownership re-check when a running proxy reports an ownership-related block.
    • Blocked-admission output shows the re-check result when available. The inspection is read-only, and if it fails, the result is reported as unknown with a reason.

When native-main admission is fenced for ownership-unknown or
foreign-ownership, doctor printed only the category. The inspection that
produced it already knows the cause, for example a service wrapper that does
not match the generated one, but the admission route deliberately carries no
paths.

Doctor now repeats the same read-only inspection locally and prints its
verdict and reason under the fence line. A failing inspection is reported
instead of aborting doctor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ✅ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

✅ 4/4 boxes ticked.

This pull request has been marked Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers notified: @lidge-jun @Ingwannu

Hygiene

✅ Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as draft November 20, 2026 06:53
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The doctor command now performs a local ownership inspection when native-main admission is blocked by an ownership-related fence. It adds the inspection result to the blocked-admission output when available, and reports inspection errors as an unknown ownership result.

Changes: Native-main ownership diagnostics

Layer / File(s) Summary
Conditional ownership re-check and output
src/cli/doctor.ts, tests/codex-integration/doctor.test.ts
The doctor command identifies ownership-related admission fences and runs a local inspection only for those fences. The formatter can include the local ownership result and reason. If inspection throws, the helper returns an unknown result with a failure reason. Tests cover fence classification, formatting, inspection errors, and end-to-end output.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant runDoctor
  participant isOwnershipFence
  participant localOwnershipRecheck
  participant inspectNativeCodexOwnership
  participant formatNativeMainAdmissionLines
  runDoctor->>isOwnershipFence: Check admission report
  alt Ownership fence
    runDoctor->>localOwnershipRecheck: Inspect local ownership
    localOwnershipRecheck->>inspectNativeCodexOwnership: Read local ownership
    inspectNativeCodexOwnership-->>localOwnershipRecheck: Ownership inspection
    localOwnershipRecheck-->>runDoctor: Inspection result or unknown with reason
  end
  runDoctor->>formatNativeMainAdmissionLines: Format report with optional re-check
Loading

Possibly related PRs

  • lidge-jun/opencodex#8111: This PR also changes doctor output for the foreign-ownership admission case and addresses the home assumptions behind that diagnostic.
Merge Risk: Minimal · up to 2cc38

This change makes ocx doctor explain why native-main admission is fenced by ownership by printing a local re-check result. It is read-only and does not change admission behavior. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: doctor now states the cause of an ownership-unknown native-main fence. The summary and objectives describe a local read-only ownership re-check whose verdict and reason are…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the change: doctor now states the cause of an ownership-unknown native-main fence. The summary and objectives describe a local read-only ownership re-check whose verdict and reason are printed under the fence message, which matches the title. The title is short, specific, and uses the conventional fix(doctor) prefix.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d61cca1 and 2cc3883.

Files selected for processing: 2

  • src/cli/doctor.ts
  • tests/codex-integration/doctor.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@github-actions
github-actions Bot marked this pull request as ready for review November 20, 2026 15:39
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration into dev (per MAINTAINERS.md; maintainer integration, not an independent approval)

  • Exact head: 2cc3883511257fdc65a5bd65b34d1c834282f64c
  • Checks on this head: 16 passed, 13 skipped, none pending or failing (Ubuntu PR CI; Windows/macOS are covered by the next dev batch gate).
  • Review threads: none unresolved.
  • Review: gpt-6.1-terra, two rounds, final verdict PASS (read-only recheck, bounded service queries, core/Lab boundary test 25 pass, privacy scan passed).
  • Regression: tests/codex-integration/doctor.test.ts passes on this head (94 pass) and fails with src/cli/doctor.ts restored from dev.

@lidge-jun
lidge-jun merged commit 7932717 into lidge-jun:dev Nov 21, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants