Hermes Agent 的很多“故障”,表面看起来像模型问题,实际不一定是模型。
从最近几个 GitHub Issues 看,常见误判主要集中在三类:
- Discord 里同一段回答发了两遍;
- Custom Provider 明明 Key 没错,却被 Cloudflare / WAF 拦成 403;
- 长任务、看板任务、blocked 状态的 heartbeat 看起来像“乱提醒”。
这些问题都很适合拿来做排错训练:先判断是哪一层出问题,再决定要不要动 DeepAI、模型配置、Gateway、平台适配器或 Hermes 版本。
本文基于 Hermes Agent GitHub Issues / PR 做一次问题整理。
先说结论:不是所有异常都该归因到模型
如果你把 Hermes 接到 DeepAI 这类 OpenAI-compatible API 中转站,排错时很容易第一反应就是:
是不是 DeepAI API Key 错了?
是不是模型不兼容?
是不是 Base URL 填错?
这些当然要查,但不是所有问题都在模型层。
Hermes 的完整链路更像这样:
用户 / Discord / Open WebUI
↓
Hermes Gateway / 平台适配器
↓
Hermes Agent 主循环
↓
工具、终端、文件、memory、skills
↓
模型 provider / custom endpoint
↓
DeepAI 或其他 OpenAI-compatible 服务
如果 Discord 重复发消息,问题可能在“平台投递层”。
如果 Cloudflare 403,问题可能在“HTTP header / provider 适配层”。
如果 heartbeat 一直提醒,问题可能在“长任务状态判断层”。
所以排错不要一上来就换模型。先定位层级。
Issue 1:Discord streaming 会把最终回复重复发一遍
相关 Issue:
https://github.com/NousResearch/hermes-agent/issues/25349
这个问题的现象很典型:
- 用户只发了一条消息;
- Hermes 本地 session / transcript 里只有一次最终回答;
- 但 Discord 收到了两组完全相同的分片消息;
- 两组消息中间可能隔了几十秒;
- 重复的不是模型生成,而是消息投递。
Issue 里描述的形态大概是:
T+0s bot chunk 1
T+1s bot chunk 2
T+2s bot chunk 3
T+30s bot chunk 1
T+31s bot chunk 2
T+32s bot chunk 3
这类问题最容易被误判成“模型重复回答”。但如果 transcript 里只有一个 final response,就说明模型没有重复生成。
真正应该看的是:
- streaming 是否已经发送过最终内容;
- normal final-send 路径是否又补发了一次;
- Discord 超过 2000 字符后的 chunked delivery 是否重复执行;
- retry / fallback 是否缺少幂等保护。
Issue 里怀疑的区域包括:
gateway/stream_consumer.py
gateway/run.py
gateway/platforms/base.py
gateway/platforms/discord.py
也就是说,这更像 Gateway + Discord adapter 的投递幂等问题,而不是 DeepAI、OpenAI-compatible API 或模型本身的问题。
临时判断方法
你可以这样判断是不是模型重复生成:
1. 看 Hermes 本地 transcript,是否出现两条 assistant final response; 2. 比对两次 Discord 消息的 hash / 内容是否完全一致; 3. 看两组 chunk 是否切分位置也一致; 4. 看是否只在长回复、分片回复时出现。
如果本地只有一次 final response,而 Discord 出现两组一致 chunk,基本就可以把锅从模型层移开。
临时处理思路
在官方修复前,可以考虑:
- 关闭或降低 Discord streaming;
- 缩短回答长度,减少 chunked delivery;
- 避免在 Discord 里让 Hermes 输出超长表格 / 超长代码;
- 升级到包含投递幂等修复的版本;
- 如果自己维护 fork,增加 delivery idempotency guard。
这个 guard 可以按平台、chat/thread、session/generation、response hash、delivery kind 做去重。
Issue 2:Custom Provider 被 Cloudflare 拦成 403,不一定是 API Key 错
相关 Issue:
https://github.com/NousResearch/hermes-agent/issues/9721
这个 Issue 说的是:自定义 OpenAI-compatible provider 位于 Cloudflare WAF 后面时,Hermes 可能因为没有发送合适的 User-Agent 或自定义 HTTP headers 而被 403 拦截。
注意,它不是传统意义上的:
401 Unauthorized:Key 错
而更像:
403 Forbidden:请求被网关 / WAF / 风控规则拒绝
Issue 里提到几个关键点:
headers没有被列入 custom provider 的有效配置字段;- 某些未知 provider 的默认 headers 会被移除;
switch_model时 headers 可能丢失;- 用户希望能在 config.yaml 里给 custom provider 配 headers。
这对国内用户特别重要,因为很多 OpenAI-compatible 中转站、反代服务、聚合服务都在 WAF 或 CDN 后面。
对 DeepAI 用户怎么理解
如果你用 Hermes 接 DeepAI API 中转站,常规配置仍然应该先从这三项开始:
Base URL: https://api.deepai.wang/v1
API Key: DeepAI 控制台里的 Key
Model: DeepAI 控制台里的可用模型 ID
但如果你遇到 403,不要马上下结论说“DeepAI Key 错了”。
应该区分:
| 状态码 | 更可能的问题 |
| 401 | API Key 错、Key 没带上、鉴权格式错 |
| 403 | WAF / Cloudflare / provider 策略 / header 问题 |
| 404 | Base URL 或 endpoint 路径错 |
| 429 | 限流、余额、并发或套餐限制 |
| 5xx | 上游服务、网关或临时故障 |
尤其是 curl 可以通、Hermes 不通时,要重点怀疑 Hermes provider 适配层和请求 headers 差异。
排查步骤
先用 curl 直连 DeepAI:
curl https://api.deepai.wang/v1/chat/completions \
-H "Authorization: Bearer YOUR_DEEPAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [{"role": "user", "content": "reply ok"}]
}'
如果 curl 不通,先修 DeepAI Key、模型 ID、余额、网络和 Base URL。
如果 curl 能通,但 Hermes 不通,再看:
~/.hermes/config.yaml
~/.hermes/.env
~/.hermes/logs/errors.log
重点确认:
- Hermes 最终使用的是不是你以为的 provider;
- base_url 是否只到
/v1,不要填完整/chat/completions; - model ID 是否真实存在;
- background / auxiliary / review agent 是否继承了同一 provider 配置;
- Hermes 当前版本是否支持你需要的 custom headers 行为。
Issue 3:长任务 heartbeat 不是“模型又说话了”,而是 Gateway 状态提醒
相关 PR:
https://github.com/NousResearch/hermes-agent/pull/25446
这个 PR 修的是 Gateway 长任务 heartbeat 处理问题,涉及 active、idle、completed kanban、blocked kanban sessions。
它提到的修复点包括:
- activity summary 字段缺失或为 None 时避免崩溃;
- 正常 active session 的 heartbeat 不应因为缺少
is_idle字段而被抑制; - completed / cancelled / archived 看板卡片不应继续发 progress heartbeat;
- blocked card 的 approval reminder 先立即提醒一次,再按
HERMES_BLOCKED_REMINDER_INTERVAL限频,默认 3600 秒; - 长任务 heartbeat 发送时保留平台 thread metadata。
这类问题对用户体验影响很大,因为它不像普通报错,而是“提醒行为异常”。
例如:
- 已完成的任务还在报进度;
- 被 blocked 的任务疯狂提醒;
- 活跃任务没有任何 heartbeat;
- 消息被发到错误线程;
- 看起来像 agent 自己重复发言。
但它本质上不是模型在生成内容,而是 Gateway 的长任务状态提示。
怎么判断是 heartbeat 问题
如果消息内容类似:
still working...
blocked waiting approval...
progress heartbeat...
或者它出现在长时间任务、kanban card、后台 session、approval 阶段,那就优先按 Gateway heartbeat 查。
不要把它当成模型幻觉。
可操作检查
检查这些点:
- Hermes 版本是否包含 heartbeat 修复;
- blocked reminder 是否被限频;
HERMES_BLOCKED_REMINDER_INTERVAL是否被设置得太低;- gateway 是否重启导致 blocked 首次提醒再次发送;
- 平台 thread metadata 是否保留;
- kanban task 状态是否已经 completed / cancelled / archived。
如果你只是普通使用 Hermes + DeepAI,不一定会碰到看板任务。但如果你把 Hermes 用作长期运行 agent、定时任务、自动审查、后台处理器,这类 heartbeat 行为就会非常重要。
三个 Issue 放在一起看:排错要先分层
把这几个问题放在一起,其实能总结出一套很实用的判断表。
| 现象 | 优先怀疑层级 | 不要急着怀疑 |
| Discord 同一长回复发两遍 | Gateway / Discord delivery | DeepAI 模型重复生成 |
| curl 能通,Hermes custom provider 403 | Hermes provider headers / WAF | API Key 一定错 |
| blocked 任务频繁提醒 | Gateway heartbeat / kanban 状态 | 模型主动骚扰用户 |
| Open WebUI 只看到 hermes-agent | Hermes API Server 入口名 | DeepAI 模型列表丢失 |
/v1/models 返回不符合预期 | 访问的是 DeepAI 还是 Hermes | 模型服务必然异常 |
这张表的价值在于:你不会把所有异常都推给模型。
Hermes 是 Agent,不是普通聊天壳。它多了 gateway、平台适配器、长任务、终端、文件、skills、看板、API Server,所以排错一定要分层。
对 DeepAI API 中转站用户的建议
如果你准备用 DeepAI 给 Hermes 提供模型能力,可以按这个顺序排错:
1. 先验证 DeepAI 直连
用 curl 调 DeepAI 的 OpenAI-compatible endpoint,确认 Key、模型 ID、余额、网络都没问题。
2. 再验证 Hermes Custom Endpoint
用 hermes model 或 ~/.hermes/config.yaml 确认:
base_url = https://api.deepai.wang/v1
api_key = DeepAI API Key
model = DeepAI 控制台中的模型 ID
不要把 Base URL 填成完整接口路径。
3. 如果只有 Discord 异常,去查 Gateway / 平台适配器
尤其是重复消息、分片消息、线程投递错位,不要优先改 DeepAI 配置。
4. 如果是长任务提醒异常,去查 heartbeat / kanban
这和模型输出不是一层。
5. 如果是 403,区分鉴权失败和 WAF 拦截
401 更像 Key 问题;403 更可能是策略、header、WAF、provider 适配问题。
文章里不建议的“错误修法”
遇到这些 issue,不建议盲目这样做:
- 一看到 Discord 重复,就换模型;
- 一看到 403,就重置 DeepAI Key;
- 一看到 heartbeat,就删掉会话;
- 一看到 Open WebUI 模型名是 hermes-agent,就以为 DeepAI 模型没接上;
- 一看到 curl 能通,就认定 Hermes 一定配置没问题。
正确做法是沿链路定位:
平台入口 → Gateway → Agent → Provider → DeepAI / 上游模型
每一层都有自己的日志、配置和错误类型。
相关 Issue / PR
Discord streaming 重复发送最终回复:
https://github.com/NousResearch/hermes-agent/issues/25349
Custom Provider 缺少 custom headers 导致 Cloudflare 403:
https://github.com/NousResearch/hermes-agent/issues/9721
Gateway 长任务 heartbeat / blocked session 修复:
https://github.com/NousResearch/hermes-agent/pull/25446
Hermes 接入 DeepAI 基础教程:
Hermes Agent 接入 DeepAI 教程:用 Custom Endpoint 配 OpenAI Compatible API
Hermes Custom Endpoint 与 API Server 区别:
Hermes 的 Custom Endpoint 和 API Server 不是一回事:接 DeepAI 前先别搞反
DeepAI API 中转站:
https://api.deepai.wang/
总结
这几个 Hermes Issues 的共同点是:表面现象很像“模型有问题”,但真正原因可能在不同层级。
Discord 重复回复,多半先看 Gateway 和平台投递幂等。
Custom Provider 403,要区分 API Key 错误和 Cloudflare / WAF / headers 问题。
长任务 heartbeat 异常,要看 Gateway 对 active、idle、completed、blocked 状态的判断。
如果你用 DeepAI API 中转站接 Hermes,最重要的是别把所有问题都归因到上游模型。先用 curl 确认 DeepAI 直连,再看 Hermes provider 配置,最后根据异常发生位置去查 Gateway、平台适配器或 heartbeat。
这样排错更快,也不会把本来能用的模型配置越改越乱。