Skip to content

fix(api_server): persist ResponseStore to SQLite across restarts#2472

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-baa39faf
Mar 22, 2026
Merged

fix(api_server): persist ResponseStore to SQLite across restarts#2472
teknium1 merged 1 commit intomainfrom
hermes/hermes-baa39faf

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

The /v1/responses endpoint used an in-memory OrderedDict that lost all conversation state on gateway restart. Users on platforms with hibernating VMs or frequent restarts lost multi-turn context entirely.

Fix: Replace the in-memory store with SQLite at ~/.hermes/response_store.db.

What changed

  • ResponseStore now backed by SQLite with WAL mode
  • Responses and conversation name mappings survive gateway restarts
  • Same LRU eviction behavior (configurable max_size, default 100)
  • Falls back to in-memory SQLite if disk path is unavailable
  • Conversation name→response_id mapping moved into the store (was a separate dict)
  • 3 tests updated to use new store API

Why not a new endpoint

PR #2437 proposed adding a separate /v1/message endpoint to solve this. Making the existing endpoint persistent is simpler and avoids API surface sprawl.

Test plan

  • API server tests pass (82 passed)
The /v1/responses endpoint used an in-memory OrderedDict that lost
all conversation state on gateway restart. Replace with SQLite-backed
storage at ~/.hermes/response_store.db.

- Responses and conversation name mappings survive restarts
- Same LRU eviction behavior (configurable max_size)
- WAL mode for concurrent read performance
- Falls back to in-memory SQLite if disk path unavailable
- Conversation name→response_id mapping moved into the store
@teknium1 teknium1 merged commit 8d528e0 into main Mar 22, 2026
1 check failed
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
…sResearch#2472)

The /v1/responses endpoint used an in-memory OrderedDict that lost
all conversation state on gateway restart. Replace with SQLite-backed
storage at ~/.hermes/response_store.db.

- Responses and conversation name mappings survive restarts
- Same LRU eviction behavior (configurable max_size)
- WAL mode for concurrent read performance
- Falls back to in-memory SQLite if disk path unavailable
- Conversation name→response_id mapping moved into the store
aashizpoudel pushed a commit to aashizpoudel/hermes-agent that referenced this pull request Mar 30, 2026
…sResearch#2472)

The /v1/responses endpoint used an in-memory OrderedDict that lost
all conversation state on gateway restart. Replace with SQLite-backed
storage at ~/.hermes/response_store.db.

- Responses and conversation name mappings survive restarts
- Same LRU eviction behavior (configurable max_size)
- WAL mode for concurrent read performance
- Falls back to in-memory SQLite if disk path unavailable
- Conversation name→response_id mapping moved into the store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant