Skip to content

Comments

feat: sub-agent background execution, TUI panel, and CLI commands (M28-E/F/G)#737

Merged
bug-ops merged 8 commits intomainfrom
feat/709-sub-agent-orchestration-p2
Feb 21, 2026
Merged

feat: sub-agent background execution, TUI panel, and CLI commands (M28-E/F/G)#737
bug-ops merged 8 commits intomainfrom
feat/709-sub-agent-orchestration-p2

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 21, 2026

Summary

  • M28-E (M28-E: Background sub-agent execution #714): Wire real LLM loop into SubAgentManager::spawn(). Agent runs as background tokio task with cancellation support. Added poll_subagents() to Agent<C> for collecting results, shutdown_all() for graceful teardown. Switched tool_executor to Arc<dyn ErasedToolExecutor> for cloneability into spawned tasks.
  • M28-F (M28-F: TUI sub-agent panel #715): Add SubAgentMetrics to MetricsSnapshot. New zeph-tui sub-agents widget with color-coded states (working=yellow, completed=green, failed=red, input_required=cyan). Extended AppLayout to 4 side panels (25% each).
  • M28-G (M28-G: CLI /agent commands #716): /agent CLI commands in Agent<C>: list, spawn, bg, status, cancel, approve, deny. Completion notifications forwarded to user channel via poll_subagents().

Test plan

  • cargo +nightly fmt --check — passed
  • cargo clippy --workspace -- -D warnings — 0 warnings
  • cargo nextest run --workspace --lib --bins — 2343 passed, 9 skipped, 0 failed
  • New tests: shutdown_all_cancels_all_active_agents, cancellation_token_stops_agent_loop, max_turns_terminates_agent_loop
  • TUI widget tests: empty renders nothing, entries show name/state/turns/elapsed

@github-actions github-actions bot added enhancement New feature or request documentation Improvements or additions to documentation rust core size/XL and removed enhancement New feature or request labels Feb 21, 2026
M28-E: Replace stub spawn() with actual LLM loop running as background
tokio task. Add poll_subagents() to Agent<C> for collecting results and
shutdown_all() for graceful teardown. Switch tool_executor from Box to
Arc<dyn ErasedToolExecutor> to allow cloning into spawned tasks.

M28-F: Add SubAgentMetrics to MetricsSnapshot. Create sub-agents TUI
widget with color-coded states. Extend AppLayout to 4 side panels.

M28-G: Add /agent CLI commands (list, spawn, bg, status, cancel,
approve, deny) parsed in Agent<C>::handle_agent_command(). Wire
poll_subagents() completion notifications to the user channel.
@bug-ops bug-ops force-pushed the feat/709-sub-agent-orchestration-p2 branch from 01cfa07 to 0bb9205 Compare February 21, 2026 16:49
@github-actions github-actions bot added the enhancement New feature or request label Feb 21, 2026
Add 12 unit tests covering all /agent CLI command paths: list, spawn,
bg, status, cancel, approve/deny, and unknown subcommands. Add
definitions_mut() to SubAgentManager for test-time definition injection.
HIGH:
- manager: LLM failure transitions to TaskState::Failed
- manager: 2-turn tool call loop with ToolOnceExecutor mock
- manager: collect() on running task completes within timeout
- def: CRLF line endings parsed correctly (fix: normalize \r\n before toml::from_str)

MEDIUM:
- filter: proptest panic-safety and correctness for glob_match
- channel: Cancel and ArtifactUpdate variant round-trip
- grants: partial sweep keeps non-expired grants
- grants: duplicate grant for same key tracked independently
- manager: concurrency slot freed after cancel allows new spawn
- manager: statuses() does not include collected task
Add crates/zeph-core/src/subagent/command.rs with AgentCommand enum
(List, Spawn, Background, Status, Cancel, Approve, Deny) and
AgentCommand::parse() that validates input and returns typed errors
via SubAgentError::InvalidCommand. All argument validation moves into
parse() — handle_agent_command() now takes AgentCommand, not &str.

Add 16 unit tests on AgentCommand::parse() covering all valid commands,
missing args, unknown subcommand, empty input, and extra whitespace.
Extend parse() to accept known_agents parameter and handle both
/agent commands and @agent_name mentions through a single entry point.
Consolidate duplicate parse paths in Agent<C> main loop.
Remove channel.rs (A2aMessage, OrchestratorHalf, AgentHalf) — unused
mpsc-based A2A channel machinery that was dead code since sub-agents
communicate via watch/JoinHandle/CancellationToken. Clean all references
from manager.rs and mod.rs.

Rewrite docs/src/advanced/sub-agents.md with progressive disclosure:
quick start, commands, definitions, security, then internals. Replace
ASCII diagrams with mermaid.
@bug-ops bug-ops enabled auto-merge (squash) February 21, 2026 18:38
@bug-ops bug-ops merged commit a03bcfa into main Feb 21, 2026
23 checks passed
@bug-ops bug-ops deleted the feat/709-sub-agent-orchestration-p2 branch February 21, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation enhancement New feature or request rust size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

M28-G: CLI /agent commands M28-F: TUI sub-agent panel M28-E: Background sub-agent execution Sub-agent orchestration

1 participant