Overview
Bug fixes flow through Magpie’s Diagnostic blueprint (magpie-diagnostic). This approach forces the agent to investigate the root cause BEFORE planning a fix: scan → investigate → plan → write regression test → verify fail → fix → test → lint.
Task Classification
Keywords that trigger the BugFix path:fix bug,fix crash,fix error,fix panicbroken,not working,regressiondebug,investigate,root cause,diagnose
fix typo, fix docs are classified as Simple (checked first).
Example: Fix Panic on Empty Task Message
Discord Message
Pipeline Flow
Diagnostic Blueprint Step 1: scan-repo
The blueprint starts by scanning the repository structure:Output includes the crash location:
Diagnostic Blueprint Step 2: investigate
Agent traces the root cause WITHOUT modifying files:Agent Prompt:Agent Investigation:Agent reads Agent traces the code flow:
crates/magpie-discord/src/handler.rs:47:Diagnostic Blueprint Step 3: plan
Agent creates a targeted fix plan based on investigation:Agent Prompt:Agent Plan:
Diagnostic Blueprint Step 4: write-regression-test
Agent writes a test that REPRODUCES the bug:Agent Prompt:Agent Output:Agent confirms:
Diagnostic Blueprint Step 5: verify-test-fails
Run tests to confirm they fail (reproduce the bug):Output:The blueprint continues because
continue_on_error: true for this step.Diagnostic Blueprint Step 6: implement-fix
Agent fixes the root cause:Agent Prompt:Agent Output:Agent confirms:
Pipeline Result
Discord Bot Reply
Performance
| Metric | Value |
|---|---|
| Total time | ~18 minutes |
| Agent turns | ~10-14 (scan, investigate, plan, write test, fix) |
| CI rounds | 0 (diagnostic lint+test already passed) |
| Tier 1 calls | 2 (branch slug, commit message) |
| Tier 2 calls | 5 (investigate, plan, write-test, fix, verify) |
Why Diagnostic Works
- Forced investigation — agent must explain WHY before fixing
- Root cause analysis — no band-aid fixes
- Regression tests — ensures the bug stays fixed
- Read-only investigation — separates analysis from implementation
- Structured phases — prevents “random fix attempts”