Self-Healing & Retry
Overview
Treat failures as information. Retry smartly, switch approach, or escalate - never loop blindly.
Classification
| Failure | First response |
|---|---|
| Transient network / rate limit | Wait briefly, retry once or twice with backoff |
| Command not found / missing CLI | Install if policy allows, or switch tool / skill |
| Permission denied | Stop destructive retries; ask or use safer path |
| Assertion / test failure | Fix root cause; do not rerun hoping for luck |
| Ambiguous / empty result | Change query or tool; verify inputs |
Retry policy
- Max 2 automatic retries for the same exact command.
- On retry #2, change something (flags, cwd, tool, smaller scope).
- Capture stderr; quote the relevant error in your reasoning.
- If still failing → fallback or ask the user with a concrete question.
Fallback ladder
- Built-in tool alternative (
web_fetchvsexec curl,grepvs shell grep) - Smaller reproduction (isolate the failing step)
- Read-only diagnosis, then propose a fix
- User intervention (credentials, network, approval)
Reporting
When you recover, briefly state:
- what failed
- what you changed
- current status
Do not hide repeated failures behind “still working on it”.