hermes - ✅(Solved) Fix [Bug]: tool_name is blank in state.db [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#28915Fetched 2026-05-20 04:01:09
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×3closed ×1cross-referenced ×1

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #28914: fix blank tool_name entries in state.db and JSON session logs

Description (problem / solution / changelog)

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

<!-- Link the issue this PR addresses. If no issue exists, consider creating one first. -->

Fixes #28915

Type of Change

<!-- Check the one that applies. -->
  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

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_message
  • agent/agent_runtime_helpers.py — repair/rewrite path updated to use make_tool_result_message
  • mini_swe_runner.py — tool response construction updated; also adds the missing "name" field which was previously absent entirely
  • tests/run_agent/test_tool_name_db_persistence.py — new test verifying tool_name survives the flush path into the session DB
  • tests/test_hermes_state.py — new test verifying tool_name is correctly written by replace_messages (used by /retry, /undo, /compress)

How to Test

  1. Run hermes and send a prompt that triggers a tool call (e.g. ask it to run a terminal command or search the web)
  2. After the response completes, query the session DB:
sqlite3 ~/.hermes/state.db
SELECT role, tool_name, substr(content,1,80) FROM messages ORDER BY timestamp DESC LIMIT 5;
  1. The role = 'tool' row should have tool_name populated with the function name rather than NULL

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 /compress

Checklist

<!-- Complete these before requesting review. -->

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: <!-- e.g. Ubuntu 24.04, macOS 15.2, Windows 11 -->

Documentation & Housekeeping

<!-- Check all that apply. It's OK to check "N/A" if a category doesn't apply to your change. -->
  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

<!-- Only fill this out if you're adding a skill. Delete this section otherwise. -->
  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

<!-- If applicable, add screenshots or log output showing the fix/feature in action. -->

Changed files

  • agent/agent_runtime_helpers.py (modified, +6/-7)
  • agent/tool_dispatch_helpers.py (modified, +14/-0)
  • agent/tool_executor.py (modified, +13/-27)
  • mini_swe_runner.py (modified, +4/-5)
  • tests/run_agent/test_tool_name_db_persistence.py (added, +45/-0)
  • tests/test_hermes_state.py (modified, +17/-0)

Code Example

sqlite3 ~/.hermes/state.db
SELECT role, tool_name, substr(content,1,80) FROM messages where role='tool' ORDER BY timestamp DESC LIMIT 5;

---

Report       https://paste.rs/xjzBP
  agent.log    https://paste.rs/NZLia
  gateway.log  https://paste.rs/pXWVa

---
RAW_BUFFERClick to expand / collapse

Bug Description

The state.db tool_name entries are always blank. I expected these to be filled with the tool name (e.g. web_search) for tool messages. I was looking to use these names for some analysis on what tools were being called in my hermes instance.

Steps to Reproduce

sqlite3 ~/.hermes/state.db
SELECT role, tool_name, substr(content,1,80) FROM messages where role='tool' ORDER BY timestamp DESC LIMIT 5;

Expected Behavior

Expect tool_name to have the tool name.

Actual Behavior

tool_name is always blank

Affected Component

Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

No response

Debug Report

Report       https://paste.rs/xjzBP
  agent.log    https://paste.rs/NZLia
  gateway.log  https://paste.rs/pXWVa

Operating System

Ubuntu 24.04

Python Version

3.11.15

Hermes Version

Hermes Agent v0.14.0 (2026.5.16)

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

Submitted a pull request that fixes this - #28914

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: tool_name is blank in state.db [1 pull requests, 1 participants]