Skip to content

fix(title): atomic auto-title writes + collision dedup for sessions and cron (salvage #51483 + #50575) - #66058

Merged
teknium1 merged 4 commits into
mainfrom
salvage/51483-50575-title-writes
Jul 17, 2026
Merged

fix(title): atomic auto-title writes + collision dedup for sessions and cron (salvage #51483 + #50575)#66058
teknium1 merged 4 commits into
mainfrom
salvage/51483-50575-title-writes

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Session-title writes are now atomic and collision-safe: a manual /title can no longer be overwritten by an in-flight auto-title, and a duplicate generated title retries with a #N suffix 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:

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_title unchanged. 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)
  • Tests: race regression on a real DB, collision dedup for both store shapes, cron dedup/blank guards — 628 pass across the three affected suites

Validation

Scenario Before After
/title during in-flight generation manual title overwritten preserved (atomic predicate, real-DB E2E)
Generated title collides with unique index debug-logged, session untitled forever persisted as Weekly Report #2 (real-DB E2E)
Cron job runs twice in one minute second session untitled 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

title-writes-hardening

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 17, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

rasitakyol and others added 4 commits July 16, 2026 22:25
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cron): cron sessions have blank titles when title generation fails

5 participants