Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/netmindai-open/narranexus/bus_failures.pygit clone --depth 1 https://github.com/NetMindAI-Open/NarraNexusWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01234 |
| Opus 5 | $0.00000 | $0.00617 |
| Sonnet 5 | $0.00000 | $0.00247 |
| Haiku 4.5 | $0.00000 | $0.00123 |
Grade A, and why
bus_failures.py scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 73 lines — stays where its author put it; the contents beside it link to each section on GitHub.
agents/bus_failures.py — MessageBus 永久失败列表 + 重试恢复路由
为什么存在
LocalMessageBus.get_pending_messages(local_bus.py)在一条消息的
bus_message_failures.retry_count 达到 3 时会把它永久过滤掉——这是防
poison-message 的机制,但代价是消息从此彻底消失,没有任何 UI 或 API 能看到它、
更谈不上恢复。MessageBusTrigger._notify_permanent_failure
(message_bus_trigger.py)解决了"用户完全无感"的一半问题(往 inbox 写一条
通知),但通知之后用户仍然需要一个动作入口去清掉失败记录、让消息重新被投递
——这个文件就是那个入口。是 NetMindAI-Open/NarraNexus#52 修复的"可恢复"半边。
独立成文件而不是塞进 inbox.py 或某个 bus.py,是因为它严格遵循
agents/cost.py 建立的"per-agent 子资源路由 + 所有权校验"惯例——agents.py
把这类文件都聚合在 /api/agents/{agent_id}/... 命名空间下,帮它挂进去比另开
一套顶层路由更符合项目现有模式。
上下游关系
- 被谁用:
backend/routes/agents/core.py(router.include_router(bus_failures_router),挂载在/api/agents下);前端目前没有对应 UI(本 PR 只交付后端路由,前端 follow-up) - 依赖谁:
backend.auth.resolve_current_user_id— 拿 viewer 身份(同agents/cost.py模式)xyz_agent_context.utils.db.db_factory.get_db_client— 直接查bus_message_failures/bus_messages/agents表- 不直接依赖
LocalMessageBus——重试端点只是删除bus_message_failures行,下一次MessageBusTrigger轮询会自然通过get_pending_messages把消息捞回来
设计决策
重试 = 删记录,不是重新入队:retry_bus_failure 只是 DELETE FROM bus_message_failures WHERE message_id=... AND agent_id=...,不主动触发
AgentRuntime。这是安全的,因为失败路径从不调用 ack_processed(只有
_handle_channel_batch 的成功分支会推进游标——见 message_bus_trigger.py),
所以失败消息对应的 bus_channel_members.last_processed_at 游标从未越过它;
删除失败记录后,下一次 MessageBusTrigger 轮询(默认 3-12 秒自适应间隔)
自然会把消息重新纳入 get_pending_messages。被否决的方案是重试端点直接调用
AgentRuntime——那样会重复实现 _handle_channel_batch 的整套 prompt 构建 /
owner-relay / team-chat 分支逻辑,而"等下一次轮询"的延迟只有几秒,不值得。
鉴权照抄 agents/cost.py:viewer_id 只信 session(拒绝 ?user_id=
query param),单 agent 强制 agents.created_by == viewer_id,失败统一 404
(不是 403,不泄露 agent 是否存在)。这个文件没有引入新的鉴权模式,是刻意的
——项目里已经有一个验证过的 per-agent 所有权校验模式,复用比发明新的更安全。
retry_count >= 3 而非任意失败都返回:list_bus_failures
只列出真正"永久失败、被 poison filter 挡住"的消息(这正是需要人工介入的那批),
不列出 1-2 次瞬时失败还有机会自愈的消息——避免给用户一堆噪音。
Gotcha / 边界情况
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 73 lines · 0 tokens per session scan A d6c1fb2b4fc9
bus_failures.py is an agent published in the GitHub repository NetMindAI-Open/NarraNexus (84 stars, last pushed 10d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,234 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
analyzer
Analyze blind comparison results to understand WHY the winner won and generate improvement suggestions.
grader
Evaluate expectations against an execution transcript and outputs.
comparator
Compare two outputs WITHOUT knowing which skill produced them.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.