agentleFS
28672032962867203296/hermes-agent/skills/software-development/error-recovery-patterns/SKILL.md

error-recovery-patterns

Skill0 starsChanged 3 months agoMITView on GitHub

故障恢复模式:分层恢复策略+预判规避+降级链路。从"拦截+重试"到"韧性系统

  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Error Recovery Patterns — 故障恢复模式

safety-shield 负责拦截,error-recovery 负责恢复。一个是盾,一个是急救包。

一、分层恢复策略

层级故障类型恢复策略示例
L0 重试瞬时故障(网络波动、临时超时)等2s→重试 ×3API调用超时
L1 降级服务不可用(API挂了、MCP崩了)切换到备选方案即梦API→替代方案
L2 回退操作失败(文件写坏、git冲突)回滚到操作前状态config.yaml改坏了
L3 熔断连续失败(同服务3次失败)暂停该服务5分钟某个MCP一直403
L4 人工无法自动恢复(逻辑错误、数据丢失)清晰报告+建议不确定怎么修

二、预判规避

在执行前预测可能故障,提前准备恢复方案:

操作: 修改config.yaml
预判: 格式错误 → 先备份 → yaml验证 → 改 → 验证
操作: 调用即梦API
预判: 超时/限流 → 设30s超时 → 3次重试 → 降级到本地生成
操作: git merge
预判: 冲突 → 先fetch → 预检测冲突 → 有冲突先报告

三、降级链路

每个关键操作都要有降级方案:

主方案降级1降级2最后手段
GitHub APIghfast.top镜像gh-proxy.com告诉用户手动查
即梦API本地FFmpeg生成静态图替代跳过视频
pip install清华镜像阿里云镜像手动下载whl
MCP serverGateway热重载重启server直连替代

四、恢复日志

{
  "operation": "config.yaml edit",
  "predicted_risks": ["YAML格式错误", "缩进不对"],
  "precautions": ["备份", "yaml验证"],
  "actual_failure": "缩进错误",
  "recovery": "回退到备份→重新编辑",
  "lesson": "改config.yaml前必须先yaml验证"
}

恢复日志→3次同一模式→升级到safety-shield禁止列表。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.