Skip to content

fix(gateway): show iteration progress and idle time in /status - #43993

Open
LifeJiggy wants to merge 1 commit into
NousResearch:mainfrom
LifeJiggy:fix/gateway-status-enhancement
Open

fix(gateway): show iteration progress and idle time in /status#43993
LifeJiggy wants to merge 1 commit into
NousResearch:mainfrom
LifeJiggy:fix/gateway-status-enhancement

Conversation

@LifeJiggy

@LifeJiggy LifeJiggy commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

When an agent is running, /status now shows:

  • Iteration progress (e.g. 'iter 3/50')
  • Idle time since last activity (e.g. 'idle 2s')
  • Last activity description (e.g. 'calling web_search')

For pending agents (starting up), shows 'starting up' instead.

Enhancements:

  • Imported _AGENT_PENDING_SENTINEL for clean sentinel detection
  • Graceful fallback when agent lacks get_activity_summary
  • Error handling prevents status command from failing on bad agent state

Tests:

  • test_status_shows_iteration_progress_when_agent_running
  • test_status_shows_startup_when_agent_pending
  • test_status_no_detail_when_no_activity_summary

What does this PR do?

Enhances /status command output in the gateway to show real-time agent progress: iteration count (iter 3/50), idle time (idle 2s), and last activity description. Also handles the _AGENT_PENDING_SENTINEL state (agent starting up) with a distinct label instead of showing "unknown".

When the agent is running, /status now shows a running_detail line with iteration progress, idle time, and last tool/activity description. When the agent is pending (starting up), it shows "starting up" instead of "unknown". Falls back gracefully when get_activity_summary is unavailable.

Related Issue
Enhances observability for long-running agent sessions

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

  • gateway/slash_commands.py: Added running_detail computation in _handle_status_command with iteration progress, idle time, and last activity description; _AGENT_PENDING_SENTINEL gets special "starting up" label
  • tests/gateway/test_status_command.py: 3 new tests covering iteration progress display, pending sentinel handling, and no-summary fallback

How to Test

  1. python -m pytest tests/gateway/test_status_command.py -q — 17/17 pass
  2. In a running gateway session, send /status and verify iteration/idle/detail line appears
  3. Verify "starting up" label when agent is in pending state

Checklist

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs
  • My PR contains only changes related to this fix
  • I've run pytest and all tests pass
  • I've added tests for my changes
  • I've tested on Windows 11

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved

Looks Good

  • gateway/slash_commands.py:9-23 — When agent is running, calls get_activity_summary() on the running agent and formats iteration count (api_call_count/max_iterations), idle time (seconds_since_activity), and last activity description into the status line. Uses local import to avoid circular dependency on _AGENT_PENDING_SENTINEL.
  • Handles three states gracefully: pending sentinel (starting up), normal agent with get_activity_summary, and agent without the method (gracefully omitted).
  • tests/gateway/test_status_command.py — Three new tests covering: iteration progress display, startup sentinel, and graceful omission when method is absent.

No Issues Found

  • Exception handling around get_activity_summary() is appropriate — silently skips if the method throws.
  • Idle time rounding to integer seconds is correct for human-readable output.

Reviewed by Hermes Agent

@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 11, 2026
@LifeJiggy
LifeJiggy marked this pull request as ready for review June 11, 2026 06:19
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for adding useful runtime observability. The underlying data is available on current main (run_agent.py:3297-3313), but the PR needs adaptation to the current status handler.

Problems

  • Current main deliberately treats _AGENT_PENDING_SENTINEL as not running (gateway/slash_commands.py:505-510). Because the PR puts its starting up handling under if is_running, that branch would not execute after resolving the current conflict.
  • The PR's new suffixes are English-only, while current /status uses localized templates (gateway/slash_commands.py:627-645) and the status schema is defined in locales/en.yaml:285-305 and the other locale files.

Suggested changes

  • Separate pending-slot detection from live-agent detection, then cover the sentinel case against the current handler.
  • Add translation keys/placeholders for the progress detail rather than concatenating English text.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
Addresses review feedback on NousResearch#28930:

1. **Sentinel detection separated from live-agent detection**: Added
   is_pending = agent is _AGENT_PENDING_SENTINEL before the is_running
   check, so the pending sentinel is handled independently. The original code
   put sentinel handling under if is_running, which excluded it since
   is_running explicitly filters out the sentinel (slash_commands.py:510).

2. **Localized progress detail**: Added state_pending and
   state_running_detail translation keys to all 16 locale files (en, de,
   es, fr, ga, hu, it, ja, ko, pt, ru, tr, uk, zh, zh-hant, af). Progress
   detail (iter count, idle time, last activity) uses localized templates
   instead of English-only string concatenation.

Changes:
- gateway/slash_commands.py: separate is_pending/is_running detection, build
  agent_state with localized templates, fallback to state_yes on error
- locales/*.yaml: add state_pending and state_running_detail keys
- tests/gateway/test_status_command.py: 4 new tests (iteration progress,
  pending sentinel, no activity summary, sentinel not treated as running)

21/21 status command tests pass.
@LifeJiggy
LifeJiggy force-pushed the fix/gateway-status-enhancement branch from 1d29606 to 3e1c3df Compare July 14, 2026 12:13
@LifeJiggy

Copy link
Copy Markdown
Contributor Author

Addressed both points from your review:

  1. Separated pending-slot detection from live-agent detection — added is_pending = agent is _AGENT_PENDING_SENTINEL before the is_running check at slash_commands.py:510. The original code put sentinel handling under if is_running, which excluded it since is_running explicitly filters out the sentinel. Now the pending state is detected and handled independently.

  2. Added translation keys for progress detail — added state_pending and state_running_detail keys to all 16 locale files (en, de, es, fr, ga, hu, it, ja, ko, pt, ru, tr, uk, zh, zh-hant, af). Progress detail (iter count, idle time, last activity) uses localized {detail} placeholder instead of English-only string concatenation.

Changes:

  • gateway/slash_commands.py: separate is_pending/is_running detection, build agent_state with localized templates, fallback to state_yes on error
  • locales/*.yaml: add state_pending and state_running_detail keys
  • tests/gateway/test_status_command.py: 4 new tests (iteration progress, pending sentinel, no activity summary, sentinel not treated as running)

21/21 status command tests pass.

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 type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants