feat(gateway): compact status card - #37476
Conversation
f2213ea to
9a1610a
Compare
|
Local verification after rebasing this PR onto current main (047e7cf):
GitHub Actions are not failing at runtime; every PR workflow is currently completed with conclusion action_required at 0s, so an upstream maintainer/admin needs to approve and run workflows for this fork PR. |
Integrates PR NousResearch#37476 (gateway-status-card) into our feishu-table-card branch. Adds format_hermes_status_card() for compact status display with: - Version, git commit, gateway/system uptime - Model, fallbacks, tokens, cache hit rate - Context usage, compactions, active tasks, queue depth
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused gateway status-card proposal. The feature remains useful, but it needs a current-main port and a few corrections before salvage.
Problems
- Current
/statusnow lives ingateway/slash_commands.py:496; it uses the async session facade atgateway/slash_commands.py:501after9d38a2309ece. The PR's synchronousself.session_store.get_or_create_session()atgateway/run.py:10399must not be carried forward. gateway/run.py:1314invokesps, whilegateway/run.py:1327-1347has no Windows path. Existing cross-platform gateway status helpers use psutil fallback behavior ingateway/status.py:147-210.gateway/run.py:10457reads a non-persistedcompression_countsession field. Current main obtains this from the live context compressor atgateway/slash_commands.py:4040-4041.- Current Matrix scope status at
gateway/slash_commands.py:648-663needs preservation in any compact replacement.
Suggested changes
- Port the card into
GatewaySlashCommandsMixin, preserve async storage access, use cross-platform uptime collection, and add nonzero-compression plus Windows tests.
Automated hermes-sweeper review.
| @@ -10299,63 +10398,70 @@ async def _handle_status_command(self, event: MessageEvent) -> str: | |||
| source = event.source | |||
| session_entry = self.session_store.get_or_create_session(source) | |||
There was a problem hiding this comment.
Current main moved /status into GatewaySlashCommandsMixin and uses await self.async_session_store.get_or_create_session(source) after the async SessionStore-boundary fix (9d38a2309ece). Please port this handler through that facade rather than retaining synchronous SessionStore access.
There was a problem hiding this comment.
Addressed in c327980. The /status implementation now lives in GatewaySlashCommandsMixin and retains await self.async_session_store.get_or_create_session(source); no synchronous SessionStore access was reintroduced.
| "cache_write_tokens": cache_write_tokens, | ||
| "context_tokens": context_tokens, | ||
| "context_limit": _status_context_limit(cfg), | ||
| "compactions": session_row.get("compression_count", 0), |
There was a problem hiding this comment.
compression_count is not persisted in the current SessionDB, so this defaults to 0 instead of reporting real compactions. Read the active/cached agent's context_compressor.compression_count when available, otherwise render this metric as unavailable, and cover a nonzero case.
There was a problem hiding this comment.
Addressed in c327980. Compactions now come only from the live or cached agent’s context_compressor.compression_count; when no compressor is available the metric is omitted. Coverage includes nonzero live and cached values.
| """Best-effort uptime for the current gateway process.""" | ||
| try: | ||
| proc = subprocess.run( | ||
| ["ps", "-o", "etimes=", "-p", str(os.getpid())], |
There was a problem hiding this comment.
ps is unavailable on native Windows, and the system-uptime helper has no Windows fallback. Use a cross-platform source such as psutil (already used by gateway/status.py) and add Windows-path coverage.
There was a problem hiding this comment.
Addressed in c327980. Uptime collection now uses psutil.Process(...).create_time() and psutil.boot_time() on every OS, with no ps subprocess. The focused Windows-path test sets sys.platform = "win32" and fails if uptime collection shells out.
9a1610a to
c327980
Compare
|
Ported the compact Key changes:
Local verification after rebasing onto current main (3441b80):
Please re-review when convenient. |
Summary
/statuscard formatter./statusto show version/SHA, gateway + system uptime, model/fallbacks, token/cost/cache/context metrics, session id, active tasks, and queue mode/depth.Execution,Runtime,Platforms).Closes #37474
Example output
This is intentionally concise for messaging surfaces: it gives operators the quick runtime health snapshot without turning
/statusinto a full debug dump.Test Plan
./venv/bin/python -m pytest tests/gateway/test_status_card.py tests/gateway/test_unknown_command.py -q -n 0 --tb=short./venv/bin/python - <<'PY'\nimport importlib\nfor name in ['gateway.status_card','gateway.run']:\n importlib.import_module(name)\nprint('imports ok')\nPY