fix: persist API server sessions to shared SessionDB#4802
Merged
Conversation
The API server adapter created AIAgent instances without passing session_db, so conversations via Open WebUI and other OpenAI-compatible frontends were never persisted to state.db. This meant 'hermes sessions list' showed no API server sessions — they were effectively stateless. Changes: - Add _ensure_session_db() helper for lazy SessionDB initialization - Pass session_db=self._ensure_session_db() in _create_agent() - Refactor existing X-Hermes-Session-Id handler to use the shared helper Sessions now persist with source='api_server' and are visible alongside CLI and gateway sessions in hermes sessions list/search.
jooray
added a commit
to jooray/hermes-agent
that referenced
this pull request
Apr 3, 2026
* upstream/main: (38 commits) fix(memory): Fix ByteRover plugin - run brv query synchronously before LLM call chore: release v0.7.0 (2026.4.3) (NousResearch#4812) fix: route memory provider tools in sequential execution path (NousResearch#4803) fix: persist API server sessions to shared SessionDB (state.db) (NousResearch#4802) fix(discord): register /approve and /deny slash commands, wire up button-based approval UI (NousResearch#4800) fix: respect per-platform disabled skills in Telegram menu and gateway dispatch (NousResearch#4799) fix(gateway): route /approve and /deny through running-agent guard (NousResearch#4798) docs: add community FAQ entries — multi-model workflows, WhatsApp binding, verbose control, skills config, thread sessions, migration, install troubleshooting (NousResearch#4797) fix: handle None mcp_servers in _get_platform_tools() fix(mcp): stability fix pack — reload timeout, shutdown cleanup, event loop handler, OAuth non-blocking (NousResearch#4757) fix: prevent compression death spiral from API disconnects (NousResearch#2153) (NousResearch#4750) fix: handle Anthropic Sonnet long-context tier 429 by reducing to 200k (NousResearch#4747) fix: correct qwen3.6-plus model slug fix: handle Anthropic long-context tier 429 by reducing to 200k docs(acp): fix zed config fix: use get_hermes_home(), consolidate git_cmd, update tests Add fork detection and upstream sync to hermes update fix(update): handle conflicted git index during hermes update (NousResearch#4735) fix: remove redundant restart message from update launchd path fix(update): avoid launchd restart race on macOS ...
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…Research#4802) The API server adapter created AIAgent instances without passing session_db, so conversations via Open WebUI and other OpenAI-compatible frontends were never persisted to state.db. This meant 'hermes sessions list' showed no API server sessions — they were effectively stateless. Changes: - Add _ensure_session_db() helper for lazy SessionDB initialization - Pass session_db=self._ensure_session_db() in _create_agent() - Refactor existing X-Hermes-Session-Id handler to use the shared helper Sessions now persist with source='api_server' and are visible alongside CLI and gateway sessions in hermes sessions list/search.
1 task
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…Research#4802) The API server adapter created AIAgent instances without passing session_db, so conversations via Open WebUI and other OpenAI-compatible frontends were never persisted to state.db. This meant 'hermes sessions list' showed no API server sessions — they were effectively stateless. Changes: - Add _ensure_session_db() helper for lazy SessionDB initialization - Pass session_db=self._ensure_session_db() in _create_agent() - Refactor existing X-Hermes-Session-Id handler to use the shared helper Sessions now persist with source='api_server' and are visible alongside CLI and gateway sessions in hermes sessions list/search.
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
…Research#4802) The API server adapter created AIAgent instances without passing session_db, so conversations via Open WebUI and other OpenAI-compatible frontends were never persisted to state.db. This meant 'hermes sessions list' showed no API server sessions — they were effectively stateless. Changes: - Add _ensure_session_db() helper for lazy SessionDB initialization - Pass session_db=self._ensure_session_db() in _create_agent() - Refactor existing X-Hermes-Session-Id handler to use the shared helper Sessions now persist with source='api_server' and are visible alongside CLI and gateway sessions in hermes sessions list/search.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…Research#4802) The API server adapter created AIAgent instances without passing session_db, so conversations via Open WebUI and other OpenAI-compatible frontends were never persisted to state.db. This meant 'hermes sessions list' showed no API server sessions — they were effectively stateless. Changes: - Add _ensure_session_db() helper for lazy SessionDB initialization - Pass session_db=self._ensure_session_db() in _create_agent() - Refactor existing X-Hermes-Session-Id handler to use the shared helper Sessions now persist with source='api_server' and are visible alongside CLI and gateway sessions in hermes sessions list/search.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…Research#4802) The API server adapter created AIAgent instances without passing session_db, so conversations via Open WebUI and other OpenAI-compatible frontends were never persisted to state.db. This meant 'hermes sessions list' showed no API server sessions — they were effectively stateless. Changes: - Add _ensure_session_db() helper for lazy SessionDB initialization - Pass session_db=self._ensure_session_db() in _create_agent() - Refactor existing X-Hermes-Session-Id handler to use the shared helper Sessions now persist with source='api_server' and are visible alongside CLI and gateway sessions in hermes sessions list/search.
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
The API server adapter (
gateway/platforms/api_server.py) createdAIAgentinstances without passingsession_db, so conversations via Open WebUI and other OpenAI-compatible frontends were never persisted tostate.db. This meanthermes sessions listshowed no API server sessions — they were effectively stateless from Hermes's perspective.Reported by angelitusss in community chat.
Changes
_ensure_session_db()helper method for lazySessionDBinitialization (same pattern asgateway/run.py)session_db=self._ensure_session_db()in_create_agent()so every agent created by the API server persists tostate.dbX-Hermes-Session-Idhandler to use the shared helper instead of its own inline initResult
Sessions now persist with
source='api_server'and are visible alongside CLI and gateway sessions inhermes sessions list/hermes sessions search.Tests
state.dbsession_dbparametersource='api_server'list_sessions_rich()with source filtering