Repository navigation
Conversation
The stats one-liner read straight from /proc, so a self-hosted server running macOS (e.g. as an Openship "server" deploy target) always came back with no data — the dashboard's System Health panel just showed dashes for CPU, memory, disk and uptime. Add a Darwin branch (top/vm_stat/sysctl/df) and dispatch on `uname -s` so the same probe works on both platforms in one SSH round-trip. The Darwin branch avoids `<<<` on purpose: zsh (macOS's default shell, and what `ssh host cmd` actually runs) implements here-strings via a temp file, which fails this exact probe with ENOSPC on a nearly-full disk — precisely the box an operator most wants a disk reading from.
|
Reviewed alongside #645 against current main. Both PRs address the same macOS failure and modify the API controller that has since moved to the shared platform layer. I adapted and merged the earlier, smaller #645 into #892, retaining @chbndrhnns’s original commit and GitHub merge credit. The integrated command also addresses the shell concern raised here: neither OS path uses here-strings, and actual macOS execution through both sh and zsh passes. It keeps used + available memory equal to total, uses an interval CPU sample, and reports incomplete probes as errors. This PR’s separate controller implementation would duplicate that fix; its active/wired/compressed “used” value and free-only “available” value would also leave the memory fields inconsistent. Thanks for investigating the macOS probe and shell behavior. Closing this overlapping PR as superseded by the adapted #645 in #892; #608 is tracked as fixed there, awaiting main merge. |
Summary
/proc, which macOS doesn'''t have — a Mac added as an Openship deploy target always showed dashes in System Health.top/vm_stat/sysctl/df) and dispatches onuname -s, so one SSH round-trip still gets the stats regardless of platform. No new dependency — every command used ships with macOS.<<<on purpose: zsh (macOS'''s default shell, and whatssh host cmdactually runs) implements here-strings via a real temp file, which made this exact probe fail with ENOSPC on a nearly-full disk — precisely the box an operator most wants a disk-usage reading from. Found and fixed while testing against a real Mac mini with 99% disk usage.if/then/else/ficommand needs an explicit;beforeelse/fi, or the trailingprintfswallows them as arguments instead of shell keywords and the whole probe never runs on either OS. The addedbash -nsyntax-check test catches this class of bug directly.Test plan
bunx vitest run apps/api/src/modules/system/server-stats-command.test.ts— 4 new tests: both branches parse as valid bash, the combined command still dispatches correctly, the Darwin branch has no<<<, and the Linux branch actually runs on the (Linux) CI runner and emits the documented JSON schema.tsc --noEmit— no new errors introduced.