Skip to content

fix(bot-mode): canonical-chat adoption no longer misses a buried forever-chat (exact-title lookup, follow-up to #90732) - #90751

Merged
teknium1 merged 1 commit into
mainfrom
fix/bot-chat-exact-title-lookup
Aug 20, 2026
Merged

fix(bot-mode): canonical-chat adoption no longer misses a buried forever-chat (exact-title lookup, follow-up to #90732)#90751
teknium1 merged 1 commit into
mainfrom
fix/bot-chat-exact-title-lookup

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

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.list gains a title param — indexed WHERE 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), mirroring profiles.list's preferred_session resolver.
  • apps/desktop/src/plugins/hermes-bots/plugin.js: findExistingCanonicalChat sends title: 'Bot Chat'. Adoption now opens the lineage tip (resolved_id) while pinning the durable row id — same split the preferred_session path uses.
  • Compatibility: older gateways ignore the unknown title param and return the plain windowed listing; the plugin's local isCanonicalBotChatHistory scan 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

Result
Live repro on real state.db hidden "Bot Chat" buried under 250 newer sessions: 200-row window misses it, exact lookup finds it (hidden=1, tip resolved, not denied)
Existing plugin suites (adopt-before-mint + hide-bot-chats) 12/12 pass
ruff (methods_session.py) clean
plugin.js module parse clean

…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.
@teknium1
teknium1 merged commit 21e9d45 into main Aug 20, 2026
2 checks passed
@teknium1
teknium1 deleted the fix/bot-chat-exact-title-lookup branch August 20, 2026 10:49
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) comp/tui Terminal UI (ui-tui/ + tui_gateway/) area/sessions Session lifecycle, resume, persistence, history sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions Session lifecycle, resume, persistence, history comp/desktop Electron desktop app (apps/desktop/*) comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists 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.

2 participants