fix blank tool_name entries in state.db and JSON session logs - #28914
Merged
ethernet8023 merged 1 commit intoMay 19, 2026
Merged
Conversation
Introduces make_tool_result_message() in tool_dispatch_helpers.py as the single place where tool-result message dicts are built. All six construction sites in tool_executor.py, agent_runtime_helpers.py, and mini_swe_runner.py now use it, so tool_name is set in memory from the moment a message is created rather than relying on fallback logic in the flush paths. Fixes blank tool_name in both state.db and JSON session logs. Adds tests.
1 task
ethernet8023
approved these changes
May 19, 2026
ethernet8023
left a comment
Collaborator
There was a problem hiding this comment.
lgtm, ty for the fix!
Author
|
Thanks @ethernet8023 ! |
5 tasks
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…l-names-at-msg-construction fix blank tool_name entries in state.db and JSON session logs
Seven74AI
pushed a commit
to Seven74AI/hermes-agent
that referenced
this pull request
Jun 13, 2026
…l-names-at-msg-construction fix blank tool_name entries in state.db and JSON session logs
alt-glitch
pushed a commit
that referenced
this pull request
Jun 14, 2026
…sg-construction fix blank tool_name entries in state.db and JSON session logs
T02200059
pushed a commit
to T02200059/hermes-agent
that referenced
this pull request
Jun 18, 2026
…l-names-at-msg-construction fix blank tool_name entries in state.db and JSON session logs
liuchanchen
pushed a commit
to liuchanchen/hermes-agent
that referenced
this pull request
Jun 23, 2026
…l-names-at-msg-construction fix blank tool_name entries in state.db and JSON session logs
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…l-names-at-msg-construction fix blank tool_name entries in state.db and JSON session logs
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…l-names-at-msg-construction fix blank tool_name entries in state.db and JSON session logs
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.
What does this PR do?
This PR fixes blank tool_name entries in state.db and JSON session logs. It refactors the tool message construction for the OpenAI format at 6 sites and adds "tool_name" to the message. This doesn't cause any problems for the existing code but means that session persistence can pick it up.
The alternative would have been to check for both "name" and "tool_name" at various persistence points - some existing code already does this. But that seems a fragile solution if downstream code is changed or new peristence paths added - that kind of thing might have caused this very bug!
Related Issue
Fixes #28915
Type of Change
Changes Made
agent/tool_dispatch_helpers.py— adds make_tool_result_message(name, content, tool_call_id) factory and exports it via__all__agent/tool_executor.py— all four tool-result construction sites (sequential normal, sequential interrupt skip, concurrent normal, concurrent interrupt skip) replaced with make_tool_result_messageagent/agent_runtime_helpers.py— repair/rewrite path updated to use make_tool_result_messagemini_swe_runner.py— tool response construction updated; also adds the missing "name" field which was previously absent entirelytests/run_agent/test_tool_name_db_persistence.py— new test verifying tool_name survives the flush path into the session DBtests/test_hermes_state.py— new test verifying tool_name is correctly written by replace_messages (used by /retry, /undo, /compress)How to Test
Also added tests:
tests/run_agent/test_tool_name_db_persistence.py— new file; tests that tool_name set by make_tool_result_message survives the flush path into the session DB (_flush_messages_to_session_db)tests/test_hermes_state.py— existing file; one new test added (test_replace_messages_persists_tool_name) to the TestMessageStorage class, covering the replace_messages path used by /retry, /undo, and /compressChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs