Heuristic:42 evey Hermes plugins Fail Safe Collectors
| Knowledge Sources | |
|---|---|
| Domains | Error_Handling, Resilience, Signal_Collection |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Wrap each signal collector in its own try/except so one failing source never prevents the rest from contributing actions to the priority queue.
Description
The autonomy engine's decide_handler runs six independent signal collectors (bridge, goals, projects, memory, cron, time). Rather than letting a single collector failure abort the entire decision loop, each collector is invoked inside a per-source try/except block. If a collector raises, its count is recorded as "err:{message}" and the loop continues with the remaining sources. This means a missing bridge.db, an unreadable goals.md, or a broken git repo never blocks the agent from deciding its next action.
The same pattern appears in the digest plugin, where every aggregation function (_get_costs, _get_cron, _get_bridge, _get_goals, _get_alerts) wraps in try/except and returns zero/empty defaults on failure.
Usage
Use this heuristic when building any multi-source aggregation pipeline — decision engines, digest generators, status dashboards. Apply it whenever one source being unavailable should not prevent the others from being queried.
The Insight (Rule of Thumb)
- Action: Wrap each collector/aggregator function call in its own
try/exceptblock. - Value: On exception, record the error string (e.g.,
"err:{e}") and return an empty list or zero-valued dict — never re-raise. - Trade-off: Errors are silently absorbed per-source. You lose visibility into individual collector failures unless you inspect the returned error counts. The trade-off is worth it: a degraded decision is better than no decision.
- Compatibility: Works with any number of collectors; the caller should display error counts so the operator can investigate later.
Reasoning
An autonomous agent that runs 24/7 cannot afford a single point of failure in its decision loop. If bridge.db is locked or goals.md is mid-write, the agent should still be able to decide to run memory_maintenance or cost_review. The fail-safe pattern ensures the decision loop degrades gracefully: the worst case is "fewer candidate actions" rather than "agent is stuck."
The digest plugin applies the same logic: if Langfuse is down, costs show $0 but cron health is still accurate. Each source degrades independently.