From 656627a611001d7338786e5b714a6b04d03775b6 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Sun, 6 Dec 2026 02:01:13 +0000 Subject: [PATCH] claude: stop Claude Code killing background shells under memory pressure When the system reports critical memory pressure and a session has been idle for 30 minutes, Claude Code terminates its background shells. On maverick that killed long-running watchers using a few megabytes, while the process actually exhausting memory kept running until the kernel's OOM killer dealt with it. Set CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP in the managed settings' env, so reclaiming memory is left to the OOM killer. Test plan: - CI - Built maverick's toplevel: /etc/claude-code/managed-settings.json sets the variable --- modules/home/claude/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/home/claude/default.nix b/modules/home/claude/default.nix index edc56d27..b0ebf5e2 100644 --- a/modules/home/claude/default.nix +++ b/modules/home/claude/default.nix @@ -19,6 +19,9 @@ let env = { CLAUDE_CODE_RETRY_WATCHDOG = "1"; CLAUDE_CODE_MAX_RETRIES = "1000"; + # Under memory pressure Claude Code kills idle background shells, which + # frees almost nothing. Reclaiming memory is the OOM killer's job. + CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP = "1"; }; enabledPlugins = { "rust-analyzer-lsp@claude-plugins-official" = true; -- 2.56.1