mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 23:06:17 +01:00
Preserve owned Linux fixture custody across workspace replacement
Move all custody path consumers under the existing preserved runtime directory. Retain original missing-custody failure evidence; new actual recovery acceptance remains required. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
6715a683d4
commit
12ea15ed0f
3 files changed
+4
-4
No files matched your search
@@ -26,7 +26,7 @@ export async function stopCheckpointedOwnedRun(input: { db: Db; workerManager: P
|
||||
environmentId: z.literal(input.environmentId), runId: z.literal(input.runId),
|
||||
containerId: z.string().regex(/^[a-f0-9]{64}$/), status: z.literal("active") }).passthrough()
|
||||
.parse(JSON.parse(await readFile(path.join(root, "resource.json"), "utf8")));
|
||||
const custody = path.join(root, "workspace/.qualification-custody");
|
||||
const custody = path.join(root, "workspace/.paperclip-runtime/.qualification-custody");
|
||||
const names = (await readdir(custody)).filter(name => /^[a-f0-9-]{36}\.json$/.test(name));
|
||||
if (names.length > 128) throw new Error("owned_fault_custody_inventory_overflow");
|
||||
const journals = await Promise.all(names.map(async name => JSON.parse(await readFile(path.join(custody, name), "utf8"))));
|
||||
|
||||
@@ -44,7 +44,7 @@ try {
|
||||
witnessStage="parse_launch";
|
||||
const launch = launchFromActualCommand(descriptor, request);
|
||||
witnessStage="open_custody";
|
||||
const ledgerDirectory = path.join(root, ".qualification-custody"); await mkdir(ledgerDirectory, { recursive: true, mode: 0o700 });
|
||||
const ledgerDirectory = path.join(root, ".paperclip-runtime", ".qualification-custody"); await mkdir(ledgerDirectory, { recursive: true, mode: 0o700 });
|
||||
if (!/^[a-f0-9-]{36}$/.test(request.requestId)) throw fail("request_identity_invalid");
|
||||
const journal = path.join(ledgerDirectory, request.requestId + ".json");
|
||||
// Exclusive record before dispatch: unknown response must not silently reexecute.
|
||||
|
||||
@@ -93,7 +93,7 @@ export class OwnedDockerResources {
|
||||
resource = { id, hostRoot, root: "/workspace", companyId: params.companyId, environmentId: params.environmentId,
|
||||
runId: params.runId, creationOperationId: params.creationOperationId, nonce: randomUUID(), containerName: id,
|
||||
containerId: null, status: "dispatch_recorded", expectedRunnerSHA256: this.config.runnerSHA256,
|
||||
launchDescriptor: "/workspace/.qualification-custody/active-launch.json" };
|
||||
launchDescriptor: "/workspace/.paperclip-runtime/.qualification-custody/active-launch.json" };
|
||||
await this.save(resource); // durable before creating anything
|
||||
for (const name of ["workspace", "descriptor"]) await mkdir(path.join(hostRoot, name), { mode: 0o700 });
|
||||
const args = ["create", "--name", id, "--init", "--read-only", "--network", "none", "--cpus", "2", "--memory", "4g", "--memory-swap", "4g", "--pids-limit", "256",
|
||||
@@ -133,7 +133,7 @@ export class OwnedDockerResources {
|
||||
// Retain the previous launch witness before a new launch can own this
|
||||
// exact workspace. Container stop proved the whole prior PID namespace
|
||||
// ended. Do not delete a marker/checkpoint or acquire a replacement.
|
||||
const custody = path.join(resource.hostRoot, "workspace/.qualification-custody");
|
||||
const custody = path.join(resource.hostRoot, "workspace/.paperclip-runtime/.qualification-custody");
|
||||
const active = path.join(custody, "active-launch.json");
|
||||
try { await rename(active, path.join(custody, "retired-launch-" + randomUUID() + ".json")); }
|
||||
catch (error) { if (error.code !== "ENOENT") throw error; }
|
||||
|
||||
Reference in new issue
Block a user