From 35c9bc2138696edd49b908e9dcf61702f8751ad4 Mon Sep 17 00:00:00 2001 From: Jacobo Ortiz Date: Thu, 28 May 2026 12:14:41 -0500 Subject: [PATCH] fix(settings): set CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS=10000 to cover slow SessionEnd hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude Code v2.1.74+ caps the entire SessionEnd hook chain at 1.5 seconds by default (documented at https://code.claude.com/docs/en/hooks). The v5.0.0 SessionEnd chain includes UpdateCounts.hook.ts, which makes two synchronous Anthropic API calls inside refreshUsageCache (usage API with 3s timeout + cost_report API with 5s timeout, worst case ~8s). UpdateCounts alone blows the 1.5s budget by 2-5x, producing recurring terminal output: SessionEnd hook $HOME/.claude/hooks/UpdateCounts.hook.ts failed: Hook cancelled When the budget expires, subsequent hooks (IntegrityCheck, KVSync) never start — statusline counts and Cloudflare KV sync go stale. Setting CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS=10000 (10 seconds) gives the chain enough budget to complete UpdateCounts plus its neighbors (IntegrityCheck 0.6s + KVSync 0.9s measured locally) with headroom. Related: #965 --- Releases/v5.0.0/.claude/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/Releases/v5.0.0/.claude/settings.json b/Releases/v5.0.0/.claude/settings.json index 90f7f54b84..224edbba77 100644 --- a/Releases/v5.0.0/.claude/settings.json +++ b/Releases/v5.0.0/.claude/settings.json @@ -5,6 +5,7 @@ "PROJECTS_DIR": "${HOME}/Projects", "BASH_DEFAULT_TIMEOUT_MS": "600000", "API_TIMEOUT_MS": "1800000", + "CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS": "10000", "PAI_CONFIG_DIR": "${HOME}/.claude/PAI", "GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE": "$HOME/.claude/PAI/USER/CREDENTIALS/google/your-domain.example.com.json" },