---
name: "Agent pool allows multiple instances of the same agent to run concurrently"
---

# Bug 97: Agent pool allows multiple instances of the same agent to run concurrently

## Description

The agent pool does not enforce single-instance concurrency per agent name. When the pipeline auto-advances (e.g. coder finishes and QA starts automatically), it spawns a new agent instance even if that agent is already running on another story. With only one QA agent defined in project.toml, two QA processes were observed running simultaneously on different stories, driving load average past 33 on an M1 Mac. Each QA run spawns cargo clippy, cargo test, and vitest — two concurrent runs is brutal on resources.

## How to Reproduce

1. Have one QA agent defined in project.toml\n2. Start a coder on story A — when it completes, pipeline auto-starts QA on story A\n3. While QA is running on story A, start a coder on story B — when it completes, pipeline auto-starts QA on story B\n4. Observe two QA agents running simultaneously despite only one being defined

## Actual Result

Two QA agent processes run concurrently, competing for CPU and causing extreme load.

## Expected Result

The agent pool should enforce single-instance concurrency per agent name. If QA is already running, the next QA job should queue until the current one finishes.

## Acceptance Criteria

- [ ] Agent pool checks if an agent name is already running before spawning a new instance
- [ ] If the agent is busy, the new job is queued and starts when the agent becomes available
- [ ] Pipeline auto-advancement respects the concurrency limit
- [ ] cargo clippy and cargo test pass
