Skip to content

fix(desktop): Bot Mode chats no longer paint blank when switching between running bots - #89902

Merged
teknium1 merged 3 commits into
mainfrom
fix/botmode-active-profile-resolve
Aug 19, 2026
Merged

fix(desktop): Bot Mode chats no longer paint blank when switching between running bots#89902
teknium1 merged 3 commits into
mainfrom
fix/botmode-active-profile-resolve

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Bot Mode chats no longer paint a blank thread when switching focus between bots — the session resolver now probes the ACTIVE profile, which was the one profile it never checked.

Reported by @tbkbossswaglord on X: with 3 bots running, focusing another bot left the middle pane empty; the only workaround was right-click → Sessions → reopen (and only when the bot had multiple sessions).

Root cause: resolveStoredSession's by-id ladder assumed the unscoped /api/sessions/{id} GET covered the active profile, but Electron routes profile-less REST to the PRIMARY backend — so a session owned by the active non-primary profile 404s there, and the cross-profile probe loop explicitly skipped the active key. Hidden Bot Mode canonical chats are never in the sidebar cache, so every focus switch resolved to undefined, the transcript prefetch went unscoped to the primary backend, 404'd, and the thread painted empty. Opening via right-click → Sessions seeded the cache with a profile-stamped row, which is exactly why the reporter's workaround worked.

Changes

  • apps/desktop/src/app/session/hooks/use-session-actions/utils.ts: probe the active profile first in the by-id resolution ladder instead of skipping it.
  • apps/desktop/src/app/session/hooks/use-session-actions/resolve-stored-session.test.ts: regression test for the hidden-Bot-Mode-chat shape (unscoped 404 → active-profile probe resolves ownership); existing probe-order tests updated for the new sequence.

Validation

Before After
Live CDP repro (3 bots, focus-switch mid-turn) blank thread, "Waking up …" latched, prefetch 404 on primary full transcript paints on every switch
resolve-stored-session tests 9 passed 10 passed (new regression test red on old code)
use-prompt-actions utils tests 54 passed 54 passed

Repro was fully headless: built desktop from this branch, seeded 3 bot profiles in a scratch HERMES_HOME, drove real clicks + prompts over CDP, and diffed the painted DOM against each profile's state.db. Console tracing pinned the exact drop point (resolved profile: undefined → unscoped prefetch) before the fix; after the fix the trace shows probe hit on <bot> and the transcript paints.

Infographic

Infographic generation unavailable this session (FAL balance exhausted — image_generate returned "User is locked. Exhausted balance."). Will attach on regeneration.

…ween running bots

resolveStoredSession never probed the ACTIVE profile: the unscoped
/api/sessions GET routes to the PRIMARY backend (not the active
gateway's), and the cross-profile probe loop explicitly skipped the
active key. A hidden Bot Mode canonical chat — never present in the
sidebar cache — owned by the focused bot therefore resolved to
undefined on every switch. The transcript prefetch then went unscoped
to the primary backend, 404'd, and the thread painted empty until the
user opened the session explicitly via right-click → Sessions (which
seeds the cache with a profile-stamped row).

Probe the active profile first in the by-id ladder, so hidden and
uncached sessions on the focused profile resolve with ownership and the
prefetch routes to the owning backend.

Live-repro'd headless via CDP with 3 bot profiles mid-turn: before the
fix every focus-switch painted a blank thread ('Waking up <bot>…');
after, the full transcript paints. Reported by @tbkbossswaglord.
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on afcf4ba — chore: retrigger CI (zero-job dispatch failure, auto-heal)

⚠️ Warnings

OSV vulnerability scan · View job

7 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m34s vs 5m52s (-39.2%). 6 job(s) slower, 13 faster,

  • JS & TS checks / apps/desktop / check:test:desktop:platforms: -52.0s
  • JS & TS checks / ui-tui / check: -50.0s
  • JS & TS checks / apps/shared / check: -49.0s
  • Check no committed infographics / check-no-committed-infographics: +48.0s
  • Detect affected areas: -46.0s

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 19, 2026
@teknium1
teknium1 merged commit 1a19fed into main Aug 19, 2026
45 checks passed
@teknium1
teknium1 deleted the fix/botmode-active-profile-resolve branch August 19, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) 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