fix(title): use lineage fallback for generated titles - #26471
Conversation
|
Likely duplicate of #26389 — both fix |
|
The main differences in this PR are:
|
teknium1
left a comment
There was a problem hiding this comment.
Thanks for covering the still-present duplicate-title path. Current main still calls set_session_title() directly in agent/title_generator.py:155 and swallows its ValueError at agent/title_generator.py:162-163, so the lineage fallback is needed.
Problems
- The added persistence calls do not inspect their return values (
agent/title_generator.py:123in this PR, and the fallback call immediately below it).SessionDB.set_session_title()returnsFalsewhen no session row was updated (hermes_state.py:2706-2753). In that case this PR would still calltitle_callbackwith a title that was not persisted, contrary to the callback guarantee described in the PR.
Suggested changes
- Require successful return values from both writes before logging success or invoking the callback, and add tests for
Falseon the initial and fallback writes.
Automated hermes-sweeper review.
| title_callback(title) | ||
| except Exception: | ||
| logger.debug("Auto-title callback failed", exc_info=True) | ||
| session_db.set_session_title(session_id, final_title) |
There was a problem hiding this comment.
set_session_title() returns False when the session no longer exists (hermes_state.py:2706-2753). Check that result here and on the fallback write before invoking title_callback; otherwise consumers receive a title that was never persisted.
|
Thanks for the contribution — you were the first to submit the collision-retry idea (May 15), five weeks ahead of the implementation that ultimately landed, and you're credited in the merged PR body for it. The fix landed via PR #66058, which salvaged #50575's version of the same retry: it generalizes the dedup to a Closing as superseded — first-submitter credit is yours. |
Summary
SessionDB.get_next_title_in_lineage()when an auto-generated session title collides with an existing title.title_callback, so listeners receive the persisted title rather than the rejected duplicate.Test Plan
python -m pytest tests/agent/test_title_generator.py -qpython -m py_compile agent/title_generator.pyPlatforms Tested
Related / competing PRs
get_next_title_in_lineage,lineage fallback,generated titles, and title-generator uniqueness/conflict terms.Notes/Risks
/titleconflicts still surface through the existingset_session_title()behavior.