Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
238 lines
6.2 KiB
Plaintext
238 lines
6.2 KiB
Plaintext
# Bug Hunter
|
|
#
|
|
# Given a bug report or error, systematically investigate, diagnose,
|
|
# and fix it. Watch the AI think through the problem like a senior
|
|
# developer - gathering evidence, forming hypotheses, and verifying fixes.
|
|
#
|
|
# Usage: Paste an error message or describe a bug.
|
|
|
|
input bug_report: "Error message, stack trace, or bug description"
|
|
|
|
agent detective:
|
|
model: opus
|
|
persist: true
|
|
prompt: """
|
|
You are a debugging specialist. Your approach:
|
|
1. Gather evidence before forming hypotheses
|
|
2. Follow the data, not assumptions
|
|
3. Verify each hypothesis with tests
|
|
4. Document your reasoning for future reference
|
|
|
|
Think out loud. Show your work.
|
|
"""
|
|
|
|
agent surgeon:
|
|
model: opus
|
|
prompt: """
|
|
You are a code surgeon. You make precise, minimal fixes:
|
|
- Change only what's necessary
|
|
- Preserve existing behavior
|
|
- Add regression tests
|
|
- Leave code cleaner than you found it
|
|
|
|
No drive-by refactoring. Fix the bug, nothing more.
|
|
"""
|
|
|
|
# ============================================================================
|
|
# Phase 1: Evidence Gathering
|
|
# ============================================================================
|
|
|
|
session: detective
|
|
prompt: "New bug to investigate. Let me gather initial evidence."
|
|
|
|
parallel:
|
|
# Parse the error
|
|
error_analysis = session: detective
|
|
prompt: """
|
|
Analyze this bug report/error:
|
|
{bug_report}
|
|
|
|
Extract:
|
|
- Error type and message
|
|
- Stack trace (if present)
|
|
- File paths and line numbers
|
|
- Any patterns or keywords
|
|
"""
|
|
|
|
# Search for related code
|
|
code_context = session "Search for related code"
|
|
prompt: """
|
|
Based on the error, search the codebase:
|
|
1. Find the file(s) mentioned in the error
|
|
2. Find related files that might be involved
|
|
3. Look for similar patterns that might have the same bug
|
|
4. Check git history for recent changes to these files
|
|
|
|
Use Glob and Grep to search efficiently.
|
|
"""
|
|
context: bug_report
|
|
|
|
# Check for known issues
|
|
prior_knowledge = session "Check for similar issues"
|
|
prompt: """
|
|
Search for similar issues:
|
|
1. Check git log for related commits
|
|
2. Search for TODO/FIXME comments nearby
|
|
3. Look for any existing tests that might be relevant
|
|
|
|
Report what you find.
|
|
"""
|
|
context: bug_report
|
|
|
|
# ============================================================================
|
|
# Phase 2: Diagnosis
|
|
# ============================================================================
|
|
|
|
resume: detective
|
|
prompt: """
|
|
Synthesize all evidence into hypotheses.
|
|
|
|
For each hypothesis:
|
|
- State the theory
|
|
- Supporting evidence
|
|
- How to verify
|
|
- Confidence level (high/medium/low)
|
|
|
|
Start with the most likely cause.
|
|
"""
|
|
context: { error_analysis, code_context, prior_knowledge }
|
|
|
|
let hypotheses = resume: detective
|
|
prompt: "List hypotheses in order of likelihood. We'll test the top one first."
|
|
|
|
# ============================================================================
|
|
# Phase 3: Hypothesis Testing
|
|
# ============================================================================
|
|
|
|
loop until **root cause confirmed** (max: 5):
|
|
let current_hypothesis = resume: detective
|
|
prompt: "Select the next most likely hypothesis to test."
|
|
context: hypotheses
|
|
|
|
# Design and run a test
|
|
let test_result = session: detective
|
|
prompt: """
|
|
Test this hypothesis: {current_hypothesis}
|
|
|
|
Design a verification approach:
|
|
1. What would we expect to see if this is the cause?
|
|
2. How can we reproduce it?
|
|
3. Run the test and report results
|
|
|
|
Use actual code execution to verify.
|
|
"""
|
|
context: { current_hypothesis, code_context }
|
|
|
|
# Evaluate result
|
|
choice **based on the test results**:
|
|
option "Hypothesis confirmed":
|
|
resume: detective
|
|
prompt: """
|
|
Root cause confirmed: {current_hypothesis}
|
|
|
|
Document:
|
|
- The exact cause
|
|
- Why it happens
|
|
- The conditions that trigger it
|
|
"""
|
|
context: test_result
|
|
|
|
option "Hypothesis disproven":
|
|
resume: detective
|
|
prompt: """
|
|
Hypothesis disproven. Update our understanding:
|
|
- What did we learn?
|
|
- How does this change remaining hypotheses?
|
|
- What should we test next?
|
|
"""
|
|
context: test_result
|
|
hypotheses = resume: detective
|
|
prompt: "Re-rank remaining hypotheses based on new evidence"
|
|
|
|
option "Inconclusive - need more evidence":
|
|
resume: detective
|
|
prompt: "What additional evidence do we need? How do we get it?"
|
|
context: test_result
|
|
|
|
# ============================================================================
|
|
# Phase 4: Fix Implementation
|
|
# ============================================================================
|
|
|
|
let diagnosis = resume: detective
|
|
prompt: """
|
|
Final diagnosis summary:
|
|
- Root cause: [what]
|
|
- Location: [where]
|
|
- Trigger: [when/how]
|
|
- Impact: [what breaks]
|
|
|
|
Hand off to surgeon for the fix.
|
|
"""
|
|
|
|
session: surgeon
|
|
prompt: """
|
|
Implement the fix for this bug:
|
|
|
|
{diagnosis}
|
|
|
|
Steps:
|
|
1. Read and understand the code around the bug
|
|
2. Implement the minimal fix
|
|
3. Verify the fix doesn't break other things
|
|
4. Create a test that would have caught this bug
|
|
"""
|
|
context: { diagnosis, code_context }
|
|
|
|
# Run tests to verify
|
|
let verification = session "Verify the fix"
|
|
prompt: """
|
|
Verify the fix works:
|
|
1. Run the reproduction case - should now pass
|
|
2. Run the full test suite - should all pass
|
|
3. Check for any edge cases we might have missed
|
|
"""
|
|
|
|
if **tests are failing**:
|
|
loop until **all tests pass** (max: 3):
|
|
session: surgeon
|
|
prompt: "Fix is incomplete. Adjust based on test results."
|
|
context: verification
|
|
|
|
verification = session "Re-verify after adjustment"
|
|
prompt: "Run tests again and report"
|
|
|
|
# ============================================================================
|
|
# Phase 5: Documentation & Commit
|
|
# ============================================================================
|
|
|
|
session "Create bug fix commit"
|
|
prompt: """
|
|
Create a well-documented commit:
|
|
|
|
git commit with message:
|
|
fix: [brief description]
|
|
|
|
Root cause: [what was wrong]
|
|
Fix: [what we changed]
|
|
Test: [what test we added]
|
|
|
|
Closes #[issue number if applicable]
|
|
"""
|
|
|
|
output report = resume: detective
|
|
prompt: """
|
|
Bug Hunt Complete!
|
|
|
|
Investigation Report:
|
|
- Bug: {bug_report summary}
|
|
- Root Cause: {diagnosis}
|
|
- Fix: [files changed]
|
|
- Tests Added: [what tests]
|
|
- Time to Resolution: [duration]
|
|
|
|
Lessons Learned:
|
|
- How could we have caught this earlier?
|
|
- Are there similar patterns to check?
|
|
- Should we add any tooling/linting?
|
|
"""
|