Skip to content

fix(cli): status/doctor use identity-verified live proxy - #642

Open
Wibias wants to merge 2 commits into
lidge-jun:devfrom
Wibias:fix/618-status-live-proxy
Open

fix(cli): status/doctor use identity-verified live proxy#642
Wibias wants to merge 2 commits into
lidge-jun:devfrom
Wibias:fix/618-status-live-proxy

Conversation

@Wibias

@Wibias Wibias commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • ocx status --json and ocx doctor prefer findLiveProxy() over ocx.pid alone so a healthy Task Scheduler proxy is not reported stopped.
  • Missing PID file remains a separate concern; verified live proxies report running: true.

Test plan

  • bun run typecheck
  • CI green

Closes #618

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Wibias, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 51a99db1-ee04-4081-a2b2-53a865e7813e

📥 Commits

Reviewing files that changed from the base of the PR and between ca7b104 and e172a3e.

📒 Files selected for processing (2)
  • src/cli/doctor.ts
  • src/cli/status.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@Wibias

Wibias commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Wibias, I’ll review the changes in #642, with particular attention to live-proxy verification, status/doctor behavior, and missing-PID-file edge cases.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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

@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: e87deb20e1

ℹ️ 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/cli/status.ts Outdated
const listen = selectListenTarget(config, pid, pid ? readRuntimePort(pid) : null);
const health = await checkProxyHealth(listen);
// Prefer identity-verified liveness (runtime-port + /healthz) over ocx.pid alone (#618).
const live = await findLiveProxy();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep status and doctor on the read-only config path

When the config is malformed, these new findLiveProxy() calls default their configFn to loadConfig(), which invokes warnAndBackupInvalidConfig; consequently, even with no PID/runtime record, ocx status --json and ocx doctor now create a new config.json.invalid-* file and emit a warning to stderr. This breaks the explicit read-only behavior covered by tests/cli-status-json.test.ts:244-271 and can accumulate backups every time diagnostics are run. Pass the already-read diagnostics config into findLiveProxy (and do likewise for the call in doctor.ts) or provide a non-mutating config reader.

AGENTS.md reference: AGENTS.md:L93-L95

Useful? React with 👍 / 👎.

Comment thread src/cli/status.ts
// Prefer identity-verified liveness (runtime-port + /healthz) over ocx.pid alone (#618).
const live = await findLiveProxy();
const pidFile = readPid();
const pid = live?.pid ?? pidFile;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve a null PID from orphan liveness checks

When an orphaned runtime record answers with a legacy, PID-less health response while ocx.pid names a different still-running Ocx-shaped process, findLiveProxy() deliberately returns pid: null so the stale PID is not attributed to that listener, but this nullish fallback immediately restores pidFile. The label and JSON then claim the verified live proxy has that unrelated PID, and the analogous fallbacks in doctor.ts:724,732 inspect that process as the proxy. Use live ? live.pid : pidFile so a live result's authoritative null is preserved, and cover this caller behavior with a focused regression test.

AGENTS.md reference: AGENTS.md:L93-L95

Useful? React with 👍 / 👎.

Comment thread src/cli/status.ts
? {
port: live.port,
hostname: live.hostname,
source: "runtime" as const,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve config as the source of fallback listen targets

If both PID/runtime metadata are absent or unusable but the proxy answers on config.port, findLiveProxy() succeeds through its configured-port fallback; this branch nevertheless reports listen.source as "runtime". That makes the documented JSON runtime/config source inaccurate precisely in the missing-state scenario this change handles. Have liveness return its discovery source, or retain "config" when the successful target came from the configured fallback.

AGENTS.md reference: AGENTS.md:L96-L97

Useful? React with 👍 / 👎.

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.

[Bug]: status and doctor ignore an identity-verified live proxy when ocx.pid is missing

1 participant