Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc942ca818 | |||
| 83a2d25062 | |||
| c8429cfde1 | |||
| 1502039d70 |
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paperclip-adapter-claude-k8s",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paperclip-adapter-claude-k8s",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@kubernetes/client-node": "^1.0.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paperclip-adapter-claude-k8s",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.3",
|
||||
"description": "Paperclip adapter plugin that runs Claude Code agents as Kubernetes Jobs",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1234,7 +1234,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
||||
waitForJobCompletion(namespace, jobName, completionTimeoutMs, kubeconfigPath, jobObserver).then(r => { logStopSignal.stopped = true; return r; }),
|
||||
]);
|
||||
|
||||
const stdout = tailResult.status === "fulfilled" ? tailResult.value : "";
|
||||
stdout = tailResult.status === "fulfilled" ? tailResult.value : "";
|
||||
|
||||
if (completionResult.status === "fulfilled") {
|
||||
jobTimedOut = completionResult.value.timedOut;
|
||||
|
||||
@@ -301,8 +301,7 @@ describe("buildJobManifest", () => {
|
||||
const init = job.spec?.template?.spec?.initContainers?.[0];
|
||||
expect(init?.command?.[0]).toBe("sh");
|
||||
expect(init?.command?.[1]).toBe("-c");
|
||||
expect(init?.command?.[2]).toContain("mkdir -p /paperclip/instances/default/run-logs/");
|
||||
expect(init?.command?.[2]).toContain("printf '%s' \"$PROMPT_CONTENT\" > /tmp/prompt/prompt.txt");
|
||||
expect(init?.command?.[2]).toBe("printf '%s' \"$PROMPT_CONTENT\" > /tmp/prompt/prompt.txt");
|
||||
});
|
||||
|
||||
it("write-prompt mounts prompt volume", () => {
|
||||
@@ -808,28 +807,26 @@ describe("buildJobManifest", () => {
|
||||
const { job } = buildJobManifest({ ctx, selfPod });
|
||||
const cmd = job.spec?.template?.spec?.containers[0]?.command?.[2] ?? "";
|
||||
expect(cmd).toContain("| tee");
|
||||
expect(cmd).toContain("/paperclip/instances/default/run-logs/");
|
||||
expect(cmd).toContain("/paperclip/instances/default/data/run-logs/");
|
||||
});
|
||||
|
||||
it("podLogPath is returned from buildJobManifest", () => {
|
||||
const result = buildJobManifest({ ctx, selfPod });
|
||||
expect(result.podLogPath).toBe(
|
||||
"/paperclip/instances/default/run-logs/co1/agent-abc/run-abc12345.pod.ndjson",
|
||||
"/paperclip/instances/default/data/run-logs/co1/agent-abc/run-abc12345.pod.ndjson",
|
||||
);
|
||||
});
|
||||
|
||||
it("buildPodLogPath returns correctly formatted path", () => {
|
||||
expect(buildPodLogPath("co1", "agent-abc", "run-abc12345")).toBe(
|
||||
"/paperclip/instances/default/run-logs/co1/agent-abc/run-abc12345.pod.ndjson",
|
||||
"/paperclip/instances/default/data/run-logs/co1/agent-abc/run-abc12345.pod.ndjson",
|
||||
);
|
||||
});
|
||||
|
||||
it("init container creates log directory", () => {
|
||||
it("init container does not create log directory (server pre-creates it on shared PVC)", () => {
|
||||
const { job } = buildJobManifest({ ctx, selfPod });
|
||||
const initCmd = job.spec?.template?.spec?.initContainers?.[0]?.command;
|
||||
expect(initCmd?.[0]).toBe("sh");
|
||||
expect(initCmd?.[1]).toBe("-c");
|
||||
expect(initCmd?.[2]).toContain("mkdir -p /paperclip/instances/default/run-logs/");
|
||||
expect(initCmd?.[2]).not.toContain("mkdir -p /paperclip");
|
||||
});
|
||||
|
||||
it("sanitizes companyId with / to valid path component for log path", () => {
|
||||
|
||||
@@ -23,7 +23,7 @@ function sanitizeForK8sPath(value: string): string {
|
||||
}
|
||||
|
||||
export function buildPodLogPath(companyId: string, agentId: string, runId: string): string {
|
||||
return `/paperclip/instances/default/run-logs/${companyId}/${agentId}/${runId}.pod.ndjson`;
|
||||
return `/paperclip/instances/default/data/run-logs/${companyId}/${agentId}/${runId}.pod.ndjson`;
|
||||
}
|
||||
|
||||
/** Prompts above this size (bytes) are staged via a Secret instead of an
|
||||
@@ -504,7 +504,7 @@ export function buildJobManifest(input: JobBuildInput): JobBuildResult {
|
||||
name: "write-prompt",
|
||||
image: "busybox:1.36",
|
||||
imagePullPolicy: "IfNotPresent",
|
||||
command: ["sh", "-c", `mkdir -p /paperclip/instances/default/run-logs/${agent.companyId}/${agent.id} && cp /tmp/prompt-secret/prompt.txt /tmp/prompt/prompt.txt`],
|
||||
command: ["sh", "-c", "cp /tmp/prompt-secret/prompt.txt /tmp/prompt/prompt.txt"],
|
||||
volumeMounts: [
|
||||
{ name: "prompt", mountPath: "/tmp/prompt" },
|
||||
{ name: "prompt-secret", mountPath: "/tmp/prompt-secret", readOnly: true },
|
||||
@@ -519,7 +519,7 @@ export function buildJobManifest(input: JobBuildInput): JobBuildResult {
|
||||
name: "write-prompt",
|
||||
image: "busybox:1.36",
|
||||
imagePullPolicy: "IfNotPresent",
|
||||
command: ["sh", "-c", `mkdir -p /paperclip/instances/default/run-logs/${agent.companyId}/${agent.id} && printf '%s' "$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,
|
||||
|
||||
Reference in New Issue
Block a user