Skip to content

fix(cli): report mismatched service status - #36275

Closed
kitlangton wants to merge 2 commits into
v2from
service-status
Closed

fix(cli): report mismatched service status#36275
kitlangton wants to merge 2 commits into
v2from
service-status

Conversation

@kitlangton

@kitlangton kitlangton commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the misleading URL-or-stopped output from service status with explicit JSON inspection states
  • report a coherent healthy daemon as running even when its version differs from the installed CLI
  • distinguish registration, reachability, health-format, and registration/health consistency failures
  • preserve exact-version discovery and normal-client replacement behavior

service status is an operator-invoked, read-only command. OpenCode does not call it automatically, and inspection never starts, stops, replaces, or signals a process.

States

Status Observation
stopped No registration file exists
invalid Registration is unreadable or malformed
unhealthy The registered endpoint is unreachable, returns a non-2xx response, or returns invalid health data
legacy The endpoint reports { "healthy": true } without PID/version identity
inconsistent Registration and health disagree on PID and/or server version
running Registration and health agree; compatible compares the reported server version with the installed CLI version

The registration password is used for the health request but is never included in output.

Examples

Healthy but version-mismatched:

{
  "status": "running",
  "url": "http://127.0.0.1:4096",
  "pid": 81804,
  "version": "0.0.0-next-15293",
  "compatible": false,
  "clientVersion": "0.0.0-next-15295"
}

Registration and health disagree:

{
  "status": "inconsistent",
  "fields": ["pid", "version"],
  "registration": {
    "url": "http://127.0.0.1:4096",
    "pid": 81804,
    "version": "0.0.0-next-15293"
  },
  "health": {
    "pid": 81900,
    "version": "0.0.0-next-15295"
  },
  "clientVersion": "0.0.0-next-15295"
}

No registration:

{
  "status": "stopped",
  "clientVersion": "0.0.0-next-15295"
}

Lifecycle Boundary

This PR changes diagnostics only. Service.discover(options) retains its exact-version gate, Service.start(options) still replaces mismatched daemons, and lifecycle operations retain legacy-health support. The client tests explicitly verify gated and ungated discovery after the inspection refactor.

Verification

  • bun run test from packages/client: 24 passed
  • bun run test test/service.test.ts from packages/cli: 3 passed
  • bun typecheck from packages/client: passed
  • bun typecheck from packages/cli: passed
  • pre-push repository typecheck: 31 package tasks passed

Fixes #36274

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant