fix(cursor): verify installed runtime and delivered artifact evidence

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-03 18:00:20 -05:00
1 parent 5e6c1666c1
commit 473206cd9d
16 files changed
+204 -20

No files matched your search

@@ -313,8 +313,8 @@ absolute artifact `path` and `sha256:<64 hex digits>` digest. Assembly verifies
all inputs before staging and records source and packaged hashes in
`dist/bin/release-manifest.json`. Rebuild the server after assembly so its
vendored distribution contains the entire verified platform set. The ordinary
public-install verifier requires this manifest at the current source and checks
all three packaged identities before launching the normally resolved Linux
public-install verifier requires this manifest at an ancestor of the current source, requires unchanged Runner source since
that frozen runtime, and checks all three packaged identities before launching the normally resolved Linux
daemon. The actual installed task smoke remains a separate required gate.
Focused repair verification: 42 checkpoint/binary-selection tests, nine durable
@@ -323,3 +323,10 @@ passed. The first sidecar invocation timed out in the sandbox; the unrestricted
local IPC repeat passed. Runtime source changed, so the next affected live
attempt requires refreshed platform packs and Linux image identities. Existing
results retain their original runtime/controller identities.
The rebuilt d0b907 runtime passed all ten local Product E2E workflows with confirmed cleanup. Controller/harness source for those results is 5e6c16. Its seven Runner cases also passed every semantic check with owned processes retired; all seven strict accounting results remain failures (`provider_budget_coverage_unknown`, per-run USD unknown). The exact attempt identities are `cursor-v11-d0b907-local-<case>-01` and `cursor-v11-d0b907-<runner-case>-01`. No automatic retries were used.
Review then repaired the installed server's independent daemon lookup to use the Runner's verified platform selector. The public npm probe now verifies both selectors agree. Harness diagnostic retention follows the final verdict and preserves incomplete publication; remote-admission uncertainty is marked only for Daytona. The file gate now additionally downloads the registered run-attributed artifact and verifies its exact bytes and stored hash. The earlier local file result retains its original oracle and identity; an affected repeat is required for the new download proof. These repairs do not change the frozen Runner source.
The d0b907 Linux qualification image built successfully and its extracted provider pack passed manifest and command verification. Publishing `ghcr.io/paperclipai/paperclip-daytona-runner:cursor-qualification-d0b90756e3ab` was rejected by automatic approval review because explicit authorization for that payload and registry destination is required. The image remains local at `sha256:16c7be3610f45e409f67873dd4bd829f9a1e0e5f017c8826d01db4bb05720f97`; an approval request is pending. The fresh Daytona matrix has not started. Production admission remains disabled.
+7 -1
View File
@@ -18,7 +18,11 @@ const run = (command, args, cwd = root) => execFileSync(command, args, { cwd, en
const sourceRevision = run('git', ['rev-parse', 'HEAD'], repo).toString().trim();
const releaseBinaries = JSON.parse(readFileSync(join(repo, 'server/dist/vendor/paperclip-runner/bin/release-manifest.json'), 'utf8'));
assert.equal(releaseBinaries.schema, 'paperclip.runner.release-binaries.v1');
assert.equal(releaseBinaries.sourceRevision, sourceRevision, 'Stage all three release daemons and rebuild the server at this source before verification');
assert.match(releaseBinaries.sourceRevision, /^[a-f0-9]{40}$/);
run('git', ['merge-base', '--is-ancestor', releaseBinaries.sourceRevision, sourceRevision], repo);
// Controller/fixture repairs may follow a frozen runtime. Its exact binary
// provenance stays unchanged; require the Runner source to remain identical.
run('git', ['diff', '--quiet', releaseBinaries.sourceRevision, sourceRevision, '--', 'packages/paperclip-runner'], repo);
assert.deepEqual(Object.keys(releaseBinaries.platforms).sort(), ['darwin-arm64', 'darwin-x64', 'linux-x64']);
const releaseVersion = `0.0.0-cursor-verify.${sourceRevision.slice(0, 12)}`;
const listing = run(process.execPath, [join(repo, 'scripts/release-package-map.mjs'), 'list'], repo).toString().trim().split('\n').map(line => line.split('\t'));
@@ -80,6 +84,7 @@ import { readFileSync } from 'node:fs';
import { createHash } from 'node:crypto';
import { execFileSync } from 'node:child_process';
import { defaultCapabilityRunnerdBinary } from '/consumer/node_modules/@paperclipai/server/dist/vendor/paperclip-runner/live/runnerd-codex-transport.js';
import { resolvePaperclipRunnerBinary } from '/consumer/node_modules/@paperclipai/server/dist/services/native-runtime/native-codex-runner.js';
import { runnerBinaryTarget } from '/consumer/node_modules/@paperclipai/server/dist/vendor/paperclip-runner/live/runner-binary.js';
import { verifyAcpxProfileInstallation } from '/consumer/node_modules/@paperclipai/server/dist/vendor/paperclip-runner/drivers/acpx/profile-installation.js';
import { resolveQualifiedAcpxProfile } from '/consumer/node_modules/@paperclipai/server/dist/vendor/paperclip-runner/drivers/acpx/qualified-profiles.js';
@@ -101,6 +106,7 @@ for (const [target, artifact] of Object.entries(manifest.platforms)) {
}
const binary = defaultCapabilityRunnerdBinary();
assert.equal(binary, binaryRoot + '/linux-x64/paperclip-runnerd');
assert.equal(resolvePaperclipRunnerBinary(), binary, 'The installed server must use the same verified platform daemon');
const metadata = JSON.parse(execFileSync(binary, ['--build-metadata'], { encoding: 'utf8' }));
assert.equal(metadata.schema, 'paperclip-runner/runnerd-build-metadata/v1');
assert.equal(metadata.binaryContractVersion, 2);
@@ -1,11 +1,50 @@
import { describe, expect, it } from "vitest";
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import * as runner from "../../vendor/paperclip-runner/index.js";
import type { PaperclipSemanticToolDefinition } from "../../vendor/paperclip-runner/index.js";
import {
buildNativeRunnerArguments,
buildNativeRunnerPreparePayload,
resolvePaperclipRunnerBinary,
} from "./native-codex-runner.js";
afterEach(() => vi.restoreAllMocks());
describe("installed runner selection", () => {
it("uses the runner's platform-aware packaged selection", async () => {
const root = await mkdtemp(join(tmpdir(), "paperclip-runner-selection-"));
const binary = join(root, "paperclip-runnerd");
try {
await writeFile(binary, "test executable", { mode: 0o700 });
const select = vi.spyOn(runner, "defaultCapabilityRunnerdBinary").mockReturnValue(binary);
expect(resolvePaperclipRunnerBinary("")).toBe(binary);
expect(select).toHaveBeenCalledOnce();
expect(resolvePaperclipRunnerBinary(join(root, "missing"))).toBe(binary);
} finally {
await rm(root, { recursive: true, force: true });
}
});
it("keeps an explicit usable override and rejects a relative override", async () => {
const root = await mkdtemp(join(tmpdir(), "paperclip-runner-selection-"));
const binary = join(root, "configured-runnerd");
try {
await writeFile(binary, "test executable", { mode: 0o700 });
const select = vi.spyOn(runner, "defaultCapabilityRunnerdBinary").mockImplementation(() => {
throw new Error("must not inspect package when override is usable");
});
expect(resolvePaperclipRunnerBinary(binary)).toBe(binary);
expect(select).not.toHaveBeenCalled();
expect(() => resolvePaperclipRunnerBinary("relative-runnerd")).toThrow("absolute path");
} finally {
await rm(root, { recursive: true, force: true });
}
});
});
describe("buildNativeRunnerArguments", () => {
it("binds every durable identity without exposing the bootstrap ticket", () => {
const args = buildNativeRunnerArguments({
@@ -13,6 +13,7 @@ import { resolvePaperclipInstanceRoot } from "../../home-paths.js";
import { failRunnerGoalAction } from "../runner-goals.js";
import {
createPaperclipRunnerAuthorizedToolSet,
defaultCapabilityRunnerdBinary,
type PaperclipSemanticToolDefinition,
} from "../../vendor/paperclip-runner/index.js";
import { runnerPrpCoordinator } from "./runner-prp-coordinator.js";
@@ -171,19 +172,27 @@ function executableName(): string {
export function resolvePaperclipRunnerBinary(
configuredPath = process.env.PAPERCLIP_RUNNER_BINARY,
): string {
if (configuredPath && !isAbsolute(configuredPath)) {
throw new Error("PAPERCLIP_RUNNER_BINARY must be an absolute path");
}
if (configuredPath) {
try {
accessSync(configuredPath, constants.R_OK | (process.platform === "win32" ? 0 : constants.X_OK));
return configuredPath;
} catch {
// Preserve the existing fallback for an unavailable configured path.
}
}
const candidates = [
configuredPath,
resolve(moduleDirectory, "../../vendor/paperclip-runner/bin", executableName()),
resolve(moduleDirectory, "../../../../packages/paperclip-runner/dist/bin", executableName()),
// The runner owns its compiled/vendored root and verifies the target header.
// Never prefer a flat build-host executable over a staged release target.
defaultCapabilityRunnerdBinary(),
resolve(
moduleDirectory,
"../../../../packages/paperclip-runner/runner/target/release",
executableName(),
),
].filter((candidate): candidate is string => Boolean(candidate));
if (configuredPath && !isAbsolute(configuredPath)) {
throw new Error("PAPERCLIP_RUNNER_BINARY must be an absolute path");
}
for (const candidate of candidates) {
try {
accessSync(candidate, constants.R_OK | (process.platform === "win32" ? 0 : constants.X_OK));
+3 -1
View File
@@ -1596,7 +1596,7 @@ The v3 hiring grader uses turn-accounting v2 in both executable guards. It requi
The live fixture retries entire bracketed observations, waits for both known task callbacks and attributed replies (including batching), checks untruncated pending-wake diagnostics, and requires two equal settled observations. Silence before outbox enqueue is not delivery. Five-turn generic accounting remains calibrated for no owed notifications; this delegated fixture owes two completions. All actual runs remain counted for usage and cost. Retained original, limited sidecar-v1, initial executable, and stricter v3 assessments remain separately versioned; no models are rerun by the repair.
Recovery-state retention uses raw cleanup results before evidence publication. An owner-only resource-admission marker also preserves state if the test worker dies before producing a result. Confirmed bootstrap failures before allocation remove their temporary state and retain their original failure classification.
Recovery-state retention uses raw cleanup results before evidence publication. An owner-only resource-admission marker for Daytona cells also preserves state if the test worker dies before producing a result. Local worker crashes do not imply remote allocation; their process cleanup proof still applies independently. Confirmed bootstrap failures before allocation remove their temporary state and retain their original failure classification.
## Public installed release smoke
@@ -1614,3 +1614,5 @@ retains the attempt's owner-only private directory after a failed case even
when owned cleanup passed. This does not alter the case or cleanup outcome.
Private traces and database files must not be published. Unconfirmed cleanup
always preserves recovery state regardless of this optional diagnostic flag.
The `file-edit-validate` fixture independently downloads the exact active artifact work product from the tested run. It requires the matching run-attributed attachment, filename, MIME type, recorded byte count and SHA-256, then compares the downloaded content to the expected bytes. A workspace file alone cannot satisfy this gate. Explicit failed-case diagnostic retention follows the final result after integrity, isolation and evidence checks, including incomplete publication.
+1
View File
@@ -1080,6 +1080,7 @@ export const extendedHarnessFileTask: RunnerTaskFixture = {
buildMatchers: (nonce, execution) => [
...terminalMatchers(`EXTENDED-FILE-${nonce}`, execution),
{ kind: "file_exact", path: `extended-${nonce}.txt`, expected: `verified-${nonce}\n` },
{ kind: "artifact_exact", name: `extended-${nonce}.txt`, expected: `verified-${nonce}\n`, mimeType: "text/plain" },
],
};
+14 -1
View File
@@ -1,5 +1,18 @@
import { expect, it } from "vitest";
import { mustPreserveRecoveryState, runCleanupWithObservers, verifyCleanupAssertions } from "./cleanup-verification.js";
import { mayAllocateRemoteResources, mustPreserveRecoveryState, runCleanupWithObservers, shouldKeepFailedDiagnostics, verifyCleanupAssertions } from "./cleanup-verification.js";
it("keeps late failures and incomplete publication for explicit diagnosis", () => {
expect(shouldKeepFailedDiagnostics({ enabled: true, expectedResults: 1, results: [{ status: "failed" }] })).toBe(true);
expect(shouldKeepFailedDiagnostics({ enabled: true, expectedResults: 2, results: [{ status: "passed" }] })).toBe(true);
expect(shouldKeepFailedDiagnostics({ enabled: true, expectedResults: 1, results: [] })).toBe(true);
expect(shouldKeepFailedDiagnostics({ enabled: true, expectedResults: 1, results: [{ status: "passed" }] })).toBe(false);
expect(shouldKeepFailedDiagnostics({ enabled: false, expectedResults: 1, results: [] })).toBe(false);
});
it("marks only environments that can allocate remote resources", () => {
expect(mayAllocateRemoteResources("daytona")).toBe(true);
expect(mayAllocateRemoteResources("local")).toBe(false);
});
it("retains uncertain remote allocation state even after every local process exits", () => {
expect(mustPreserveRecoveryState({ processCleanupFailed: false, results: [{ cleanup: "failed" }] })).toBe(true);
+14
View File
@@ -1,6 +1,20 @@
export interface CleanupCheck { id: string; passed: boolean; detail: string }
export type CleanupAssertion = () => Promise<CleanupCheck[]>;
export function mayAllocateRemoteResources(environment: string) {
return environment === "daytona";
}
/** Diagnostic retention follows the final verdict, including publication errors. */
export function shouldKeepFailedDiagnostics(input: {
enabled: boolean;
expectedResults: number;
results: readonly { status: string }[];
}) {
return input.enabled && (input.results.length !== input.expectedResults ||
input.results.some(result => result.status === "failed"));
}
/** A stopped controller does not prove remote resources were retired. Retain
* its private recovery database whenever a cell lacks confirmed cleanup. */
export function mustPreserveRecoveryState(input: {
@@ -40,6 +40,7 @@ describe("extended ACP harness qualification", () => {
it("grades the actual file independently of the model's validation claim", () => {
const cell = selected.find(cell => cell.task.id === "file-edit-validate")!;
expect(extendedHarnessFileTask.buildMatchers("nonce", cell)).toContainEqual({ kind: "file_exact", path: "extended-nonce.txt", expected: "verified-nonce\n" });
expect(extendedHarnessFileTask.buildMatchers("nonce", cell)).toContainEqual({ kind: "artifact_exact", name: "extended-nonce.txt", expected: "verified-nonce\n", mimeType: "text/plain" });
});
it("redacts and detects GitHub credential shapes even without the bound value", () => {
const token = `github_pat_${"x".repeat(40)}`;
+6 -2
View File
@@ -23,7 +23,7 @@ import { isImmutableDaytonaImage, runnerMatrix } from "./catalog.js";
import { renderRunnerE2EDashboard } from "./dashboard.js";
import { packageEvidence } from "./evidence.js";
import { classifyFailure } from "./failure-classifier.js";
import { mustPreserveRecoveryState } from "./cleanup-verification.js";
import { mustPreserveRecoveryState, shouldKeepFailedDiagnostics } from "./cleanup-verification.js";
import { effectiveAutomaticRetryLimit, executeWithAutomaticRetry } from "./automatic-retry.js";
import { buildRunnerCampaign } from "./history.js";
import {
@@ -810,7 +810,11 @@ async function runAttempt(input: {
// Deleting it after the controller exits would strand uncertain creates.
await chmod(temporaryRoot, 0o700);
cleanupError = new Error(`Preserving private recovery state after unconfirmed cleanup: ${temporaryRoot}`);
} else if (process.env.PAPERCLIP_RUNNER_E2E_KEEP_FAILED_PRIVATE === "1" && rawCleanupResults.some(result => result.status === "failed")) {
} else if (shouldKeepFailedDiagnostics({
enabled: process.env.PAPERCLIP_RUNNER_E2E_KEEP_FAILED_PRIVATE === "1",
expectedResults: executions.length,
results: publishedResults,
})) {
// Explicit diagnosis only. Confirmed resource cleanup stays confirmed;
// keep private traces for investigation without publishing provider data.
await chmod(temporaryRoot, 0o700);
+5 -3
View File
@@ -27,7 +27,7 @@ export interface MatcherObservation {
runtimeMode?: string;
environment?: string;
files?: Record<string, string>;
artifacts?: Array<{ name: string; mimeType?: string }>;
artifacts?: Array<{ name: string; mimeType?: string; content?: string; contentVerified?: boolean }>;
json?: unknown;
}
@@ -132,12 +132,14 @@ export async function evaluateMatcher(
actual = undefined;
passed = false;
}
} else if (matcher.kind === "artifact_exists") {
} else if (matcher.kind === "artifact_exists" || matcher.kind === "artifact_exact") {
actual = observation.artifacts ?? [];
passed = (observation.artifacts ?? []).some(
(artifact) =>
artifact.name === matcher.name &&
(!matcher.mimeType || artifact.mimeType === matcher.mimeType),
(!matcher.mimeType || artifact.mimeType === matcher.mimeType) &&
(matcher.kind === "artifact_exists" ||
(artifact.contentVerified === true && artifact.content === matcher.expected)),
);
} else if (matcher.kind === "json_path") {
actual = readJsonPath(observation.json, matcher.path);
@@ -0,0 +1,37 @@
import { createHash } from "node:crypto";
import { expect, it, vi } from "vitest";
import type { RunnerApi } from "./api.js";
import { readRegisteredArtifacts } from "./registered-artifact.js";
import { evaluateMatcher } from "./matchers.js";
function fixture() {
const bytes = Buffer.from("verified\n");
const product = { id: "product", issueId: "issue", createdByRunId: "run", type: "artifact", status: "active", title: "proof.txt", metadata: { attachmentId: "attachment" } };
const attachment = { id: "attachment", issueId: "issue", originatingRunId: "run", originalFilename: "proof.txt", contentType: "text/plain", byteSize: bytes.length, sha256: createHash("sha256").update(bytes).digest("hex") };
const download = vi.fn().mockResolvedValue({ ok: () => true, body: async () => bytes });
const get = vi.fn().mockImplementation(async (path: string) => path.endsWith("work-products") ? [product] : [attachment]);
return { product, attachment, download, get, api: { get, request: { get: download } } as unknown as RunnerApi };
}
it("downloads the exact registered run-attributed output through its public path", async () => {
const { api, download } = fixture();
const artifacts = await readRegisteredArtifacts(api, "issue", "run", ["proof.txt"]);
expect(download).toHaveBeenCalledWith("/api/attachments/attachment/content?download=1");
expect((await evaluateMatcher({ kind: "artifact_exact", name: "proof.txt", expected: "verified\n", mimeType: "text/plain" }, { artifacts })).passed).toBe(true);
});
it.each(["unregistered", "old-run", "unattributed", "hash-mismatch", "download-failure"])("refuses %s output evidence", async reason => {
const { api, product, attachment, get, download } = fixture();
if (reason === "unregistered") get.mockImplementation(async (path: string) => path.endsWith("work-products") ? [] : [attachment]);
if (reason === "old-run") product.createdByRunId = "other-run";
if (reason === "unattributed") attachment.originatingRunId = "other-run";
if (reason === "hash-mismatch") attachment.sha256 = "incorrect";
if (reason === "download-failure") download.mockResolvedValue({ ok: () => false, status: () => 404 });
await expect(readRegisteredArtifacts(api, "issue", "run", ["proof.txt"])).rejects.toThrow();
});
it("does not accept a filename or unchecked content as downloaded evidence", async () => {
const matcher = { kind: "artifact_exact" as const, name: "proof.txt", expected: "verified\n" };
expect((await evaluateMatcher(matcher, { artifacts: [{ name: "proof.txt", content: "verified\n" }] })).passed).toBe(false);
expect((await evaluateMatcher(matcher, { artifacts: [{ name: "proof.txt", contentVerified: true, content: "wrong" }] })).passed).toBe(false);
});
+38
View File
@@ -0,0 +1,38 @@
import { createHash } from "node:crypto";
import type { IssueAttachment } from "../../packages/shared/src/types/issue.js";
import type { IssueWorkProduct } from "../../packages/shared/src/types/work-product.js";
import type { RunnerApi } from "./api.js";
/** Registration, attribution and downloaded bytes must agree independently. */
export async function readRegisteredArtifacts(api: RunnerApi, issueId: string, runId: string, names: readonly string[]) {
if (names.length === 0) return [];
const [products, attachments] = await Promise.all([
api.get<IssueWorkProduct[]>(`/api/issues/${encodeURIComponent(issueId)}/work-products`),
api.get<IssueAttachment[]>(`/api/issues/${encodeURIComponent(issueId)}/attachments`),
]);
return Promise.all(names.map(async name => {
const registered = products.filter(product => product.issueId === issueId &&
product.createdByRunId === runId && product.type === "artifact" &&
product.status === "active" && product.title === name);
if (registered.length !== 1) throw new Error(`Expected one registered artifact ${name} from the tested run; observed ${registered.length}`);
const product = registered[0]!;
const attachmentId = product.metadata?.attachmentId;
const matching = attachments.filter(attachment => attachment.id === attachmentId &&
attachment.issueId === issueId && attachment.originatingRunId === runId &&
attachment.originalFilename === name);
if (matching.length !== 1) throw new Error(`Registered artifact ${name} lacks its run-attributed attachment`);
const attachment = matching[0]!;
if (!Number.isSafeInteger(attachment.byteSize) || attachment.byteSize < 0 || attachment.byteSize > 262_144) {
throw new Error(`Registered artifact ${name} has an invalid or excessive size`);
}
const response = await api.request.get(`/api/attachments/${encodeURIComponent(attachment.id)}/content?download=1`);
if (!response.ok()) throw new Error(`Registered artifact ${name} download returned ${response.status()}`);
const bytes = await response.body();
const sha256 = createHash("sha256").update(bytes).digest("hex");
if (bytes.length !== attachment.byteSize || sha256 !== attachment.sha256) {
throw new Error(`Downloaded registered artifact ${name} disagrees with stored bytes`);
}
return { name, mimeType: attachment.contentType, content: bytes.toString("utf8"),
contentVerified: true, attachmentId: attachment.id, workProductId: product.id, sha256 };
}));
}
+1
View File
@@ -136,6 +136,7 @@ const matcher: Rule = (value, at) => {
file_exact: shape({ path: string, expected: string }),
file_contains: shape({ path: string, expected: string }),
artifact_exists: shape({ name: string, mimeType: optional(string) }),
artifact_exact: shape({ name: string, expected: string, mimeType: optional(string) }),
json_path: shape({ path: string }),
json_schema: shape({ schema: object }),
};
+12 -3
View File
@@ -9,7 +9,7 @@ import { runNativeActiveStopFlow } from "./native-active-stop-flow.js";
import { runNativeProviderLossFlow } from "./native-provider-loss-flow.js";
import { runCursorNativeFlow } from "./cursor-native-flow.js";
import { createRemoteNativeBootstrap, createRemoteFixtureClient } from "./remote-native-bootstrap.js";
import { runCleanupWithObservers, verifyCleanupAssertions, type CleanupAssertion } from "./cleanup-verification.js";
import { mayAllocateRemoteResources, runCleanupWithObservers, verifyCleanupAssertions, type CleanupAssertion } from "./cleanup-verification.js";
import { completionDelivery, type CompletionObservation } from "./completion-updates.js";
import { runInstructionPersistenceFlow } from "./instruction-persistence.js";
import { gradeApiResponsePaging, readResponseProof, responseEvidenceDescription } from "./api-response-reading.js";
@@ -43,6 +43,7 @@ import { runnerE2EServerControlPaths } from "./harness-env.js";
import { setupConnectionReview } from "./connection-reviews.js";
import { setupLiveFixtures, type LiveFixtureValues } from "./live-fixtures.js";
import { evaluateMatcher, persistedFinalRunMessage, type MatcherResult } from "./matchers.js";
import { readRegisteredArtifacts } from "./registered-artifact.js";
import {
acceptedPlanSessionResetFailures,
collectRunEvents,
@@ -554,8 +555,10 @@ for (const execution of executions) {
? deadlineMs
: deadlineMs + 90_000,
);
// Durable admission evidence survives a worker crash before result publication.
await writeFile(path.join(privateRoot, "resource-admission-started"), "started\n", { mode: 0o600 });
// Remote allocation uncertainty survives a worker crash before publication.
if (mayAllocateRemoteResources(execution.environment.id)) {
await writeFile(path.join(privateRoot, "resource-admission-started"), "started\n", { mode: 0o600 });
}
const startedAtMs = Date.now();
const startedAt = new Date(startedAtMs).toISOString();
const nonce = `${randomBytes(6).toString("hex")}-${attempt}`;
@@ -2225,11 +2228,17 @@ for (const execution of executions) {
fileObservations["api-response-proof.txt"] = downloadedResponseProof.content;
await writeSanitizedJson(snapshotsDir, "downloaded-response-proof.json", downloadedResponseProof, secrets);
}
const registeredArtifacts = await readRegisteredArtifacts(api, issue.id, run.id,
taskMatchers.filter(matcher => matcher.kind === "artifact_exact").map(matcher => matcher.name));
if (registeredArtifacts.length > 0) {
await writeSanitizedJson(snapshotsDir, "downloaded-registered-artifacts.json", registeredArtifacts, secrets);
}
matcherResults = await Promise.all(
taskMatchers.map((matcher) =>
evaluateMatcher(matcher, {
...matcherObservation,
files: fileObservations,
artifacts: registeredArtifacts,
// Multi-run tasks intentionally retain earlier waiting/revision
// replies. Exact completion text belongs to the chronological
// final run, while occurrence checks still span every agent
+1
View File
@@ -129,6 +129,7 @@ export type Matcher =
| { kind: "file_exact"; path: string; expected: string }
| { kind: "file_contains"; path: string; expected: string }
| { kind: "artifact_exists"; name: string; mimeType?: string }
| { kind: "artifact_exact"; name: string; expected: string; mimeType?: string }
| { kind: "json_path"; path: string; expected: unknown }
| { kind: "json_schema"; schema: Record<string, unknown> };