Ship filesystem log tailing as 0.2.0 (port c8429cf path fix from claude-k8s before merge) #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Land the filesystem-log-tail rewrite as
0.2.0. The branch exists locally but has two latent bugs that already bitpaperclip-adapter-claude-k8s0.2.1 in production. Port the fix before merging, otherwise every Job will fail with an init-container exit code 1.Current state
feat/filesystem-log-tail-and-liveness-flagis not pushed to origin yet. It's at commit127eab8with the K8s log-API → PVC filesystem-tail rewrite (78d655e feat: replace K8s log streaming with PVC filesystem tailing).stash@{0}on that branch —fs.statdynamic-import destructuring +vi.hoistedtest mock fix. Pop it when you check the branch out.0.1.39, which contains the CJS ui-parser fix and the@paperclipai/adapter-utilsbump to^2026.428.0. Do not let the feature-branch merge clobber those (PR #11 in claude-k8s did exactly that and we had to redo the work).What's broken in the branch
Both bugs are in
src/server/job-manifest.tsand were fixed inpaperclip-adapter-claude-k8scommitc8429cf("fix: write logs to /paperclip/instances/default/data/run-logs/ to match server PVC layout"). Port that fix verbatim.Bug 1 — init container can't mkdir the log dir
The init container runs:
```
mkdir -p /paperclip/instances/default/run-logs// && cp ... /tmp/prompt/prompt.txt
```
at lines 464 (large-prompt secret variant) and 471 (env-var variant). The PVC is not mounted in the init container — only `prompt` and `prompt-secret` volumes are mounted there. So the mkdir runs against init's ephemeral rootfs as UID 1000 in a path that doesn't exist, exits 1, the `&&` short-circuits, the prompt copy never happens, and the Job dies with `Init container 'write-prompt' failed with exit code 1`.
Fix: drop the `mkdir -p ... &&` from both init container variants. The directory already exists on the PVC because the Paperclip server creates it. Both containers run as UID 1000 with fsGroup 1000, so the main container's `tee` writes to the pre-existing path with no setup needed.
Bug 2 — log path missing `/data/` segment
`buildPodLogPath()` in `src/server/job-manifest.ts:27-29` returns:
```
/paperclip/instances/default/run-logs///.pod.ndjson
```
but the Paperclip server creates and tails from:
```
/paperclip/instances/default/data/run-logs///.pod.ndjson
```
Even if the mkdir worked, the server wouldn't see the file. Fix: add `/data/` to the constant in `buildPodLogPath()`. Update the same path in both init-container command strings (lines 464 and 471) for consistency, even though those will go away once the mkdir is dropped.
Plan
Reference commits
Why this matters
claude-k8s shipped 0.2.1 with these two bugs, every run failed in production for a day, fix shipped as 0.2.2. The opencode-k8s feature branch has the identical pre-fix pattern. Don't repeat the cycle.