Skip to main content

install_agent_turn_delivery

Function install_agent_turn_delivery 

Source
pub fn install_agent_turn_delivery(state: &AppState)
Expand description

Give the reactive handler a delivery route to SubprocessController agents.

spawn_background_subsystems installs a message sender that can only reach the two controller kinds deliver_agent_message knows about — persistent (stream-json stdin) and ACP (session/prompt). Everything else it reports as [AgentDelivery::Pty], so the caller falls back to keystroke injection.

That fallback is wrong for a SubprocessController, which has no PTY and rejects raw input outright (“subprocess controller does not accept raw input; use AgentInputCommand”). The result was that EVERY inter-agent message to such an agent was dropped: 6 of 10 providers as host agents (codex, gemini, qwen, kimi, muxcode, antigravity) and every container agent of any provider, since agent_open.rs forces controller_type = "subprocess" for container mode. The swarm pane still listed them as present, because registration and delivery are separate paths. See docs/reports/REPORT_JEKT_DELIVERY_DROPS_SUBPROCESS_AGENTS_2026_09_02.md.

This re-installs the sender with the missing branch: a subprocess target gets a real turn via run_agent_turn — the same thing AgentInputCommand does when the operator types into the pane — instead of keystrokes it will refuse.

Must run AFTER build_app_state: unlike the early sender, the turn needs AppState (stores, identity, broker, container manager) and is async.