myrlin-workbook 0.9.18 → 0.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/logs/server.pid CHANGED
@@ -1 +1 @@
1
- 21156
1
+ 49156
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myrlin-workbook",
3
- "version": "0.9.18",
3
+ "version": "0.9.19",
4
4
  "description": "Browser-based project manager for Claude Code sessions - session discovery, multi-terminal, cost tracking, docs, and kanban board",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/gui.js CHANGED
@@ -191,10 +191,22 @@ if (!process.env.CWM_NO_OPEN) {
191
191
 
192
192
  // ─── Memory Watchdog ──────────────────────────────────────
193
193
  // Monitor RSS and kill idle PTY sessions when memory exceeds threshold.
194
- // This prevents the OS from silently OOM-killing the entire process tree.
195
- const MEMORY_CHECK_INTERVAL = 30000; // Check every 30 seconds
196
- const MEMORY_WARN_MB = 350; // Warn and kill idle PTYs
197
- const MEMORY_CRITICAL_MB = 450; // Force-kill all clientless PTYs
194
+ // ConPTY on Windows allocates significant native memory (outside V8 heap)
195
+ // so RSS can spike well beyond --max-old-space-size.
196
+ const MEMORY_CHECK_INTERVAL = 15000; // Check every 15 seconds
197
+ const MEMORY_WARN_MB = 200; // Start killing idle (zero-client) PTYs
198
+ const MEMORY_CRITICAL_MB = 350; // Aggressively kill PTYs to survive
199
+
200
+ // Periodic RSS logging so we can trace memory trajectory in server.log
201
+ const _rssLogger = setInterval(() => {
202
+ const mem = process.memoryUsage();
203
+ const ptyManager = getPtyManager();
204
+ const ptySessions = ptyManager ? ptyManager.listSessions().length : 0;
205
+ try {
206
+ console.log(`[RSS] ${Math.round(mem.rss / 1024 / 1024)}MB heap=${Math.round(mem.heapUsed / 1024 / 1024)}/${Math.round(mem.heapTotal / 1024 / 1024)}MB pty=${ptySessions}`);
207
+ } catch (_) {}
208
+ }, 60000);
209
+ _rssLogger.unref();
198
210
 
199
211
  const _memoryWatchdog = setInterval(() => {
200
212
  const rssMB = Math.round(process.memoryUsage().rss / 1024 / 1024);
@@ -220,8 +232,8 @@ const _memoryWatchdog = setInterval(() => {
220
232
  }
221
233
 
222
234
  // In critical mode, also kill sessions that have been alive longest
223
- if (isCritical && killed === 0 && sessions.length > 2) {
224
- const oldest = sessions.sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0));
235
+ if (isCritical && killed === 0 && sessions.length > 1) {
236
+ const oldest = [...sessions].sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0));
225
237
  ptyManager.killSession(oldest[0].sessionId);
226
238
  killed++;
227
239
  }
@@ -111,7 +111,7 @@ class PtySession {
111
111
  // Maximum number of live PTY sessions. Each one is a ConPTY handle + a Claude
112
112
  // process (100-200MB each). Beyond this limit, new spawns are rejected to
113
113
  // prevent the OS from OOM-killing the server process tree.
114
- const MAX_PTY_SESSIONS = 10;
114
+ const MAX_PTY_SESSIONS = 5;
115
115
 
116
116
  class PtySessionManager {
117
117
  constructor() {