mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 06:42:06 +01:00
Add the Kimi lifecycle and recovery qualification harness. Preserve original grades and cleanup evidence, strict native ownership audits, bounded startup and cleanup, and early rejection of unsupported local fault execution before credentials or resources. Co-Authored-By: Paperclip <noreply@paperclip.ing>
42 lines
1.8 KiB
TypeScript
42 lines
1.8 KiB
TypeScript
import path from "node:path";
|
|
import type { MatrixExecution, RunnerTaskFlow } from "./types.js";
|
|
|
|
export function runnerE2EPlaywrightCaseTimeoutMs(flow: RunnerTaskFlow, deadlineMs: number) {
|
|
return (flow === "kimi_native_lifecycle" ? 2 * deadlineMs : deadlineMs) + 90_000;
|
|
}
|
|
|
|
export function runnerE2EPlaywrightWatchdogMs(executions: readonly MatrixExecution[]) {
|
|
// Playwright starts its web server before any case timeout begins.
|
|
return executions.reduce((total, execution) => total + runnerE2EPlaywrightCaseTimeoutMs(
|
|
execution.task.flow, execution.task.attemptTimeoutMs[execution.environment.id],
|
|
), 0) + 5 * 60_000;
|
|
}
|
|
|
|
export const runnerE2EPlaywrightShutdownSignal = "SIGINT" as const;
|
|
|
|
// Let the restart-aware supervisor reap Paperclip and finish its log streams.
|
|
// Its stop path allows 30 seconds for SIGTERM and 5 seconds for SIGKILL.
|
|
export const runnerE2EWebServerGracefulShutdown = {
|
|
signal: "SIGTERM" as const,
|
|
timeout: 45_000,
|
|
};
|
|
|
|
function shellQuote(value: string) {
|
|
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
}
|
|
|
|
export function runnerE2EWebServerCommand(repositoryRoot: string) {
|
|
const tsx = path.join(repositoryRoot, "cli/node_modules/tsx/dist/cli.mjs");
|
|
const server = path.join(repositoryRoot, "tests/runner-e2e/server.ts");
|
|
return `node ${shellQuote(tsx)} ${shellQuote(server)}`;
|
|
}
|
|
|
|
// Keep the supervisor's child PID equal to the actual TypeScript process.
|
|
export function runnerE2ETypeScriptProcessArgs(repositoryRoot: string, entry: string, args: string[] = []) {
|
|
return ["--import", path.join(repositoryRoot, "cli/node_modules/tsx/dist/loader.mjs"), entry, ...args];
|
|
}
|
|
|
|
export function runnerE2EPlaywrightInvocation(repositoryRoot: string, args: string[]) {
|
|
return { command: process.execPath, args: [path.join(repositoryRoot, "node_modules/@playwright/test/cli.js"), ...args] };
|
|
}
|