fix(title): atomic auto-title writes + collision dedup for sessions and cron (salvage #51483 + #50575) - #66058
Merged
Merged
Conversation
tonydwb
reviewed
Jul 17, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment
Scope: New skill addition or minor change
Notes
- Skill/content addition or minor fix.
- No security concerns, no debug artifacts.
- LGTM.
Reviewed by Hermes Agent
…etry Combines the two salvaged fixes so they compose instead of conflict: _persist_session_title (#50575) now writes through set_auto_title_if_empty (#51483) when the store provides it — the collision-dedup retry and the manual-/title race protection apply together. Predicate failure (a manual title landed while generation was in flight) returns None: nothing written, no callback. Legacy stores without the atomic method keep the plain set_session_title path, including the vanished-session RuntimeError. Tests cover both store shapes plus the race-skip path; E2E verified against a real SQLite SessionDB (collision -> 'Weekly Report #2', manual title preserved, cron dedup, blank guard). AUTHOR_MAP entry for rasitakyol.
teknium1
force-pushed
the
salvage/51483-50575-title-writes
branch
from
July 17, 2026 05:26
e676568 to
453c211
Compare
This was referenced Jul 17, 2026
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
Session-title writes are now atomic and collision-safe: a manual
/titlecan no longer be overwritten by an in-flight auto-title, and a duplicate generated title retries with a#Nsuffix instead of leaving the session silently untitled. Cron sessions get the same hardening plus a non-blank guarantee.Salvages two complementary contributor fixes, cherry-picked with authorship preserved:
SessionDB.set_auto_title_if_empty(): predicate + write in one transaction, closing the TOCTOU window where auto-title stomped a manual title set while LLM generation was in flight._persist_session_title()collision-dedup retry (ValueError → lineage#Nsuffix) for all auto-titled sessions, and_set_cron_session_title()in the scheduler (dedup + non-blank, still deterministic and pre-close). Fixes fix(cron): cron sessions have blank titles when title generation fails #50535/fix(cron): race condition between title generation and session close in cron jobs #50536/fix(title): duplicate auto-generated session titles cause unhandled ValueError #50537.Follow-up commit (ours) reconciles them: the retry helper writes through the atomic method when the store provides it, so both protections compose; legacy stores fall back to
set_session_titleunchanged. Predicate failure (manual title won the race) returns None — nothing written, no callback fired.Changes
hermes_state.py:set_auto_title_if_empty()+_set_session_title(only_if_empty=...)refactor (@rasitakyol)agent/title_generator.py:_persist_session_title()dedup retry (@trevorgordon981), routed through the atomic write (ours)cron/scheduler.py:_set_cron_session_title()helper replacing the blanket-except title write (@trevorgordon981)Validation
/titleduring in-flight generationWeekly Report #2(real-DB E2E)nightly-job · Jul 16 12:00 #2(real-DB E2E)Closes #50535, #50536, #50537. Competing PRs #26389, #50538, #14813, #23121 will be closed with credit after merge.
Infographic