Skip to content

fix: /vitals and /services report unavailable data instead of failing - #15

Merged
alexeybe1kin merged 3 commits into
mainfrom
fix/relay-systemgate-2026-11-03
Nov 3, 2026
Merged

alexeybe1kin merged 3 commits into
mainfrom
fix/relay-systemgate-2026-11-03

Conversation

@alexeybe1kin

Copy link
Copy Markdown
Collaborator

Found by the GLM bug relay, confirmed by votes, reviewed by Claude.

  • /vitals returned 500 when SYSTEMGATE_DISK_PATH is invalid; it now returns disk: null (nothing in Pi, ToolGate or the dashboard reads disk).
  • /services swallowed psutil.AccessDenied and reported an empty inventory as success; it now returns status: "unavailable" with errors: ["service_enumeration_unavailable"].
  • Regression tests for both.

Local: 72 passed, 8 skipped; file-size check ok.

🤖 Generated with Claude Code

alexeybe1kin and others added 3 commits November 3, 2026 03:09
…ry as success

SystemGate runs unprivileged (no CAP_NET_ADMIN / restricted /proc access) so psutil.net_connections raises AccessDenied -> endpoint returns 200 with results: [], which a caller cannot distinguish from a host with zero listening services

Found by the GLM relay (systemgate__systemgate__main.py_p0__bugs__0), confirmed by 3 votes and Corti.
Regression test to add: Monkeypatch psutil.net_connections to raise psutil.AccessDenied and assert /services returns 200 with status "unavailable" and errors containing "service_enumeration_unavailable" rather than an empty results list with no error marker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SYSTEMGATE_DISK_PATH set to a nonexistent or unmountable path (or the mount disappearing at runtime) -> psutil.disk_usage raises OSError, which unlike the temperatures probe is uncaught -> /vitals returns a 500 instead of degraded telemetry

Found by the GLM relay (systemgate__systemgate__main.py_p0__bugs__1), confirmed by 3 votes and Corti.
Regression test to add: Set SYSTEMGATE_DISK_PATH to a nonexistent path and assert /vitals returns 200 with a degraded/unavailable disk entry instead of a 500.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8fdf01d caught the disk_usage OSError but /vitals still called disk._asdict() on
None, so it returned 500 anyway. Report "disk": null instead and test it with an
unreadable SYSTEMGATE_DISK_PATH. Also drop a dead assignment in /services and assert
the new unavailable status in the denied-listing test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexeybe1kin
alexeybe1kin merged commit 1a42dbe into main Nov 3, 2026
3 checks passed
@alexeybe1kin
alexeybe1kin deleted the fix/relay-systemgate-2026-11-03 branch November 3, 2026 02:20
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