docs: clarify that restarting the bot does not recreate the brain#14
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b860b8c24
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1091,6 +1091,12 @@ TZ=Europe/Moscow | |||
|
|
|||
| Опционально: `CLAUDE_MODEL=sonnet` — переключить сессию на Sonnet, если упираетесь в недельные лимиты подписки; `CRON_ENABLED=false` — выключить планировщик напоминаний. | |||
|
|
|||
| > **Важно: `dbrain restart` ≠ пересоздание мозга.** Перезапуск перезапускает только Python-процесс бота; долгоживущая сессия Claude Code в tmux при этом **сознательно выживает** (`KillMode=process`) — именно она держит вас на подписке, а не на платных токенах. Поэтому настройки, которые читаются только при СОЗДАНИИ сессии — `CLAUDE_MODEL`, `mcp-config.json`, системный промпт — после простого `dbrain restart` НЕ применятся. Чтобы они вступили в силу, пересоздайте мозг: | |||
| > ```bash | |||
| > tmux kill-session -t "$(cat ~/.dbrain/brain.name)" # бот поднимет новую сессию при следующем сообщении | |||
There was a problem hiding this comment.
In installations with CRON_ENABLED left at its default, scheduled jobs run through a second persistent Claude session named ${brain}_cron (get_cron_session builds it with the same model/MCP/system prompt settings). This one-liner only kills the main tmux session, so after following the documented recreation step, reminders/cron jobs can still run with the old CLAUDE_MODEL, mcp-config.json, or prompt until the cron session is killed as well.
Useful? React with 👍 / 👎.
| @@ -1091,6 +1091,12 @@ TZ=Europe/Moscow | |||
|
|
|||
| Опционально: `CLAUDE_MODEL=sonnet` — переключить сессию на Sonnet, если упираетесь в недельные лимиты подписки; `CRON_ENABLED=false` — выключить планировщик напоминаний. | |||
|
|
|||
| > **Важно: `dbrain restart` ≠ пересоздание мозга.** Перезапуск перезапускает только Python-процесс бота; долгоживущая сессия Claude Code в tmux при этом **сознательно выживает** (`KillMode=process`) — именно она держит вас на подписке, а не на платных токенах. Поэтому настройки, которые читаются только при СОЗДАНИИ сессии — `CLAUDE_MODEL`, `mcp-config.json`, системный промпт — после простого `dbrain restart` НЕ применятся. Чтобы они вступили в силу, пересоздайте мозг: | |||
There was a problem hiding this comment.
Remove the contradictory MCP restart instruction
This clarification says mcp-config.json changes do not apply after a plain dbrain restart, but the MCP section immediately below still instructs users to add mcp-config.json and then run dbrain restart. In the Russian setup guide this leaves users with two conflicting procedures for the same MCP setup flow, and the later instruction is the one they are likely to follow when adding an MCP server.
Useful? React with 👍 / 👎.
9b860b8 to
9f9ca3d
Compare
A downstream fork hit this: changing CLAUDE_MODEL and running `dbrain restart`
did nothing, because the bot restart reuses the live tmux session as-is
(_ensure_locked returns early when the session exists). That is by design —
KillMode=process keeps the brain alive across restarts so it stays on the
subscription — but it is non-obvious.
Document in README and the setup guide that session-creation-time settings
(CLAUDE_MODEL, mcp-config.json, system prompt) need an actual brain recreation.
Recreate BOTH sessions — the main brain and the cron brain (${brain}_cron),
which get_cron_session builds with the same model/MCP/prompt — else scheduled
jobs keep running with the old settings (Codex review). Also fix the MCP
section, which previously told users a plain `dbrain restart` picks up
mcp-config.json — it does not (Codex review). Bot-level .env (tokens,
ALLOWED_USER_IDS, TZ) still applies on a plain restart.
9f9ca3d to
0c1d987
Compare
Problem (reported by a downstream fork)
The dev changed
CLAUDE_MODELin.env, randbrain restart, and nothing happened. That's because the bot restart reuses the live tmux session as-is —_ensure_lockedreturns early when the session already exists. This is by design (KillMode=processkeeps the brain alive so it stays on the subscription), but it's non-obvious.Fix (docs only)
Document in README and docs/setup-guide.ru.md the distinction:
CLAUDE_MODEL,mcp-config.json, the system prompt — take effect only after the brain is recreated:tmux kill-session -t "$(cat ~/.dbrain/brain.name)"; the bot rebuilds it on the next message..env(tokens,ALLOWED_USER_IDS,TZ) applies on a plaindbrain restart.No code change.
Closes feedback item #4 (model change not applied by a simple bot restart — not a bug, a documentation gap).