Skip to content

fix(title-gen): surface auxiliary failures instead of silently dropping#16371

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-eaa8cc1a
Apr 27, 2026
Merged

fix(title-gen): surface auxiliary failures instead of silently dropping#16371
teknium1 merged 1 commit into
mainfrom
hermes/hermes-eaa8cc1a

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Title-generation failures now route through the existing _emit_auxiliary_failure channel so a depleted auxiliary provider produces a user-visible warning instead of accumulating NULL session titles.

Closes #15775.

Root cause

agent/title_generator.py:54-56 caught all exceptions, logged at debug, and returned None. The CLI and gateway callers wrapped the call in a bare try/except: pass. A pre-existing AIAgent._emit_auxiliary_failure was only wired for background-review failures. Reporter observed 45 untitled sessions over 19 days (OpenRouter 402) with zero user indication.

Changes

  • agent/title_generator.py — optional failure_callback; log bumped to WARNING; callback errors swallowed so the fire-and-forget thread can't crash.
  • cli.py + gateway/run.py — pass agent._emit_auxiliary_failure as the callback.
  • tests/agent/test_title_generator.py — cover callback fires on exception, callback errors are swallowed, legacy no-callback behavior preserved, maybe_auto_title forwards the kwarg into the worker thread.

Validation

Before After
Aux 402 during title gen debug log, None returned, bare except: pass in caller WARNING log + ⚠ Auxiliary title generation failed: … via status_callback
Targeted tests 15 passing 19 passing (3 new + 1 updated)
E2E (simulated 402) callback fires with ("title generation", PaymentError), DB unchanged

Out of scope

  • hermes doctor integration and a hermes sessions retitle backfill command were suggested in the issue but are deferred to a follow-up.
  • context_compressor.py already surfaces warnings via _emit_warning (run_agent.py:8116-8123) — no change needed.
  • session_search surfaces empty results to the agent as a tool result, so the agent itself can re-query — no silent-loss risk.

Closes #15775.

Title generation swallowed exceptions at debug level and returned None,
so a depleted auxiliary provider (e.g. OpenRouter 402) silently left
sessions with NULL titles. Reporter observed 45 untitled sessions
accumulated over 19 days with no user-visible indication.

- agent/title_generator.py: accept optional failure_callback, bump log
  to WARNING, invoke callback on call_llm exception (swallowing callback
  errors so nothing can crash the fire-and-forget worker thread).
- cli.py, gateway/run.py: pass agent._emit_auxiliary_failure as the
  callback so failures route through the existing user-visible warning
  channel.
- tests: cover callback fires / errors are swallowed / no-callback
  legacy behavior / maybe_auto_title forwards kwarg to worker.
@teknium1 teknium1 merged commit 4a2ee6c into main Apr 27, 2026
11 of 12 checks passed
@teknium1 teknium1 deleted the hermes/hermes-eaa8cc1a branch April 27, 2026 04:49
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent failure of auxiliary tasks (title_generation/session_search) with no user notification or escalation

2 participants