Debug: Bug Report to Verified Fix

Workflow

Reproduces a bug and locates its root cause in the current repo, iterates a fix/verify loop until a test proves it fixed, then summarizes the change.

Usage

echo "<your request>" | octomind workflow debug

Reads your request from stdin. Add --dry-run to validate and print the plan without running any steps.

Pipeline

  1. 1 reproduce Sequential developer:general

    Reproduce this bug in the current repository, then trace its single root cause. <bug> {{input}} </bug> Do exactly this, in order: 1. Reproduce deterministically. Write a FAILING test (or capture the exact repro command)…

  2. 2 repair Loop max 3×
    • fix developer:general continue

      Use the reproduction and root cause below. <reproduce> {{reproduce}} </reproduce> If it says `REPRODUCE: BLOCKED`, do NOT change code — restate that the bug could not be reproduced and stop. Otherwise fix this bug in th…

    • verify developer:general fresh

      Verify the fix in the current unstaged changes against ground truth — run the failing test/repro from the reproduction step and the related test suite. Do not assert success: get the result from actual execution. <bug> …

  3. 3 outcome Conditional
    • summary developer:brief fresh

      Summarize the fix in the current unstaged changes against the original bug. <bug> {{input}} </bug>

    • stalled developer:brief fresh

      The fix loop ended WITHOUT a verified fix — do not present this as success. Report for a human decision: whether the bug was reproduced at all (see below), what was changed so far in the unstaged diff, and exactly what …

Definition

# Title: Debug: Bug Report to Verified Fix
#
# Public workflow: reproduce a bug and pin its root cause, then iterate a
# fix ⇄ verify loop in the current repository until a test proves it fixed, and
# summarize. Operates on the current directory. Public roles only.

name        = "debug"
description = "Reproduces a bug and locates its root cause in the current repo, iterates a fix/verify loop until a test proves it fixed, then summarizes the change."

# ── 1. Reproduce & locate root cause ─────────────────────────────────────────
[[steps]]
name    = "reproduce"
role    = "developer:general"
session = "fresh"
retries = 1
prompt  = """
Reproduce this bug in the current repository, then trace its single root cause.

<bug>
{{input}}
</bug>

Do exactly this, in order:
1. Reproduce deterministically. Write a FAILING test (or capture the exact repro
   command) that fails NOW because of this bug. State expected-vs-actual.
2. Only if it reproduces: trace the failing path in the code to THE one root cause
   (not a symptom) and name the exact file:line. The cause must be traceable in
   the code you read — never guessed.

If you cannot reproduce it, do NOT guess a cause: report what you tried and end
with the BLOCKED line so no fix is attempted on an unreproduced bug.

End with exactly one line: `REPRODUCE: CONFIRMED` or `REPRODUCE: BLOCKED`. Nothing after it.
"""

# ── 2. Fix ⇄ verify loop ─────────────────────────────────────────────────────
[[steps]]
name           = "repair"
loop           = true
max_iterations = 3
exit_when      = { output = "verify", matches = '(?m)^VERIFY: FIXED' }

  [[steps.run]]
  name    = "fix"
  role    = "developer:general"
  session = "continue"
  retries = 1
  prompt  = """
Use the reproduction and root cause below.

<reproduce>
{{reproduce}}
</reproduce>

If it says `REPRODUCE: BLOCKED`, do NOT change code — restate that the bug could
not be reproduced and stop. Otherwise fix this bug in the current repository:
make the SMALLEST change that addresses the root cause — one hypothesis, no
unrelated edits, no symptom patches. (On later rounds you receive the verifier's
findings as your input — address every one.)

<bug>
{{input}}
</bug>
"""

  [[steps.run]]
  name    = "verify"
  role    = "developer:general"
  session = "fresh"
  prompt  = """
Verify the fix in the current unstaged changes against ground truth — run the
failing test/repro from the reproduction step and the related test suite. Do not
assert success: get the result from actual execution.

<bug>
{{input}}
</bug>

<reproduce>
{{reproduce}}
</reproduce>

Pass requires BOTH: (a) the previously failing test/repro now passes, and (b) the
related suite stays green with no new failures. If either fails, list exactly
what is still wrong — that text goes straight to the fixer as its next input.

End with exactly one line: `VERIFY: FIXED` or `VERIFY: REGRESSION`. Nothing after it.
"""

# ── 3. Outcome — honest branch on the loop's final verdict ───────────────────
[[steps]]
name        = "outcome"
conditional = true
condition   = { output = "verify", matches = '(?m)^VERIFY: FIXED' }
on_match    = ["summary"]
on_no_match = ["stalled"]

  [[steps.run]]
  name    = "summary"
  role    = "developer:brief"
  session = "fresh"
  prompt  = """
Summarize the fix in the current unstaged changes against the original bug.

<bug>
{{input}}
</bug>
"""

  [[steps.run]]
  name    = "stalled"
  role    = "developer:brief"
  session = "fresh"
  prompt  = """
The fix loop ended WITHOUT a verified fix — do not present this as success.
Report for a human decision: whether the bug was reproduced at all (see below),
what was changed so far in the unstaged diff, and exactly what still fails.

<bug>
{{input}}
</bug>

<reproduce>
{{reproduce}}
</reproduce>

<last_verification>
{{verify}}
</last_verification>

Start with exactly: `DID NOT CONVERGE — human review required.`
"""