feat(doctor): add Pgserve (canonical backbone) check section - #1605
Conversation
Mirrors `omni doctor`'s `pgserve-canonical` check on the genie side
so operators see the same shared-backbone visibility from both halves
of the canonical-stack. Surfaces three signals:
✓ pgserve binary canonical port 8432
✓ pgserve under pm2 online — shared backbone for genie-serve + omni-api
…or, when something is off:
! pgserve binary not on PATH (or `pgserve port` failed)
Install canonical pgserve: bun add -g pgserve@^2.1.0
! pgserve under pm2 binary present but not registered under pm2
Register canonical pgserve: pgserve install
Probes
------
- Binary detection via `pgserve port` (NOT `--version` — that flag
doesn't exist in pgserve@^2.1.0 and false-negatived in historical
doctor implementations; same lesson surfaced in `omni doctor --fix`
on 2026-04-30).
- Pm2 registration + online status via `pgserve status --json`.
Severity
--------
Both checks are WARN, never FAIL. Genie can auto-spawn its own daemon
as a fallback for fingerprint-routed CLI commands, so a missing
canonical pgserve doesn't break local development — it just means
genie isn't sharing the backbone with omni and other automagik
services on this host.
Tests
-----
Live-validated on canonical-pgserve-running host: both checks PASS,
section renders cleanly, exit-code unchanged.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds a checkPgserveCanonical function to the doctor command to verify the pgserve binary's presence, its PM2 registration status, and its listening port. The review feedback recommends replacing synchronous execFileSync calls with Bun's asynchronous shell API to prevent blocking the event loop, which aligns with the function's asynchronous implementation.
| const out = execFileSync('pgserve', ['port'], { | ||
| encoding: 'utf8', | ||
| timeout: 3000, | ||
| stdio: ['ignore', 'pipe', 'ignore'], | ||
| }); |
There was a problem hiding this comment.
The checkPgserveCanonical function is marked as async, but it uses the synchronous execFileSync for probing the binary. For consistency with other async checks in this file (like checkTmux) and to avoid blocking the event loop unnecessarily, consider using Bun's asynchronous shell primitive ($). The use of a hardcoded timeout is acceptable here to prevent performance issues during the probe, as per repository guidelines.
const out = await $("pgserve port").timeout(3000).quiet().text();References
- It is acceptable to use hardcoded numeric limits (magic numbers) in non-critical fallback logic, especially when they serve as intentional caps to prevent performance issues like excessive I/O.
| const status = execFileSync('pgserve', ['status', '--json'], { | ||
| encoding: 'utf8', | ||
| timeout: 3000, | ||
| stdio: ['ignore', 'pipe', 'ignore'], | ||
| }); |
There was a problem hiding this comment.
Similar to the binary probe above, consider using Bun's asynchronous shell primitive ($) instead of execFileSync to maintain consistency within this async function and the rest of the file's async check logic. The hardcoded timeout is permitted in this context to prevent the process from hanging.
const status = await $("pgserve status --json").timeout(3000).quiet().text();References
- It is acceptable to use hardcoded numeric limits (magic numbers) in non-critical fallback logic, especially when they serve as intentional caps to prevent performance issues like excessive I/O.
Summary
Adds a
Pgserve (canonical backbone)section togenie doctor, mirroringomni doctor'spgserve-canonicalcheck so operators see the same shared-backbone visibility from both halves of the canonical-stack.…or, when something is off:
Probes
pgserve port(NOT--version— that flag doesn't exist in pgserve@^2.1.0 and false-negatived in historical doctor implementations; same lesson surfaced inomni doctor --fixon 2026-04-30 → omni#580).pgserve status --json.Severity
Both checks are WARN, never FAIL. Genie can auto-spawn its own daemon as a fallback for fingerprint-routed CLI commands, so a missing canonical pgserve doesn't break local development — it just means genie isn't sharing the backbone with omni and other automagik services on this host.
Live-validated
Tested on this canonical-pgserve-running server: both checks PASS, section renders cleanly, exit-code unchanged.
Pairs with
genie installbakesDATABASE_URLenv into ecosystem config when canonical pgserve is detected. This PR is the "did it work?" surface for that one.