Release: sync session titles to state.db (#6892) - #6960
Merged
Merged
Conversation
… WebUI titles Background title generation (`_run_background_title_update` and `_run_background_title_refresh`) writes the title to the WebUI sidecar JSON but never syncs it back to hermes-agent's `state.db`. This causes `hermes sessions list` to show blank titles for all WebUI-originated sessions. The existing `sync_session_usage` path is gated by the `sync_to_insights` setting (default: off) and executes before the background title thread completes, so it cannot cover this case. Fix: add `sync_session_title()` to `state_sync.py` — an unconditional (not gated by `sync_to_insights`) title-only sync — and call it from both title generation paths immediately after persisting the title to the sidecar.
Neutralize the new `sync_session_title` call in `test_cleared_title_allows_initial_auto_generation` to prevent state.db side effects from leaking into shared test state, matching the existing pattern of mocking collaborators in this test.
Address gate-review blockers from nesquena-hermes: 1. Wrong title-authority API: replace `db.set_session_title()` with `db.set_auto_title_if_empty()` so auto-generated titles never overwrite a manual rename (set_session_title writes with 'user' authority; set_auto_title_if_empty only populates NULL titles). 2. Null profile fallback: pass `or 'default'` at both streaming.py call sites so background title workers (which lack request TLS) always resolve to the correct state.db instead of falling through to the process-global active profile.
… tests Codex round-1 SHOULD-FIX: the PR's only test change mocked the new write to a no-op. Add real-SessionDB tests proving generated-title persistence, manual-rename no-overwrite, and cli/gateway source preservation on ensure_session. Additive test-only; no behavior change to the contributor's fix. Co-authored-by: liuguangyong93 <liuguangyong93@users.noreply.github.com>
Contributor
|
| Filename | Overview |
|---|---|
| api/state_sync.py | Adds an idempotent, fail-soft title synchronization helper that preserves existing title provenance and session source. |
| api/streaming.py | Calls the new synchronization helper after successful initial title generation and adaptive refresh using the session profile. |
| tests/test_issue6892_sync_title_coverage.py | Exercises the real SessionDB contract for generated-title persistence, manual-title protection, and existing-source preservation. |
| tests/test_3230_preserve_manual_session_title.py | Isolates the existing manual-title test from the newly introduced state.db side effect. |
| CHANGELOG.md | Adds the release note describing title synchronization and provenance-preserving behavior. |
Sequence Diagram
sequenceDiagram
participant Worker as Background title worker
participant Sidecar as WebUI session
participant Sync as sync_session_title
participant DB as hermes-agent state.db
participant CLI as hermes sessions list
Worker->>Sidecar: Save generated title
Worker->>Sync: session_id, title, profile
Sync->>DB: "ensure_session(source="webui")"
Sync->>DB: set_auto_title_if_empty(title)
Note over DB: Existing user or LLM title remains unchanged
CLI->>DB: Read session titles
DB-->>CLI: Generated title
Reviews (1): Last reviewed commit: "docs(changelog): stamp #6892 + add direc..." | Re-trigger Greptile
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.
Release stage for #6892 — sync auto-generated session titles to hermes-agent
state.db.Original PR: #6892 by @liuguangyong93 (Co-authored on the stage branch).
What
Background title generation wrote the auto-title only to the WebUI session sidecar, not to hermes-agent's
state.db, sohermes sessions listshowed blank titles for WebUI sessions. This bridges the title intostate.dbafter generation and on adaptive refresh.Gate (full current gate)
cli/gatewaysource preservation (INSERT-OR-IGNORE, conflict path never updates source), manual-rename no-overwrite (provenance rank:user>llm), refresh no-op, and two-thread concurrency safety.tests/test_issue6892_sync_title_coverage.py— three real-SessionDB tests proving generated-title persistence, manual-rename no-overwrite, and source preservation. Additive test-only, no behavior change to the fix.Follow-up (not blocking — pre-existing behavior, Codex SHOULD-FIX #2)
If two sessions generate the same title,
state.db's uniqueness rule leaves the second blank. This predates this PR (not a release regression). A follow-up should catchValueErrorand retry viaget_next_title_in_lineage. Filing separately.Backend reliability fix — no visible UI change, so no screenshot gate needed.
Closes #6892.