# 资源耗尽

> 当 Provider CLI 返回 resource_exhausted 错误时（例如 Cursor 触达速率上限），Foundry 不会直接崩溃，也不会盲目高频重试，而是采用带熔断机制的指数退避策略。

Source: https://bifrost5.com/zh/foundry/docs/resource-exhaustion/

# 资源耗尽（Resource Exhaustion）

Information

Hand long, costly runs to people who answer within a defined time when something goes wrong, with Production-Grade.

[See editions](/zh/foundry/docs/editions)

当 Provider CLI 返回 `resource_exhausted` 错误时（例如 Cursor 触达速率上限），Foundry 不会直接崩溃，也不会盲目高频重试，而是采用带熔断机制的指数退避策略。

## 退避计划表

| 重试次数 | 等待时间 |
| --- | --- |
| 1 | 1 分钟 |
| 2 | 5 分钟 |
| 3 | 20 分钟 |
| 4 | 1 小时 |
| 5 | 2 小时 |
| 6+ | 彻底中止 |

Supervisor 在退避等待期间会休眠（等待间隔越长越能节省 CPU 周期）。重试次数、上次尝试时间及下次重试时间均完整记录在状态中。

## 熔断机制

- 发生故障的 Provider 将被**熔断 1 天**（TTL 保存在 DragonflyDB 中）。

- Foundry 会自动**降级切换至配置优先级链中的下一个 Provider**。

- 熔断 TTL 可在“设置 → 常规”中按需配置。

## Provider 优先级链

每种 Provider 策略都会定义降级备用顺序。例如（claude-primary）：

- Claude（首选）

- Cursor（备用）

- Gemini（备用）

若 Claude 触发熔断，任务将自动路由至 Cursor，全程无需人工干预。
