story-kit: create 172_bug_setup_command_failure_prevents_agent_from_starting_creating_unrecoverable_deadlock
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
type: bug
|
||||||
|
title: Setup command failure prevents agent from starting, creating unrecoverable deadlock
|
||||||
|
---
|
||||||
|
|
||||||
|
# Bug 172: Setup command failure prevents agent from starting, creating unrecoverable deadlock
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
When an agent dies mid-edit and leaves the worktree in a non-compiling state, the retry loop deadlocks:
|
||||||
|
|
||||||
|
1. Coder PTY dies mid-edit → worktree has broken build
|
||||||
|
2. Pipeline retries → calls `create_worktree` which calls `run_setup_commands`
|
||||||
|
3. `run_setup_commands` includes `pnpm run build`, which fails because the worktree has a build error
|
||||||
|
4. Setup failure propagates via `?` → agent never spawns → empty log → marked failed
|
||||||
|
5. Auto-assign retries → goto 2, forever
|
||||||
|
|
||||||
|
The agent is the only thing that can fix the build error, but it can never start because the build error prevents it from starting.
|
||||||
|
|
||||||
|
## Fix
|
||||||
|
|
||||||
|
Make `run_setup_commands` non-fatal. Log a warning if any setup command fails, but don't prevent the agent from starting. The agent can run `pnpm install` / `pnpm build` itself if needed.
|
||||||
|
|
||||||
|
## Key files
|
||||||
|
|
||||||
|
- `server/src/worktree.rs:82` — `run_setup_commands` call on worktree reuse path (propagates error with `?`)
|
||||||
|
- `server/src/worktree.rs:98` — `run_setup_commands` call on fresh worktree path (propagates error with `?`)
|
||||||
|
- `server/src/worktree.rs:261` — `run_setup_commands` implementation
|
||||||
|
|
||||||
|
## Acceptance Criteria
|
||||||
|
|
||||||
|
- [ ] Setup command failures are logged as warnings, not fatal errors
|
||||||
|
- [ ] Agent PTY spawns even if setup commands fail
|
||||||
|
- [ ] Agent can still fix build errors in its worktree
|
||||||
|
- [ ] All tests pass
|
||||||
Reference in New Issue
Block a user