---
name: "Web UI does not update when agents are started or stopped"
---

# Bug 149: Web UI does not update when agents are started or stopped

## Description

Agent start/stop changes are in-memory HashMap mutations in the agent pool. No WatcherEvent is emitted for these changes, so the WebSocket never pushes an update to the frontend. The agent panel only refreshes on its polling interval, meaning agent swaps and new agent starts are invisible until the next poll.

Additionally, when an agent is assigned to a work item (e.g. a coder starts on a story), the pipeline board should reflect the change immediately — the work item should go from amber (unassigned) to green (agent working). Currently this requires a full page refresh.

The key insight is that agent assignment is an in-memory event, not a filesystem event, so the watcher won't catch it. The server needs to push agent state changes over WebSocket explicitly.

Fix options:
1. Emit a WatcherEvent (e.g. AgentStateChanged) when start_agent/stop_agent modifies the pool, and have the WebSocket handler forward it to the frontend
2. Or have the frontend subscribe to a dedicated agent-state WebSocket message type

Key files:
- server/src/agents.rs: start_agent / stop_agent — where the state change happens
- server/src/http/ws.rs: WebSocket handler that could forward agent state events
- frontend/src/components/AgentPanel.tsx: polling-based agent list refresh
- frontend pipeline board: wherever work item color (amber/green) is derived from agent assignment

## How to Reproduce

1. Open the web UI and look at the pipeline board
2. Start an agent on a story via MCP or the API
3. Observe the pipeline board — the work item stays amber until a full page refresh

## Actual Result

Agent panel and pipeline board do not update until the next polling interval or a full page refresh. Starting/stopping agents and agent assignment to work items are invisible in real-time.

## Expected Result

Agent panel and pipeline board should update immediately when agents are started, stopped, or assigned to work items.

## Acceptance Criteria

- [ ] Agent start/stop events are pushed over WebSocket to the frontend
- [ ] Pipeline board work items update color (amber → green) immediately when an agent is assigned
- [ ] No full page refresh required to see agent state changes
