mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(agent): log outer-loop exceptions at ERROR with traceback (#32264)
The outer 'except Exception' guard in run_conversation() captures exceptions raised inside the agent loop (during streaming, tool dispatch, message construction, etc.) and prints a one-line summary to the screen. The traceback was only logged at DEBUG, so it never landed in errors.log (WARNING+) and was lost. For intermittent failures — the most important kind to debug — users saw 'Error during OpenAI-compatible API call #N: <message>' on screen with no way to recover the call site. Switching to logger.exception() emits the full traceback at ERROR so it goes to both agent.log and errors.log automatically. This is a pure logging change; control flow is unchanged.
This commit is contained in:
parent
30928f945f
commit
c2aa235328
1 changed files with 8 additions and 2 deletions
|
|
@ -3945,8 +3945,14 @@ def run_conversation(
|
|||
print(f"❌ {error_msg}")
|
||||
except (OSError, ValueError):
|
||||
logger.error(error_msg)
|
||||
|
||||
logger.debug("Outer loop error in API call #%d", api_call_count, exc_info=True)
|
||||
|
||||
# Emit the full traceback at ERROR level so it lands in both
|
||||
# agent.log AND errors.log. Previously this was logged at DEBUG,
|
||||
# which meant intermittent outer-loop failures were unreproducible
|
||||
# — users would see a one-line summary on screen with no way to
|
||||
# recover the call site. logger.exception() includes the
|
||||
# traceback automatically and emits at ERROR.
|
||||
logger.exception("Outer loop error in API call #%d", api_call_count)
|
||||
|
||||
# If an assistant message with tool_calls was already appended,
|
||||
# the API expects a role="tool" result for every tool_call_id.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue