fix(bot-mode): prevent ordinary sessions from being hidden - #89901
fix(bot-mode): prevent ordinary sessions from being hidden#89901Owen-narcissus wants to merge 1 commit into
Conversation
f24ee17 to
b00e37b
Compare
Production-verified repro of this exact bug classI hit this in production on 2026-08-19 and forensically traced it before writing this comment — sharing the evidence trail since it independently confirms your diagnosis and should help priority. Symptom: an ordinary 112-message conversation (title and session id withheld for privacy) vanished from the Desktop session listing. State: Forensic chain (each step a hard artifact):
Your diagnosis — "adoption based only on recency, sweep trusts the pointer" — matches the artifact record exactly, including the grandfather path being the adoption vector. Two gaps your patch does not close (offering companion work, not scope creep)1. No recovery affordance for sessions already hidden. This PR prevents new wrongful hides; the ones already hidden stay hidden forever — there is no CLI, UI or documented path back out of the flag (raw SQL on state.db is currently the only recovery, which is how I restored mine). I opened the companion recovery PR #90388 ( 2. Old-backend edge in the sweep gate (worth a line). Repro evidence and the full forensic record are available if useful for the PR description. |
Second production instance (2026-08-19) + one extra persistence detailIndependent confirmation from my environment — same day, same mechanism, same recovery path. Sharing because it adds one persistence detail not covered above. Symptom: an ordinary 80-message conversation (调度会/meeting-optimization project) vanished from the Desktop sidebar on 2026-08-19. Forensic chain (all hard artifacts, matched yours 1:1):
Extra detail you did not list — the server-side cleanup trap: clearing the server pointer does NOT stop the re-hide. I first wiped That two-location persistence (profile.yaml + localStorage, with an asymmetric merge) is worth a line in the PR or the companion recovery work: a recovery tool that only clears the server pointer will look like it failed. Consider having the sweep or a recovery helper also reconcile the local Happy to paste the exact SQL/repro steps if useful. |
|
Salvaged into #90358 (merged as 8408edc) with your commit and authorship preserved — thank you @Owen-narcissus! Your fail-closed verify-before-hide design landed intact; we added root_title so compression-rotated Bot Chats ("Bot Chat (continued)") still verify, plus contract tests. Closing this PR in favor of the salvage. |
Summary
Fix a Bot Mode session-ownership bug that can hide ordinary desktop conversations from the global Sessions sidebar.
Problem
When a Bot profile had no canonical
Bot Chatpointer, Bot Mode adopted the profile's latest session based only on recency. If that latest session was an ordinary user conversation, its ID was persisted ashermes-bots.chat. The startup reconciliation sweep then treated the ID as Bot Mode-owned and sethidden=true.This caused unrelated project conversations to disappear from the desktop session list while remaining present in
state.db.Changes
Bot Chat.root_titlein the preciseprofiles.listpreferred-session summary so compressed canonical chats remain valid even when the live tip is titledBot Chat (continued)or otherwise differs from the root.profiles.listbefore issuingsession.set_hidden.Verification
npm run check:test:plugins— 312/312 tests passed.npm run packcompleted successfully for macOS arm64 before the root-title compatibility refinement.Scope
This change does not alter the intended behavior for actual Bot Mode plumbing sessions (
Bot Chat,Agent Inbox, andGroup: ...). It does not include unrelated working-tree files.