Skip to content

fix: resolve critical runtime stability issues across core, web, delegate, and browser tools#4828

Closed
Dusk1e wants to merge 1 commit into
NousResearch:mainfrom
Dusk1e:fix/runtime-stability-multi-patch
Closed

fix: resolve critical runtime stability issues across core, web, delegate, and browser tools#4828
Dusk1e wants to merge 1 commit into
NousResearch:mainfrom
Dusk1e:fix/runtime-stability-multi-patch

Conversation

@Dusk1e

@Dusk1e Dusk1e commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

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

  1. Fix unbounded WAL file growth on SessionDB.close() (hermes_state.py)
    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.

  1. Fix TypeError crash in chunked web content synthesis (tools/web_tools.py)
    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.

  1. Fix silent memory loss in single-task delegation (tools/delegate_tool.py)
    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.

  1. Fix profile isolation in browser tool config (tools/browser_tool.py)
    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

File Change
hermes_state.py Remove duplicate close() (-6 lines)
tools/web_tools.py Add None guard in synthesis fallback (+8 lines)
tools/delegate_tool.py Fix variable reference taskstask_list (1 line)
tools/browser_tool.py Use get_hermes_home() in 4 locations (+1 import)

@teknium1

teknium1 commented Apr 3, 2026

Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants