Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Keep the session heartbeat alive when saving a prune fails
milind-soniec5693cebfe6
diff --cc server/sessions.tsindex b2ab597c9f,27e37fba7f..6d2b872637--- a/server/sessions.ts+++ b/server/sessions.ts@@@ -273,16 -269,11 +269,16 @@@ export class SessionRegistryfor (const [source, entry] of this.failures) {if (entry.lockedUntil <= now && now - entry.windowStart > LOCKOUT.windowMs) this.failures.delete(source);}- const expired = this.sessions.filter((s) => s.expiresAt <= now || now - s.lastSeenAt > this.idleMs);+ const expired = this.sessions.filter((s) => s.expiresAt <= now);if (expired.length) {- this.sessions = this.sessions.filter((s) => s.expiresAt > now && now - s.lastSeenAt <= this.idleMs);+ this.sessions = this.sessions.filter((s) => s.expiresAt > now);for (const s of expired) this.forget(s.id);- this.persist();+ try {+ this.persist();+ } catch {- // Memory already holds the reduced set; the heartbeat reaches prune() through isLive(), where an escaping write failure would exit the process.++ // The heartbeat reaches prune() through isLive(), where an escaping write failure would exit the process.+ console.error("Could not persist session pruning.");+ }}}