Skip to content

Bug: Zombie agent keeps respawning after feature set to done + stopped#3190

Merged
mabry1985 merged 1 commit intodevfrom
feature/bug-zombie-agent-keeps-respawning-after
Mar 30, 2026
Merged

Bug: Zombie agent keeps respawning after feature set to done + stopped#3190
mabry1985 merged 1 commit intodevfrom
feature/bug-zombie-agent-keeps-respawning-after

Conversation

@mabry1985
Copy link
Copy Markdown
Contributor

@mabry1985 mabry1985 commented Mar 30, 2026

Summary

When stop_agent is called on a running agent and the feature is set to 'done', the agent respawns within seconds. The done→backlog→in_progress cycle repeats indefinitely. stop_agent returns success:true but the agent restarts. Likely cause: auto-mode loop or a watcher re-queues the feature before the done status is persisted. The stop+done must be atomic, or auto-mode must check status before spawning. Blocking mythxengine Scene Pages project because this zombie agent occupies the concurrency sl...


Created automatically by Automaker

Summary by CodeRabbit

New Features

  • Added support for specifying a final status when stopping an agent or feature (backlog, done, or verified)
  • Stopped features with terminal statuses now maintain their assigned status instead of being reset to backlog, preventing unwanted automatic respawn behavior

… status

stopFeature() was unconditionally resetting feature status to 'backlog' after
aborting the agent. This caused two zombie respawn paths:

1. When stop_agent is called and the caller subsequently sets the feature to
   'done', the feature:status-changed listener called stopFeature() which
   overwrote 'done' back to 'backlog', causing auto-mode to immediately
   respawn the agent.

2. When stop_agent is called with targetStatus='done', the abort would reset
   to 'backlog' instead of preserving the intended terminal status.

Fix: stopFeature() now accepts an optional targetStatus parameter. Terminal
statuses ('done', 'verified', 'completed') are preserved instead of being
overwritten with 'backlog'. The feature:status-changed event handler passes
the terminal status through so it is never clobbered.

Also adds targetStatus parameter to the stop_agent MCP tool, HTTP route, and
ava-tools so callers can atomically stop an agent and mark it done in one call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mabry1985 mabry1985 enabled auto-merge (squash) March 30, 2026 02:30
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The changes add support for an optional targetStatus parameter when stopping feature agents, allowing users to specify the final status (backlog, done, or verified) instead of always defaulting to backlog. The service logic is updated to preserve terminal statuses when provided, preventing automatic feature respawning.

Changes

Cohort / File(s) Summary
API Route & Tool Input Definitions
apps/server/src/routes/auto-mode/routes/stop-feature.ts, apps/server/src/routes/chat/ava-tools.ts, packages/mcp-server/src/tools/agent-tools.ts
Added optional targetStatus parameter to route handler request body validation and tool input schemas (enum: backlog, done, verified), maintaining backward compatibility.
Service Implementation
apps/server/src/services/auto-mode-service.ts
Updated stopFeature method signature to accept optional targetStatus parameter. Changed status update logic to preserve terminal states (done, verified, completed) when targetStatus is provided; otherwise defaults to backlog.
MCP Server Handler
packages/mcp-server/src/index.ts
Updated stop_agent tool request handler to conditionally include targetStatus in payload only when defined.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A status we preserve with care,
No more the backlog snare!
When agents stop, they choose their fate,
Done or verified—we won't reset the state! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically summarizes the main bug fix: preventing zombie agents from respawning when a feature is set to done and stopped.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/bug-zombie-agent-keeps-respawning-after

Comment @coderabbitai help to get the list of available commands and usage tips.

@mabry1985 mabry1985 merged commit 8308e59 into dev Mar 30, 2026
3 of 4 checks passed
@mabry1985 mabry1985 deleted the feature/bug-zombie-agent-keeps-respawning-after branch March 30, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant