Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: ocx status/doctor flap service=viable vs service=absent while launchd service is running (2.77.0 macOS)

Closed
#6,575 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
macos, typescript
Domain
cli, devtools

Research direction

Run the provided repeated ocx status and ocx doctor reproduction while checking ocx service status, launchd state, and /healthz; compare the inconsistent results with the class of issue described in #5975. Trace how the CLI commands determine service viability and ownership, then check whether both commands agree when the service is healthy. Done means they consistently report service=viable / protected in that condition.

Written by the indexing model from the issue text.

Description

bug cli platform service

Summary

On macOS 2.77.0 with a healthy LaunchAgent-managed proxy, ocx status and ocx doctor intermittently report service=absent / "AT RISK for Codex Desktop after restart" while:

  1. launchctl print gui/$(id -u)/com.opencodex.proxy shows state = running
  2. ocx service status consistently reports installed and loaded (launchd)
  3. GET /healthz returns ok for the same PID

Sometimes ocx status and ocx doctor disagree with each other in the same second.

Looks related to the class fixed in #5975 ("CLI startup status can disagree with the live managed proxy"), but still reproduces on 2.77.0.

Environment

  1. opencodex @bitkyc08/[email protected]
  2. macOS, LaunchAgent com.opencodex.proxy
  3. RunAtLoad=true, KeepAlive.SuccessfulExit=false
  4. Proxy on 127.0.0.1:10100, default provider openai (ChatGPT-forward)
  5. Codex CLI 0.160.0 via brew cask + ocx shim

Repro

With the service already installed and serving:

# ground truth — stays healthy across the whole run
launchctl print "gui/$(id -u)/com.opencodex.proxy" | rg 'state =|pid ='
ocx service status
curl -sS http://127.0.0.1:10100/healthz

# flap — run repeatedly
for i in 1 2 3 4 5; do
  echo "=== round $i ==="
  ocx status 2>&1 | rg 'Restart safety|routing=|Service:'
  ocx doctor 2>&1 | sed -n '/Codex restart safety/,+2p'
  sleep 2
done

Observed (5 consecutive rounds, same PID 54378, healthz always ok)

Round ocx status ocx doctor ocx service status
1 service=viable / protected service=absent / AT RISK installed and loaded
2 service=absent / AT RISK service=absent / AT RISK installed and loaded
3 service=absent / AT RISK service=absent / AT RISK installed and loaded
4 service=viable / protected service=viable / protected installed and loaded
5 service=absent / AT RISK service=absent / AT RISK installed and loaded

Round 1 is the clearest bug signal: status and doctor disagree while the LaunchAgent and /healthz are fine.

ocx resolve --json also reported ownership.kind=none and takeover.reason=managing-cli-unknown / "service-registration compatibility could not be determined" while the service was live — may be related.

Expected

Once ocx service status / launchd / a live attested /healthz agree the managed service is running, ocx status and ocx doctor should report service=viable / protected, not flap to absent.

Workaround

Treat ocx service status + launchctl + /healthz as ground truth. Ignore intermittent AT RISK lines from ocx status / ocx doctor when those three are healthy.

Related

  1. #5975 (closed) — same class of false negative when recomputing service state locally
Dominant language
TypeScript
Stars
16.9k
Forks
1.3k
Avg merge
8h 20m
Merged PRs (30d)
672

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lidge-jun/opencodex

All issues in lidge-jun/opencodex

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.