Skip to content

feat(gateway): compact status card - #37476

Open
leoge007 wants to merge 1 commit into
NousResearch:mainfrom
leoge007:feat/gateway-status-card
Open

feat(gateway): compact status card#37476
leoge007 wants to merge 1 commit into
NousResearch:mainfrom
leoge007:feat/gateway-status-card

Conversation

@leoge007

@leoge007 leoge007 commented Jun 2, 2026

Copy link
Copy Markdown

Summary

  • Adds a compact gateway /status card formatter.
  • Updates gateway /status to show version/SHA, gateway + system uptime, model/fallbacks, token/cost/cache/context metrics, session id, active tasks, and queue mode/depth.
  • Keeps noisy debug fields out of the Telegram-facing status card (Execution, Runtime, Platforms).

Closes #37474

Example output

🪽 Hermes 0.15.1 (c6501c0)
⏱️ Uptime: gateway 2m · system 1d 5h
🧠 Model: azure-foundry/gpt-5.5-1
🔄 Fallbacks: deepseek/deepseek-v4-pro, deepseek/deepseek-v4-flash
🧮 Tokens: 64k in / 3k out · 💵 Cost: $0.12
🗄️ Cache: 22% hit · 14k read, 0 write
📚 Context: 64k/1.0m (6%) · 🧹 Compactions: 0
🧵 Session: 20260602_xxx
📌 Tasks: 0 active
🪢 Queue: steer (depth 0)

This is intentionally concise for messaging surfaces: it gives operators the quick runtime health snapshot without turning /status into 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

@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have labels Jun 2, 2026
@leoge007
leoge007 force-pushed the feat/gateway-status-card branch from f2213ea to 9a1610a Compare June 3, 2026 10:51
@leoge007

leoge007 commented Jun 3, 2026

Copy link
Copy Markdown
Author

Local verification after rebasing this PR onto current main (047e7cf):

  • PR diff is still limited to gateway/run.py, gateway/status_card.py, and tests/gateway/test_status_card.py.
  • ./venv/bin/python -m pytest tests/gateway/test_status_card.py tests/gateway/test_unknown_command.py -q -n 0 --tb=short -> 15 passed.
  • scripts/run_tests_parallel.py tests/gateway/test_status_card.py -j 1 -> 4 passed.
  • ./venv/bin/ruff check . -> passed.
  • scripts/check-windows-footguns.py --all -> passed.
  • Import smoke test for gateway.status_card and gateway.run -> passed.
  • History/contributor/supply-chain equivalent checks are clean locally.

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.

brokenarrow2099 pushed a commit to brokenarrow2099/hermes-agent that referenced this pull request Jun 17, 2026
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 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 /status now lives in gateway/slash_commands.py:496; it uses the async session facade at gateway/slash_commands.py:501 after 9d38a2309ece. The PR's synchronous self.session_store.get_or_create_session() at gateway/run.py:10399 must not be carried forward.
  • gateway/run.py:1314 invokes ps, while gateway/run.py:1327-1347 has no Windows path. Existing cross-platform gateway status helpers use psutil fallback behavior in gateway/status.py:147-210.
  • gateway/run.py:10457 reads a non-persisted compression_count session field. Current main obtains this from the live context compressor at gateway/slash_commands.py:4040-4041.
  • Current Matrix scope status at gateway/slash_commands.py:648-663 needs 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.

Comment thread gateway/run.py Outdated
@@ -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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread gateway/run.py Outdated
"cache_write_tokens": cache_write_tokens,
"context_tokens": context_tokens,
"context_limit": _status_context_limit(cfg),
"compactions": session_row.get("compression_count", 0),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread gateway/run.py Outdated
"""Best-effort uptime for the current gateway process."""
try:
proc = subprocess.run(
["ps", "-o", "etimes=", "-p", str(os.getpid())],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
@leoge007
leoge007 force-pushed the feat/gateway-status-card branch from 9a1610a to c327980 Compare July 20, 2026 10:28
@leoge007

Copy link
Copy Markdown
Author

Ported the compact /status card to current main in c327980.

Key changes:

  • integrated through GatewaySlashCommandsMixin with the async session facade;
  • preserved current SessionDB token truth, live/cached/persisted model/context fallbacks, and Matrix scope/redaction;
  • added cross-platform psutil uptime collection with Windows-safe coverage;
  • reads compaction count only from the live/cached context compressor;
  • uses only locally persisted cost data (no account/billing network calls);
  • added all locale keys with placeholder parity.

Local verification after rebasing onto current main (3441b80):

  • focused status/dispatch/Matrix suite: 57 passed;
  • i18n + locale wheel + gateway status suite: 146 passed (2 wheel-build tests deselected by their existing guards);
  • per-file runner: 5 passed;
  • ruff: passed;
  • Windows footgun scan: 785 files, clean;
  • import smoke and YAML parsing: passed.

Please re-review when convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(gateway): compact runtime card for /status

3 participants