uwf-hermes: loadHermesSession fails when sessions.write_json_snapshots is disabled (default) #535

Closed
opened 2026-05-26 14:08:16 +00:00 by xiaoju · 0 comments
Owner

Problem

uwf-hermes agent fails with Hermes session file not found: <uuid> after completing an ACP session.

Root Cause

loadHermesSession() in packages/workflow-agent-hermes/src/session-detail.ts only reads from JSON files at ~/.hermes/sessions/session_{uuid}.json. But Hermes defaults sessions.write_json_snapshots to false — the canonical store is state.db (SQLite), and JSON files are opt-in.

ACP sessions use UUID session IDs (e.g. d945bbda-...), which are stored in state.db but no JSON file is written unless the config flag is explicitly enabled.

Expected Behavior

loadHermesSession() should fall back to reading from ~/.hermes/state.db when the JSON file doesn't exist.

Fix

  1. Try JSON file first (fast path for users with write_json_snapshots: true)
  2. Fall back to state.db: query sessions table for model/started_at, messages table for conversation history
  3. DB schema: sessions.id = UUID, sessions.model, sessions.started_at (unix timestamp); messages.session_id, messages.role, messages.content, messages.reasoning, messages.tool_calls (JSON string)
  4. Use bun:sqlite with { readonly: true }

Workaround

Set sessions.write_json_snapshots: true in ~/.hermes/config.yaml.

Ref

Discovered during E2E walkthrough dogfooding (thread 06F693Z9E6N9JBSG54QXWR5EFW).

## Problem `uwf-hermes` agent fails with `Hermes session file not found: <uuid>` after completing an ACP session. ### Root Cause `loadHermesSession()` in `packages/workflow-agent-hermes/src/session-detail.ts` only reads from JSON files at `~/.hermes/sessions/session_{uuid}.json`. But Hermes defaults `sessions.write_json_snapshots` to `false` — the canonical store is `state.db` (SQLite), and JSON files are opt-in. ACP sessions use UUID session IDs (e.g. `d945bbda-...`), which are stored in `state.db` but no JSON file is written unless the config flag is explicitly enabled. ### Expected Behavior `loadHermesSession()` should fall back to reading from `~/.hermes/state.db` when the JSON file doesn't exist. ### Fix 1. Try JSON file first (fast path for users with `write_json_snapshots: true`) 2. Fall back to `state.db`: query `sessions` table for model/started_at, `messages` table for conversation history 3. DB schema: `sessions.id` = UUID, `sessions.model`, `sessions.started_at` (unix timestamp); `messages.session_id`, `messages.role`, `messages.content`, `messages.reasoning`, `messages.tool_calls` (JSON string) 4. Use `bun:sqlite` with `{ readonly: true }` ### Workaround Set `sessions.write_json_snapshots: true` in `~/.hermes/config.yaml`. ### Ref Discovered during E2E walkthrough dogfooding (thread `06F693Z9E6N9JBSG54QXWR5EFW`).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#535