fix(bot-mode): canonical-chat adoption no longer misses a buried forever-chat (exact-title lookup, follow-up to #90732) - #90751
Merged
Conversation
…ct-title lookup The #90732 adoption scan used session.list's 200-row recency window. A busy bot profile (group-chat traffic, routines, or accumulated fork spam) pushes an older forever-chat past row 200, the scan misses it, and the mint path re-enters the unique-title-conflict fork loop — same pathology, higher trigger threshold. Profile → Named Session is an exact registry (UNIQUE title index), so consult it exactly: - session.list gains a `title` param: indexed WHERE title = ? lookup, window-free, hidden rows resolve, archived/deny-listed do not, compression lineages resolve to the live tip (resolved_id), mirroring profiles.list's preferred_session resolver. - findExistingCanonicalChat sends title: 'Bot Chat'. Older gateways ignore the unknown param and return the windowed listing — the local scan stays as the compatibility rung. - Adoption opens the lineage tip (resolved_id) while pinning the durable id, same split as the preferred_session path.
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
The #90732 adoption scan isn't the exact registry lookup its design promised — it scans
session.list's 200-row recency window. A busy bot profile (group-chat traffic, routines, or the accumulated fork spam from the original bug — #90524 alone had 50 hidden intros) pushes an older forever-chat past row 200, the scan misses it, and the mint path re-enters the unique-title-conflict fork loop. Same pathology, higher trigger threshold.Profile → Named Session is an exact one-to-one registry (core UNIQUE title index). This PR makes the lookup consult it exactly, end to end.
Changes
tui_gateway/methods_session.py:session.listgains atitleparam — indexedWHERE title = ?lookup, window-free. Hidden rows resolve (canonical chats are born hidden); archived rows and deny-listed sources (tool/kanban) do not; compression lineages resolve to the live tip (resolved_id), mirroringprofiles.list'spreferred_sessionresolver.apps/desktop/src/plugins/hermes-bots/plugin.js:findExistingCanonicalChatsendstitle: 'Bot Chat'. Adoption now opens the lineage tip (resolved_id) while pinning the durable row id — same split thepreferred_sessionpath uses.titleparam and return the plain windowed listing; the plugin's localisCanonicalBotChatHistoryscan of the response stays as the fallback rung, so behavior on old backends is exactly fix(bot-mode): kill the canonical-chat infinite-fork loop; drop the per-bot Sessions browser #90732's.Validation