Fix Docker restart crash: respect autoStart flag and persist identity

Root cause: on Docker restart, loadSavedBots() unconditionally connected
ALL saved bots regardless of autoStart flag, causing a rapid
connect/disconnect loop. Additionally, bot identities were regenerated
on every restart, causing TS server conflicts with stale sessions.

Changes:
- loadSavedBots() now only auto-connects bots with autoStart=true
- startBot/stopBot persist autoStart state so restart behavior matches
  user intent
- Bot TS3 identity is persisted to database and reused across restarts
- Database schema migrated to include identity column
- TS3Client.connect() cleans up existing connection before reconnecting
- Stagger bot connections by 1s to avoid overwhelming the TS server

https://claude.ai/code/session_01L2kEV2M1QFWMCyPtLU5LgC
This commit is contained in:
Claude committed 2026-04-07 12:15:39 +00:00
1 parent b97f4a1d86
commit 2559701e55
4 files changed
+82 -15

No files matched your search

+4
View File
@@ -553,4 +553,8 @@ export class BotInstance extends EventEmitter {
isConnected(): boolean {
return this.connected;
}
getIdentityExport(): string | undefined {
return this.tsClient.getIdentityExport();
}
}