gh-aw 错误恢复流程设计
error-recovery-patterns
设计 gh-aw 的错误处理、重试、恢复与调试流程。
- License 许可
- MIT
- 所属仓库
- github/gh-aw
- 最近更新
- 2026-11-15
- Stars
- ★ 5.6k
- Forks
- 626
01 前言 Front Matter
- name
- error-recovery-patterns
- description
- Design gh-aw error handling, retry, recovery, and debugging flows.
02 资源文件 3
- 脚本scripts/duo-checker-prompt.md4.5 KB
- 脚本scripts/duo-subagent.sh22.8 KB
- 脚本scripts/subagent.sh11.5 KB
03 SKILL.md 正文
Error Recovery Patterns Skill
Use this skill for error handling, recovery strategies, and debugging in gh-aw.
Purpose
Implement robust recovery patterns to:
- Reduce retry loops in agent sessions (target: <10% vs current 23%)
- Implement circuit breakers to prevent infinite retry loops
- Add proactive recovery for installation, dependency, and API failures
- Improve debug logging for recovery attempts
When to Use This Skill
Use this skill when:
- Implementing retry logic for network operations, installations, or API calls
- Debugging retry loop issues in workflows or agent sessions
- Adding error recovery patterns to new or existing code
- Understanding transient vs non-transient error classification
- Implementing circuit breakers or exponential backoff
- Adding debug logging for recovery attempts
Key Concepts Covered
1. Circuit Breaker Pattern
- Maximum retry limits (standard: 3 attempts)
- Exponential backoff strategies
- Fail-fast on non-transient errors
- Implementation in JavaScript, Shell, and Go
2. Installation Failure Recovery
- NPM installation with cache clearing and registry fallbacks
- Python pip installation with mirror alternatives
- Docker image pull with retry and rate limit handling
- Copilot CLI installation with network retry
3. API Timeout and Rate Limit Handling
- GitHub API rate limit detection and backoff
- Transient error detection patterns
- Custom retry configuration for different APIs
- Rate limit-specific retry strategies
4. Debug Logging for Recovery
- Logger package usage for retry attempts
- Category naming conventions (pkg:filename)
- DEBUG environment variable patterns
- Zero-overhead logging when disabled
5. Error Categorization
- Transient vs non-transient errors
- Network errors, timeout patterns
- HTTP error codes (502, 503, 504)
- GitHub-specific errors (rate limits, abuse detection)
Anti-Patterns to Avoid
This skill explicitly covers anti-patterns to avoid:
- ❌ Infinite retry loops without maximum limits
- ❌ Retrying validation errors that won't self-correct
- ❌ No backoff delay between attempts
- ❌ Silent retries without logging
- ❌ Retrying non-transient errors
Code Examples Provided
The skill includes production-ready examples for:
- JavaScript retry with
withRetry()function - Shell script retry loops with exponential backoff
- Go retry patterns with context and timeouts
- NPM/pip/docker installation recovery
- GitHub API rate limit handling
- Debug logging for all recovery attempts
Related Skills
- error-messages - Error message formatting and style guide
- error-pattern-safety - Safety guidelines for error pattern regex
- developer - General development guidelines and conventions
Full Documentation
Complete documentation available at: ../../scratchpad/error-recovery-patterns.md
This skill references the comprehensive error recovery patterns document which includes:
- Console formatting requirements
- Error wrapping patterns
- Common error scenarios with step-by-step resolution
- Error message templates
- Debugging runbook
- Error categorization decision trees
- Metrics and monitoring strategies
04 同仓库更多 Skills
cracktro
Edit, preview, and verify the standalone interactive talk deck in docs/public/cracktro (slides, SVG diagrams, transitions, WebAudio sound).
create-connector
Create or extend a declaration-only third-party connector, with narrow reads, separate safe outputs, optional protected triggers, and offline conformance evidence.
GitHub 智能体工作流
GitHub Agentic Workflows
GitHub Agentic Workflows(`gh-aw`)是一个 GitHub CLI 扩展,用于以 Markdown 编写 Agentic Workflows(智能体工作流)并将其编译为 GitHub Actions。
Windows 跨平台兼容处理
windows-compatibility
跨平台路径处理和命令模式。
Squad SDK 语义化版本规范
versioning-policy
Squad SDK 和 CLI 的 Semver(语义化版本)版本规则——防止预发布版本事故。
智能体分层记忆管理
tiered-memory
三层智能体记忆模型(热/冷/维基),用于减少每次生成(spawn)时的上下文。