Skip to content

feat(agent): surface all retry/fallback/compression lifecycle events#3153

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-7d7ac769
Mar 26, 2026
Merged

feat(agent): surface all retry/fallback/compression lifecycle events#3153
teknium1 merged 1 commit intomainfrom
hermes/hermes-7d7ac769

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

No retry, fallback, or compression path is silent anymore. Users see what's happening at every stage.

Adds _emit_status() helper that sends lifecycle notifications to both CLI (_vprint force=True) and gateway (status_callback("lifecycle", ...)). Never raises — exceptions are swallowed so it can't interrupt retry logic.

Pathways surfaced

Event Before After
General retry backoff (2-60s) logger.warning() only — invisible to user ⏳ Retrying in Xs (attempt N/M)...
Provider fallback activation raw print() — invisible to gateway 🔄 Primary model failed — switching to fallback: model via provider
Rate limit → fallback silent ⚠️ Rate limited — switching to fallback provider...
Empty/malformed response → fallback silent ⚠️ Empty/malformed response — switching to fallback...
Non-retryable client error → fallback silent ⚠️ Non-retryable error (HTTP 4xx) — trying fallback...
Max retries → fallback silent ⚠️ Max retries (N) exhausted — trying fallback...
Max retries → giving up _vprint (CLI verbose only) _emit_status (always visible, gateway too)
413 payload too large → compress _vprint (CLI verbose only) _emit_status (always visible, gateway too)
Compression success → retry _vprint (CLI verbose only) _emit_status (always visible, gateway too)

Test plan

  • 199 run_agent tests pass
  • No behavioral change to retry/fallback logic itself — only adds notifications
Add _emit_status() helper that sends lifecycle notifications to both
CLI (via _vprint force=True) and gateway (via status_callback). No
retry, fallback, or compression path is silent anymore.

Pathways surfaced:
- General retry backoff: was logger-only, now shows countdown
- Provider fallback: changed raw print() to _emit_status for gateway
- Rate limit eager fallback: new notification before switching
- Empty/malformed response fallback: new notification
- Client error fallback: new notification with HTTP status
- Max retries fallback: new notification before attempting
- Max retries giving up: upgraded from _vprint to _emit_status
- Compression retry (413 + context overflow): upgraded to _emit_status
- Compression success + retry: upgraded to _emit_status (2 instances)
@github-actions
Copy link
Copy Markdown

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@teknium1 teknium1 merged commit c07c17f into main Mar 26, 2026
3 of 4 checks passed
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
…ousResearch#3153)

Add _emit_status() helper that sends lifecycle notifications to both
CLI (via _vprint force=True) and gateway (via status_callback). No
retry, fallback, or compression path is silent anymore.

Pathways surfaced:
- General retry backoff: was logger-only, now shows countdown
- Provider fallback: changed raw print() to _emit_status for gateway
- Rate limit eager fallback: new notification before switching
- Empty/malformed response fallback: new notification
- Client error fallback: new notification with HTTP status
- Max retries fallback: new notification before attempting
- Max retries giving up: upgraded from _vprint to _emit_status
- Compression retry (413 + context overflow): upgraded to _emit_status
- Compression success + retry: upgraded to _emit_status (2 instances)
StreamOfRon pushed a commit to StreamOfRon/hermes-agent that referenced this pull request Mar 29, 2026
…ousResearch#3153)

Add _emit_status() helper that sends lifecycle notifications to both
CLI (via _vprint force=True) and gateway (via status_callback). No
retry, fallback, or compression path is silent anymore.

Pathways surfaced:
- General retry backoff: was logger-only, now shows countdown
- Provider fallback: changed raw print() to _emit_status for gateway
- Rate limit eager fallback: new notification before switching
- Empty/malformed response fallback: new notification
- Client error fallback: new notification with HTTP status
- Max retries fallback: new notification before attempting
- Max retries giving up: upgraded from _vprint to _emit_status
- Compression retry (413 + context overflow): upgraded to _emit_status
- Compression success + retry: upgraded to _emit_status (2 instances)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant