hermes - ✅(Solved) Fix Clarify and classify repeated provider safety-block failures instead of generic API failed after 3 retries [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#18028Fetched 2026-05-01 05:54:16
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×5cross-referenced ×1

Error Message

In practice the agent is still running, but the user sees the same error repeatedly and cannot tell whether this is: 2026-04-30 00:39:15 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=43 tokens=~74,862 2026-04-30 01:10:51 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=55 tokens=~79,909 2026-04-30 01:16:42 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=64 tokens=~85,606 2026-04-30 02:06:00 ERROR [20260430_014542_58e6e3] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=62 tokens=~82,779 2026-04-30 12:05:26 ERROR [cron_0100edd0075e_20260430_115410] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=38 tokens=~88,626 2026-04-30 13:16:45 ERROR [20260430_131604_3e862c] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=64 tokens=~87,954 2026-04-30 13:17:57 ERROR [20260430_130823_457ac595] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=62 tokens=~85,611 2026-04-30 13:19:40 ERROR [20260430_130823_457ac595] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=65 tokens=~98,379

  • Add structured error classification such as provider_safety_block, provider_connection_error, tool_error, gateway_delivery_error.

Root Cause

Expected behavior

When the upstream provider returns this specific safety/moderation style failure, Hermes should make it clear that:

  1. Hermes/gateway is alive.
  2. The failure came from the model/provider, not necessarily from the requested app/site/tool.
  3. The user can try a narrower/rephrased request, shorter context, or a different model/provider if configured.
  4. Cron/job outputs should be marked failed/degraded when they contain API call failed after 3 retries, not treated as successful just because the wrapper produced a markdown output.

Fix Action

Fix / Workaround

Actual behavior

The same generic failure can be delivered repeatedly to Telegram, with no provider-specific explanation or mitigation. It feels like Hermes is broken and encourages users to retry the same request, which often reproduces the same block.

PR fix notes

PR #18164: Fallback immediately on provider content-policy blocks

Description (problem / solution / changelog)

Summary

  • classify provider content-policy blocks (including OpenAI Codex cybersecurity-risk messages) as non-retryable
  • activate fallback immediately instead of retrying the same blocked prompt until Max retries
  • add regression coverage for status-less and 400 content-policy block messages

Verification

  • python -m pytest tests/agent/test_error_classifier.py tests/run_agent/test_primary_runtime_restore.py -q
  • python -m py_compile agent/error_classifier.py run_agent.py

Changed files

  • agent/error_classifier.py (modified, +23/-1)
  • run_agent.py (modified, +14/-5)
  • tests/agent/test_error_classifier.py (modified, +28/-1)

Code Example

API failed after 3 retries — This content was flagged for possible cybersecurity risk...

---

2026-04-30 00:39:15 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=43 tokens=~74,862
2026-04-30 01:10:51 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=55 tokens=~79,909
2026-04-30 01:16:42 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=64 tokens=~85,606
2026-04-30 02:06:00 ERROR [20260430_014542_58e6e3] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=62 tokens=~82,779
2026-04-30 12:05:26 ERROR [cron_0100edd0075e_20260430_115410] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=38 tokens=~88,626
2026-04-30 13:16:45 ERROR [20260430_131604_3e862c] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=64 tokens=~87,954
2026-04-30 13:17:57 ERROR [20260430_130823_457ac595] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=62 tokens=~85,611
2026-04-30 13:19:40 ERROR [20260430_130823_457ac595] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=65 tokens=~98,379

---

2026-04-27 23:07:12 WARNING [...] Failed to generate context summary: This content was flagged for possible cybersecurity risk... Further summary attempts paused for 60 seconds.
RAW_BUFFERClick to expand / collapse

Bug description

Hermes/gateway surfaces upstream model safety blocks as repeated generic user-visible failures:

❌ API failed after 3 retries — This content was flagged for possible cybersecurity risk...

In practice the agent is still running, but the user sees the same error repeatedly and cannot tell whether this is:

  • a broken Telegram/gateway session,
  • a cron job failure,
  • a model/provider moderation refusal,
  • or a task-specific prompt/content issue.

This has happened repeatedly on provider=openai-codex model=gpt-5.5, especially for long browser/cron/social/outreach contexts.

Evidence from logs

Recent examples from ~/.hermes/logs/agent.log and ~/.hermes/logs/errors.log:

2026-04-30 00:39:15 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=43 tokens=~74,862
2026-04-30 01:10:51 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=55 tokens=~79,909
2026-04-30 01:16:42 ERROR [20260430_001938_cbfa2a4f] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=64 tokens=~85,606
2026-04-30 02:06:00 ERROR [20260430_014542_58e6e3] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=62 tokens=~82,779
2026-04-30 12:05:26 ERROR [cron_0100edd0075e_20260430_115410] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=38 tokens=~88,626
2026-04-30 13:16:45 ERROR [20260430_131604_3e862c] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=64 tokens=~87,954
2026-04-30 13:17:57 ERROR [20260430_130823_457ac595] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=62 tokens=~85,611
2026-04-30 13:19:40 ERROR [20260430_130823_457ac595] API call failed after 3 retries. This content was flagged for possible cybersecurity risk... | provider=openai-codex model=gpt-5.5 msgs=65 tokens=~98,379

There is also at least one summarization-specific case:

2026-04-27 23:07:12 WARNING [...] Failed to generate context summary: This content was flagged for possible cybersecurity risk... Further summary attempts paused for 60 seconds.

Expected behavior

When the upstream provider returns this specific safety/moderation style failure, Hermes should make it clear that:

  1. Hermes/gateway is alive.
  2. The failure came from the model/provider, not necessarily from the requested app/site/tool.
  3. The user can try a narrower/rephrased request, shorter context, or a different model/provider if configured.
  4. Cron/job outputs should be marked failed/degraded when they contain API call failed after 3 retries, not treated as successful just because the wrapper produced a markdown output.

Actual behavior

The same generic failure can be delivered repeatedly to Telegram, with no provider-specific explanation or mitigation. It feels like Hermes is broken and encourages users to retry the same request, which often reproduces the same block.

Proposed fixes

  • Detect content was flagged for possible cybersecurity risk / moderation-like provider errors and map to a clearer user-facing message.
  • Add structured error classification such as provider_safety_block, provider_connection_error, tool_error, gateway_delivery_error.
  • For cron jobs, treat provider safety blocks after retries as last_status: failed or degraded and expose the reason in cron output metadata.
  • Consider optional fallback model/provider routing for safety-blocked summarization or long-context housekeeping tasks, if configured.
  • Avoid retrying identical prompts 3 times when the response is a deterministic policy/safety block; retry only transient errors.

Environment

  • Hermes v0.11.0
  • Gateway: Telegram
  • Provider/model observed: openai-codex / gpt-5.5
  • Logs: ~/.hermes/logs/agent.log, ~/.hermes/logs/errors.log

extent analysis

TL;DR

Detect and handle provider-specific safety block errors to provide clearer user-facing messages and mitigate repeated failures.

Guidance

  • Identify and classify errors with messages like "content was flagged for possible cybersecurity risk" as provider_safety_block to differentiate them from other errors.
  • Modify the error handling to provide more informative messages to users, indicating that the issue is with the provider/model, not the Hermes/gateway.
  • Update cron job handling to mark jobs as failed or degraded when encountering provider safety blocks after retries, and include the reason in output metadata.
  • Consider implementing optional fallback model/provider routing for tasks blocked by safety checks, if configured.

Example

No specific code example is provided due to the lack of direct code references in the issue, but error classification and handling modifications could involve conditional checks for specific error messages and updating the user-facing error messages accordingly.

Notes

The proposed fixes aim to improve error handling and user experience but may require adjustments based on the specific implementation details of Hermes and its interaction with providers like openai-codex.

Recommendation

Apply workaround by detecting and handling provider-specific safety block errors to improve user experience and reduce unnecessary retries. This approach addresses the immediate issue of unclear error messages and repeated failures without requiring a full version upgrade or significant code overhaul.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When the upstream provider returns this specific safety/moderation style failure, Hermes should make it clear that:

  1. Hermes/gateway is alive.
  2. The failure came from the model/provider, not necessarily from the requested app/site/tool.
  3. The user can try a narrower/rephrased request, shorter context, or a different model/provider if configured.
  4. Cron/job outputs should be marked failed/degraded when they contain API call failed after 3 retries, not treated as successful just because the wrapper produced a markdown output.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Clarify and classify repeated provider safety-block failures instead of generic API failed after 3 retries [1 pull requests, 1 participants]