From dd0ca8b59c2b968bbb9ea407502fc38aef396753 Mon Sep 17 00:00:00 2001 From: siddseethepalli Date: Sat, 14 Feb 2026 17:56:15 +0000 Subject: [PATCH] Fix debug prompt logger fallback to cap total bytes, not per-line Replace `cut -c1-$MAX_OUTPUT` with `head -c $MAX_OUTPUT` so the 200KB cap applies to the entire output stream instead of truncating each line independently, which could allow multi-line input to exceed the intended limit. Co-Authored-By: Claude Opus 4.6 --- assistant/hook-templates/debug-prompt-logger/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assistant/hook-templates/debug-prompt-logger/run.sh b/assistant/hook-templates/debug-prompt-logger/run.sh index 30622686583..20496fe137a 100755 --- a/assistant/hook-templates/debug-prompt-logger/run.sh +++ b/assistant/hook-templates/debug-prompt-logger/run.sh @@ -17,7 +17,7 @@ MAX_OUTPUT=200000 if ! command -v jq >/dev/null 2>&1; then echo "(jq not found — install jq for formatted output)" >&2 - printf '%s' "$data" | cut -c1-"$MAX_OUTPUT" >&2 + printf '%s' "$data" | head -c "$MAX_OUTPUT" >&2 echo "" >&2 echo "════════════════════════════════════════════════════════════════" >&2 echo "" >&2