fix: resolve critical runtime stability issues across core, web, delegate, and browser tools#4828
Closed
Dusk1e wants to merge 1 commit into
Closed
fix: resolve critical runtime stability issues across core, web, delegate, and browser tools#4828Dusk1e wants to merge 1 commit into
Dusk1e wants to merge 1 commit into
Conversation
Contributor
|
Merged via PR #4843. Your commit was cherry-picked onto current main with authorship preserved in git log. We also completed the browser_tool fix — your PR caught 4 of 7 hardcoded HERMES_HOME instances, our follow-up commit fixed the remaining 3 (lines 908, 1545, 1834). Thanks for the thorough stability audit! |
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
Surgical fixes for 4 runtime bugs found during a stability audit of the tool orchestration layer. Each fix is minimal and isolated — no refactoring, no behavioral changes beyond the bug corrections.
Changes
A second close() definition at line 352 silently overrode the first one at line 238. The first (correct) implementation performs PRAGMA wal_checkpoint(PASSIVE) before closing, which flushes committed WAL frames back to the main database. The override skipped this entirely.
Impact: In long-running gateway/daemon sessions, the WAL file grows without bound as no exiting process ever checkpoints it. This degrades read performance and wastes disk over time.
Fix: Removed the duplicate method, preserving the WAL-checkpointing version.
In _process_large_content_chunked(), when both synthesis LLM calls return reasoning-only responses (empty text content), final_summary remains None. The subsequent len(final_summary) call crashes with TypeError.
Impact: Runtime crash during large web page extraction when the synthesis model produces reasoning-only output. The outer except catches it, but the useful partial summaries are lost.
Fix: Added explicit None guard after retry — falls back to concatenating chunk summaries directly.
The memory notification block referenced tasks (the raw input parameter) instead of task_list (the normalized list). In single-task mode (goal="...", tasks=None), this crashes with TypeError on None subscript. The crash is silently swallowed by except Exception: pass.
Impact: Delegation outcomes are never recorded in the memory provider during single-task delegations — the most common delegation path.
Fix: Changed tasks → task_list.
Four locations used Path(os.environ.get("HERMES_HOME", Path.home() / ".hermes")) instead of the canonical get_hermes_home() from hermes_constants. This is the exact pattern that AGENTS.md warns against.
Impact: When running with profiles (hermes -p coder), browser configuration (command timeout, cloud provider selection, private URL policy, node binary discovery) reads from the default ~/.hermes/ instead of the active profile's directory.
Fix: Replaced all 4 instances with get_hermes_home() and added the import.
Testing
All modified modules verified with import tests:
hermes_state.SessionDB ✅
tools.web_tools ✅
tools.delegate_tool ✅
tools.browser_tool ✅
run_agent.AIAgent ✅
📂 Files Changed Summary
hermes_state.pyclose()(-6 lines)tools/web_tools.pyNoneguard in synthesis fallback (+8 lines)tools/delegate_tool.pytasks→task_list(1 line)tools/browser_tool.pyget_hermes_home()in 4 locations (+1 import)