From 5c28e6c191248eb9d3043a4dfcd59f39c23d6d81 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 20 Apr 2026 18:03:37 +0000 Subject: [PATCH] fix: use printf instead of echo in init container to prevent prompt corruption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Busybox echo interprets escape sequences by default (\c, \n, \t, \0NNN, etc.). If the prompt contains \c (common in file paths or shell references), echo silently stops output at that point, truncating the prompt file. This can leave Claude CLI with an empty or garbled stdin, causing it to hang with zero output — manifesting as endless keepalive messages in the UI. printf '%s' passes content through verbatim, avoiding the issue. Co-Authored-By: Paperclip --- src/server/job-manifest.test.ts | 2 +- src/server/job-manifest.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/job-manifest.test.ts b/src/server/job-manifest.test.ts index adc18a6..9fdbd80 100644 --- a/src/server/job-manifest.test.ts +++ b/src/server/job-manifest.test.ts @@ -181,7 +181,7 @@ describe("buildJobManifest", () => { it("write-prompt writes PROMPT_CONTENT to /tmp/prompt/prompt.txt", () => { const { job } = buildJobManifest({ ctx, selfPod }); const init = job.spec?.template?.spec?.initContainers?.[0]; - expect(init?.command).toEqual(["sh", "-c", "echo \"$PROMPT_CONTENT\" > /tmp/prompt/prompt.txt"]); + expect(init?.command).toEqual(["sh", "-c", "printf '%s' \"$PROMPT_CONTENT\" > /tmp/prompt/prompt.txt"]); }); it("write-prompt mounts prompt volume", () => { diff --git a/src/server/job-manifest.ts b/src/server/job-manifest.ts index 0243cfb..74a4276 100644 --- a/src/server/job-manifest.ts +++ b/src/server/job-manifest.ts @@ -359,7 +359,7 @@ export function buildJobManifest(input: JobBuildInput): JobBuildResult { name: "write-prompt", image: "busybox:1.36", imagePullPolicy: "IfNotPresent", - command: ["sh", "-c", "echo \"$PROMPT_CONTENT\" > /tmp/prompt/prompt.txt"], + command: ["sh", "-c", "printf '%s' \"$PROMPT_CONTENT\" > /tmp/prompt/prompt.txt"], env: [{ name: "PROMPT_CONTENT", value: prompt }], volumeMounts: [{ name: "prompt", mountPath: "/tmp/prompt" }], securityContext,