Skip to content

fix(bot-mode): canonical bot DMs always follow the profile's current config - #91062

Closed
curator8888 wants to merge 1 commit into
NousResearch:mainfrom
curator8888:fix/bot-dm-follows-profile-config
Closed

curator8888 wants to merge 1 commit into
NousResearch:mainfrom
curator8888:fix/bot-dm-follows-profile-config

Conversation

@curator8888

Copy link
Copy Markdown
Contributor

Fixes the mirror image of #89497: bot DMs stuck on a stale provider pin.

Summary

Bot-Mode canonical chats (the ONE forever DM per bot) and room plumbing sessions are plugin-owned scratch conversations. They are now created with an explicit follow_profile_config contract, persisted in the session row's model_config, so session.resume rebuilds from the member profile's CURRENT config instead of restoring the stored model/provider pin from an old row.

That stale pin is what left bot DMs stuck on a dead provider (e.g. "out of Nous credits" after the profile was switched to ollama-cloud) while the same bot worked fine in rooms — the mirror image of the room-plumbing bug (#89497 class). Normal 1:1 user chats keep the stored-runtime restore: opening an older chat must show the model it actually used.

How to Test

  1. Configure a bot profile with model A (e.g. a paid Nous model), open its Bot Chat DM, send a message.
  2. Switch the profile to model B (e.g. ollama-cloud/glm-5.1).
  3. Reopen the DM. Before this fix: resume restores the stored model A pin → "out of Nous credits" / HTTP 404. After: resume uses the profile's current model B.

Verification

  • Backend: _stored_session_runtime_overrides returns {} for rows carrying the marker (dict and JSON model_config shapes); unmarked rows still restore stored runtime; _ensure_session_db_row persists the marker only when the contract is set.
  • Desktop: createCanonicalChat and ensureGroupChatSession both send follow_profile_config: true on session.create.
  • Tests: 16/16 test_custom_provider_session_persistence.py, 24/24 with test_session_resume_db_ownership.py, 57/57 desktop group-chat tests.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally

…config

Bot-Mode canonical chats (the ONE forever DM per bot) and room plumbing
sessions are plugin-owned scratch conversations. They are now created with
an explicit follow_profile_config contract, persisted in the session row's
model_config, so session.resume rebuilds from the member profile's CURRENT
config instead of restoring the stored model/provider pin from an old row.

That stale pin is what left bot DMs stuck on a dead provider (e.g. 'out of
Nous credits' after the profile was switched to ollama-cloud) while the
same bot worked fine in rooms — the mirror image of the room-plumbing bug
(NousResearch#89497 class). Normal 1:1 user chats keep the stored-runtime restore:
opening an older chat must show the model it actually used.

- tui_gateway/methods_session.py: accept follow_profile_config on session.create
- tui_gateway/server.py: persist the marker in the row; skip stored-runtime
  overrides on resume when present
- apps/desktop/src/plugins/hermes-bots/plugin.js: send the contract from
  createCanonicalChat and ensureGroupChatSession
- tests: backend override + row-persist coverage; desktop source-contract
  coverage for both session kinds
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 20, 2026
@curator8888

Copy link
Copy Markdown
Contributor Author

Superseded by #90343 — the DM fix was rebased into the room-plumbing PR so both bot-session contracts (room_plumbing + follow_profile_config) land as one coherent change.

@curator8888
curator8888 deleted the fix/bot-dm-follows-profile-config branch August 20, 2026 20:24
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/*) comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have 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