fix(cli): enhance /agents and /tasks commands to show active agents - #32552
fix(cli): enhance /agents and /tasks commands to show active agents#32552AllynSheep wants to merge 8 commits into
Conversation
…arch#29027) Add handoff parameter to kanban_block to distinguish deliberate handoffs (e.g., awaiting review) from genuine failures. The dispatcher now skips failure counting and retry logic for tasks blocked with handoff=True. Changes: - Add handoff INTEGER column to tasks table with migration support - Add handoff parameter to block_task() function - Update _handle_block() to auto-detect handoff from reason patterns - Modify _record_task_failure() to skip handoff blocks - Update kanban-worker skill with handoff usage guidance - Add comprehensive tests for handoff functionality Fixes NousResearch#29027 # Conflicts: # hermes_cli/kanban_db.py # tools/kanban_tools.py
fix: update tests for current plugin registry
- Add _AGENT_PENDING_SENTINEL for tracking starting agents - Enhance _handle_agents_command to display: - Active agents with session_key, state, elapsed time, session_id, model - Running processes from process_registry - Background tasks - Current session agent status - Improve output formatting with better organization and detail - /tasks command already aliased to /agents, now shows proper information Fixes NousResearch#32477
|
Note: This PR bundles several unrelated changes beyond the /agents fix — kanban handoff feature (kanban_db.py, kanban_tools.py + tests), release script contributor mappings, xai web search test additions, and a hangup protection test fix. Only cli.py relates to #32477. Also competes with #32541 which fixes the same issue via inline dispatch. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for investigating the /agents visibility problem. The report is still reproducible on current main, but this patch changes the wrong layer for that symptom.
Problems
- While a CLI agent is running, slash commands bypass the busy-input branch at
cli.py:13510and are placed on_pending_inputatcli.py:13566;/steerdocuments why that queue cannot service a mid-run command (cli.py:8325-8345). This PR changes_handle_agents_commandonly, so/agentsand/tasksstill do not render during the active delegation. - The added
_running_agentsdisplay reads state HermesCLI does not own on current main. CLI background work is tracked as{task_id: threading.Thread}(cli.py:4146-4148), so the proposeddone()filter over that mapping cannot report those tasks. - The kanban, release-script, and web-test changes are unrelated to this CLI issue; the existing member comment correctly identifies that split.
Suggested changes
- Re-scope to inline busy-path dispatch for bare
/agentsand/tasks, modeled on_should_handle_steer_command_inline, with a regression test throughhandle_enter. - Retain the existing CLI data sources in
hermes_cli/cli_commands_mixin.py:261-296unless a CLI lifecycle registry is added and tested separately.
Automated hermes-sweeper review.
| finished = [p for p in processes if p.get("status") != "running"] | ||
| now = time.time() | ||
|
|
||
| # Get running agents from the agent registry |
There was a problem hiding this comment.
HermesCLI does not define or populate _running_agents / _running_agents_ts on current main, so this list will always be empty; the pending sentinel is likewise never inserted by a CLI lifecycle path. The CLI needs an owned registry before rendering gateway-style agent rows.
|
|
||
| # Get running processes from process registry | ||
| try: | ||
| processes = process_registry.list_sessions() |
There was a problem hiding this comment.
_background_tasks is a Dict[str, threading.Thread] in HermesCLI, so iterating it yields task-id strings and this done() filter excludes every active CLI background task. Use the mapping's values and thread liveness, or the existing handler's async-delegation registry as appropriate.
Problem
Issue #32477 - The
/tasksand/agentscommands do nothing in the CLI. When running agent delegation tasks, attempting to monitor with/tasksor/agentscommands produces no output, when the expected behavior is to show a live tree of running and recently-finished subagents.Root Cause
The CLI's
_handle_agents_commandimplementation was too simple, only showing process registry information without displaying the actual running agents from_running_agentsdictionary.Solution
_AGENT_PENDING_SENTINELfor tracking starting agents_handle_agents_commandto display:/taskscommand already aliased to/agents(inhermes_cli/commands.py), now shows proper informationTesting
/taskscommand correctly resolves to/agentscommandChanges
cli.py:_AGENT_PENDING_SENTINELobject_handle_agents_commandmethod to match gateway functionalityFixes #32477