Skip to content

refactor(doctor/status): unify daemon health checks#873

Merged
jackwener merged 1 commit intomainfrom
refactor/simplify-daemon-status
Apr 8, 2026
Merged

refactor(doctor/status): unify daemon health checks#873
jackwener merged 1 commit intomainfrom
refactor/simplify-daemon-status

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Add getDaemonHealth() returning 'stopped' | 'no-extension' | 'ready' as the single entry point for all daemon status queries
  • Delete discover.ts (thin wrapper layer with no value)
  • Bridge uses getDaemonHealth() + _pollUntilReady() — eliminates duplicate polling loops and isExtensionConnected() calls
  • Doctor simplified: live check auto-starts daemon via bridge; --no-live mode does minimal auto-start only when stopped (avoids misreporting idle-exit as failure)
  • CommanderAdapter preserves err.message and err.hint detail (prevents swallowing actionable info like port numbers and manual start commands)
  • Removes isDaemonRunning(), isExtensionConnected(), checkDaemonStatus() — all replaced by getDaemonHealth()

Net: -6 lines, 5 status check paths → 1.

Supersedes #872 (closed without merge). Incorporates the two review fixes from @mbp-codex-pr1:

  1. --no-live idle-exit false negative
  2. Error detail preservation in CommanderAdapter

Test plan

  • npx tsc --noEmit — zero type errors
  • npx vitest run — 1491 pass, 1 skip, 1 flaky e2e (pre-existing StackOverflow)
  • Manual: opencli doctor with daemon running
  • Manual: opencli doctor --no-live with daemon idle-exited
  • Manual: run a browser command with extension disconnected — verify actionable error detail shown

…lth()

- Add getDaemonHealth() returning 'stopped' | 'no-extension' | 'ready'
- Delete discover.ts (thin wrapper with no value)
- Bridge uses getDaemonHealth() + _pollUntilReady() (eliminates duplicate polling)
- Doctor simplified: live check auto-starts daemon; no-live mode does minimal
  auto-start only when stopped (avoids misreporting idle-exit as failure)
- CommanderAdapter preserves error message/hint detail (not just generic title)
- All callers use single unified status entry point
@jackwener jackwener merged commit 85d73b5 into main Apr 8, 2026
13 checks passed
@jackwener jackwener mentioned this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant