fix(title-gen): surface auxiliary failures instead of silently dropping#16371
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Title-generation failures now route through the existing
_emit_auxiliary_failurechannel 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-56caught all exceptions, logged atdebug, and returned None. The CLI and gateway callers wrapped the call in a baretry/except: pass. A pre-existingAIAgent._emit_auxiliary_failurewas 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— optionalfailure_callback; log bumped to WARNING; callback errors swallowed so the fire-and-forget thread can't crash.cli.py+gateway/run.py— passagent._emit_auxiliary_failureas the callback.tests/agent/test_title_generator.py— cover callback fires on exception, callback errors are swallowed, legacy no-callback behavior preserved,maybe_auto_titleforwards the kwarg into the worker thread.Validation
except: passin caller⚠ Auxiliary title generation failed: …via status_callback("title generation", PaymentError), DB unchangedOut of scope
hermes doctorintegration and ahermes sessions retitlebackfill command were suggested in the issue but are deferred to a follow-up.context_compressor.pyalready surfaces warnings via_emit_warning(run_agent.py:8116-8123) — no change needed.session_searchsurfaces empty results to the agent as a tool result, so the agent itself can re-query — no silent-loss risk.