New request
#3225: WebUI session rename doesn't write through to agent state.db title (TUI shows stale name)
We'll provision a sandbox, run an agent against the issue, and open a draft PR. You can pull the branch and iterate from there.
Summary
Renaming a session in the WebUI updates only the WebUI's own session store. It does not write the new title through to the agent's state.db, so the title the TUI / hermes CLI shows (set via /title) stays stale. Users who switch between the WebUI and the TUI on the same machine see two different names for the same conversation.
Reported by the OP (u/johnfkngzoidberg) in the r/hermesagent "Best webUI for Hermes?" thread (2026-05-30):
Renaming the chat session doesn't actually rename it in Hermes (/title), so switching from WebUI to TUI is kinda clunky, but that's probably splitting hairs.
Root cause (verified in code)
/api/session/rename writes the WebUI JSON store and nothing else:
# api/routes.py ~L5660
if parsed.path == "/api/session/rename":
require(body, "session_id", "title")
s = get_session(body["session_id"])
s = _ensure_full_session_before_mutation(body["session_id"], s)
with _get_session_agent_lock(body["session_id"]):
s.title = str(body["title"]).strip()[:80] or "Untitled"
s.save() # ← WebUI JSON only
publish_session_list_changed("session_rename")
return j(handler, {"session": s.compact()})
The only path that pushes a title into state.db is sync_session_usage(..., title=...) → db.set_session_title() (api/state_sync.py L164-169), and it fires only:
- after a streaming turn completes (
api/routes.py~L10001,api/streaming.py~L5933), and - when the
sync_to_insightssetting is enabled.
So a rename with no subsequent turn never reaches state.db. Even with sync on, the new title only lands lazily on the next turn (which re-pushes s.title); a renamed-then-idle session stays out of sync indefinitely.
Proposed fix
In the /api/session/rename handler, after s.save(), also push the title to state.db when insights sync is enabled — mirroring the existing post-turn call:
if load_settings().get("sync_to_insights"):
from api.state_sync import sync_session_usage
sync_session_usage(
session_id=s.session_id,
title=s.title,
profile=getattr(s, "profile", None), # #2762 parity
)
(Or a narrower set_session_title-only helper to avoid touching token counts.) The profile= kwarg must be passed for #2762 profile-isolation parity.
Notes
- WebUI-native sessions and agent/CLI sessions are deliberately separate stores; this is specifically about the write-through for bridged sessions when
sync_to_insightsis on. - Related to #3013 ("Session 名称修改功能不可用" — vague "rename doesn't work",
needinfo). This issue is the precise, code-confirmed cross-surface sync gap; #3013 may be a different/symptomatic report.
Labels / scope
bug- Small, well-scoped fix (one handler + a regression test).
Source: Reddit r/hermesagent thread "Best webUI for Hermes?" — captured during feedback triage. Filed by maintainer.
Fixes stale TUI/CLI session titles by extending the WebUI rename endpoint to propagate through to the agent state database.
- api/routes.py
- api/state_sync.py
- api/sessions.py
- static/sessions.js