test(hermes): add native image acceptance journey

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-08 14:58:47 -05:00
1 parent af87a249c1
commit 9478ead982
10 files changed
+314 -9

No files matched your search

@@ -1578,3 +1578,39 @@ passes strict verification. The production runtime is byte-identical in the
passing `2400ecdb8d` browser source. Repository CI at the latest head and the
remaining subscription, account/protocol, attachment, state, control, routine,
published-consumer and actual Daytona gates still prevent release qualification.
### 2026-10-08 local file delivery and native image preparation
The `af87a249c1` local `file-edit-validate` campaign passes all 11 matchers and
cleanup in 126.310 seconds, with one attempt and zero automatic retries. Hermes
creates and edits the workspace file, runs a real content verification command,
registers the deliverable and completes the task. Independent workspace and
downloaded artifact checks confirm exact bytes. Complete selected-account
OpenRouter billing settles at $0.006084928; the public $1 company and agent
budgets remain healthy. The final screenshot was inspected, and packaged
evidence has no leaks or missing entries. Persisted events include incremental
text and tools before the terminal receipt; this post-hoc timing observation
does not qualify live browser streaming or hidden reasoning display.
On the same source, cloud run `37830289657` passes nine native transport fixtures
and 38 pinned Python checks on each Mac arm64 and Linux amd64 target. The normal
PR CI run `37830289962` initially fails a five-second slow-CPU chat startup
expectation and loses its canary cloud runner to a shutdown signal. Both
original logs and the browser trace remain preserved. The single allowed
no-source-change failed-job retry succeeds; the latest workflow attempts pass.
Superseded duplicate automatic runs retain their cancellation records. No local
Docker or Rust build is used.
The separate explicit-only `hermes-image-input` suite prepares local and Daytona
image acceptance on an exact vision-capable OpenRouter candidate model. Its PNG
contains an undisclosed eight-character code only in pixels. Browser upload,
exact authorized download bytes, native semantic completion without file/OCR
tool substitution, selected-account billing and cleanup are independent gates.
The code is absent from model text and filenames. The existing text-only
DeepSeek profile and previous campaign grades remain unchanged. Credential-free
support checks pass 2,075 tests with one platform skip, all 128 native source
checks and Product E2E typechecking. Both exact image cells are discoverable;
the fixture PNG was visually inspected. These checks validate preparation;
a fresh committed-source live image run and current-head CI are required before
claiming that coverage.
The remaining full release matrix and actual Daytona proof still gate Hermes.
+12
View File
@@ -398,3 +398,15 @@ run PID/group/start identity supplies ownership for a read-only descendant
journal; observed owners must retire before cleanup and stay retired through it.
Cancelled-run cost settlement remains required. Remote Stop is a separate pending
gate and cannot pass from this local observation.
`hermes-image-input` adds one local and one Daytona image-code cell using a
separate vision-capable candidate profile. The existing UI helper uploads the
PNG before creating the assigned task. The code is an eight-character challenge
rendered only in pixels; prompt and filename disclose no answer. Independent
checks download the company/task-bound image and compare exact PNG bytes, MIME,
size and SHA-256. Native tool history allows only semantic completion, task
context, title and progress operations, rejecting file reads, shell/OCR and
image-analysis substitutes. The final marker must contain the pictured code
exactly once. The suite preserves selected-account attribution, settled reported
cost, bounded budgets, one attempt and verified cleanup. Declared remote coverage
is pending until the actual Daytona cell passes on a verified immutable image.
+28
View File
@@ -1651,6 +1651,34 @@ The separate Runner Evals `extended-harnesses` campaign lives in the private
`paperclip-evals` repository and grades semantic protocol behavior against the
mock control plane. Neither suite substitutes for the other.
### Hermes native image input (explicit-only)
`hermes-image-input` declares one local and one Daytona `image-code-complete`
cell. Its separate candidate profile uses `google/gemini-2.5-flash-lite` through
the selected managed OpenRouter account. The public model catalog reports image
input and tools; this metadata is preparation, not inference qualification.
The existing DeepSeek profile remains text-only.
The browser uploads a generated PNG in the ordinary task-creation flow. Its
eight-character hexadecimal code is present only in pixels, absent from the
prompt, filename and PNG text metadata. An exact native final response must
contain that undisclosed code once. Public attachment metadata and a downloaded
copy must match the independent source bytes, MIME type, size, company and task.
The durable run history must contain native semantic completion and no file,
OCR or image-analysis tool substitute. Explicit titles prevent an unrelated
automatic title-generation operation from preceding the image turn.
The suite reuses managed account attribution, pre-credential source/runtime
admission, bounded company/agent budgets, per-run reported billing and cleanup.
It admits one attempt with no automatic retry. Remote selection still requires
the verified immutable image and authorized Daytona credential. Neither target
is qualified by the fixture's unit tests or public model discovery.
```sh
pnpm test:e2e:runner -- --list --suite hermes-image-input
pnpm test:e2e:runner -- --id hermes-image-input.runner-acpx-hermes-vision.local.image-code-complete --max-automatic-retries 0
```
The explicit-only `confirmation-replies` suite also includes `unanswered-question-return` for native Claude and Codex (three provider turns). The browser asks a saved color question, dismisses and reopens the fresh form, sends an unrelated message, verifies the reply while the original stays pending, reloads, reopens the history entry, submits Blue, and verifies the saved answer plus a later agent acknowledgement. After dismissing the fresh form and before and after reload, the history card is the only pending-question reminder; the composer has no duplicate pending-input badge. It checks that no tasks were created. Unique, UI-ready screenshots show each checkpoint; individual checks are included in the report. This is a bounded mechanical workflow check, not broader semantic answer-quality qualification.
## Direct blocker guidance
+12
View File
@@ -366,3 +366,15 @@ The expired native question must retain its versioned cancellation receipt with
zero answers, bound to the original payload, card, company, task and source run.
A missing result, answer actor, changed payload or submitted answer fails the
oracle. Correcting this assertion does not regrade historical failed campaigns.
`hermes-image-input` uploads a synthetic, non-secret PNG through the ordinary
task creation UI. Its filename contains only the fixture nonce; no answer or
instruction is placed in PNG text metadata. The expected code stays in the
grader and is not sent in model text. Attachment downloads require the expected
company, task, MIME, bounded size and SHA-256 before reading bytes. Persisted
evidence retains sanitized metadata and independent content hashes, not an
unmarked raw image or provider payload. The existing final-state screenshot
policy still applies. Qualification is admitted only for explicit Hermes cells
and their selected exact model. The suite reuses the existing OpenRouter key
allocation and public company/agent budgets; it does not authorize another
secret, a paid retry, or unconfigured remote resource creation.
+3 -3
View File
@@ -146,10 +146,10 @@ describe("runner E2E catalog", () => {
expect(localIntegrityTasks).toHaveLength(2);
expect(openRouterBreadthTasks).toHaveLength(3);
expect(runnerSuites.map((suite) => suite.expectedMatrixSize)).toEqual([
63, 12, 6, 8, 2, 2, 2, 40, 3, 10, 2, 3, 16, 16, 2, 6, 8, 46, 23, 15, 52, 6, 6, 20, 26, 52, 28, 18, 2, 6, 6, 12, 10, 48, 16, 10, 2, 1, 1, 116,
63, 12, 6, 8, 2, 2, 2, 40, 3, 2, 10, 2, 3, 16, 16, 2, 6, 8, 46, 23, 15, 52, 6, 6, 20, 26, 52, 28, 18, 2, 6, 6, 12, 10, 48, 16, 10, 2, 1, 1, 116,
]);
expect(validateRunnerCatalog()).toHaveLength(723);
expect(new Set(runnerMatrix.map((entry) => entry.id)).size).toBe(723);
expect(validateRunnerCatalog()).toHaveLength(725);
expect(new Set(runnerMatrix.map((entry) => entry.id)).size).toBe(725);
expect(
runnerMatrix.filter((entry) => entry.suite.id === "core-compatibility"),
).toHaveLength(48);
+15 -1
View File
@@ -5,7 +5,7 @@ import { nativeCompletionProfile, NATIVE_COMPLETION_BUDGET_CENTS } from "./nativ
import { chatConfirmationTasks } from "./chat-cases.js";
import { buildConnectionSuite } from "./connection-cases.js";
import { hiringTemplateTasks, hiringTemplateProfile, hiringTemplateDefinitionDigest } from "./hiring-template-cases.js";
import { HERMES_API_CONNECTION_BUDGET_CENTS, HERMES_NATIVE_INTERACTION_SUITE, hermesApiConnectionChoices, hermesApiConnectionDefinitionDigest, hermesBedrockConnectionChoice, hermesNativeQuestionTask, hermesNativeQuestionStopTask } from "./hermes-api-connections.js";
import { HERMES_API_CONNECTION_BUDGET_CENTS, HERMES_NATIVE_INTERACTION_SUITE, HERMES_IMAGE_INPUT_SUITE, HERMES_IMAGE_INPUT_MODEL, hermesImageInputTask, hermesApiConnectionChoices, hermesApiConnectionDefinitionDigest, hermesBedrockConnectionChoice, hermesNativeQuestionTask, hermesNativeQuestionStopTask } from "./hermes-api-connections.js";
import { nativeActiveStopTasks } from "./native-active-stop-tasks.js";
import { cursorNativeTasks } from "./cursor-native-cases.js";
import { instructionPersistenceTask } from "./instruction-persistence.js";
@@ -1229,6 +1229,20 @@ export const runnerSuites: readonly RunnerSuiteFixture[] = [
remoteStopQualification: "pending-separate-remote-retirement-observer", sourceDigest: hermesApiConnectionDefinitionDigest,
},
},
{
id: HERMES_IMAGE_INPUT_SUITE, label: "Hermes native image input", manualOnly: true,
description: "An undisclosed image-only code passes through browser upload and the native Hermes prompt, with independent content and account checks.",
groups: ["native"], environments: runnerEnvironments, tasks: [hermesImageInputTask], expectedMatrixSize: 2,
profiles: [nativeProfile({
id: "runner-acpx-hermes-vision", label: "Hermes vision (candidate)", provider: "acpx", acpxAgent: "hermes",
qualificationCandidate: "hermes", credential: "OPENROUTER_API_KEY", model: HERMES_IMAGE_INPUT_MODEL,
modelQualification: { source: "candidate_runner_profile", qualificationId: "hermes:v2026.9.24:openrouter:gemini-2.5-flash-lite:vision:catalog-2026-10-08:pending" },
})],
definitionMetadata: { version: 1, qualification: "pending", scheduling: "explicit-only", providerTurns: 1,
maximumAttemptsPerCell: 1, budgetMonthlyCents: HERMES_API_CONNECTION_BUDGET_CENTS, lifecycle: "per-turn",
input: "browser-upload-authorized-native-image", oracle: "undisclosed-pixel-code-exact-bytes-no-file-tools",
billing: "per-run-reported-cost-and-budget-health", sourceDigest: hermesApiConnectionDefinitionDigest },
},
{
id: "hermes-api-connections", label: "Hermes managed API connections", manualOnly: true,
description: "One native browser task per exact model using an independently selected managed API account; catalog discovery is not inference proof.",
+1 -1
View File
@@ -116,7 +116,7 @@ export function buildRunnerE2EProcessEnvironment(
const agent = execution.profile.qualificationCandidate;
if (!agent || agent === "cursor") continue;
const admittedSuite = execution.suite.id === "extended-harnesses"
|| (["hermes-api-connections", "hermes-bedrock-connections", "hermes-native-interactions"].includes(execution.suite.id) && agent === "hermes")
|| (["hermes-api-connections", "hermes-bedrock-connections", "hermes-native-interactions", "hermes-image-input"].includes(execution.suite.id) && agent === "hermes")
|| execution.suite.id === "rich-acp-warm-continuity";
if (!admittedSuite || !execution.suite.manualOnly) {
throw new Error("Candidate qualification requires an explicit provider qualification suite");
@@ -3,7 +3,85 @@ import { runnerMatrix, runnerSuites, suiteDefinitionHash } from "./catalog.js";
import { buildMatrixJobs, parseRunnerSelectors, selectRunnerExecutions } from "./selectors.js";
import { buildRunnerE2EProcessEnvironment } from "./harness-env.js";
import { explicitlyRequestsFileOutput, explicitlyRequestsTaskDocumentOutput } from "../../server/src/services/native-runtime/native-deliverable-feedback.js";
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection, isHermesOpenRouterWorkflow, isHermesConnectionSuite, HERMES_NATIVE_INTERACTION_SUITE, hasExactHermesNativeQuestionResponse, hasHermesNativeQuestionBatch, hermesNativeAnswerText, hasHermesNativeQuestionStop, hasHermesNativeQuestionStopCard, resolveHermesQualificationBudgetCents } from "./hermes-api-connections.js";
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection, isHermesOpenRouterWorkflow, isHermesConnectionSuite, HERMES_NATIVE_INTERACTION_SUITE, hasExactHermesNativeQuestionResponse, hasHermesNativeQuestionBatch, hermesNativeAnswerText, hasHermesNativeQuestionStop, hasHermesNativeQuestionStopCard, resolveHermesQualificationBudgetCents, HERMES_IMAGE_INPUT_SUITE, HERMES_IMAGE_INPUT_MODEL, hermesImageChallenge, gradeHermesImageInput } from "./hermes-api-connections.js";
import { inflateSync } from "node:zlib";
describe("Hermes native image input", () => {
const suite = runnerSuites.find(s => s.id === HERMES_IMAGE_INPUT_SUITE)!;
const cells = runnerMatrix.filter(e => e.suite.id === suite.id);
it("declares one bounded image journey per execution target on a separate vision model", () => {
expect(cells).toHaveLength(2);
expect(new Set(cells.map(c => c.environment.id))).toEqual(new Set(["local", "daytona"]));
expect(suite.manualOnly).toBe(true);
expect(isHermesConnectionSuite(suite.id)).toBe(true);
expect(cells.every(c => c.profile.model === HERMES_IMAGE_INPUT_MODEL && c.profile.credential === "OPENROUTER_API_KEY"
&& c.profile.qualificationCandidate === "hermes" && c.task.expectedRunCount === 1 && c.task.automaticRetryPolicy === "single_attempt")).toBe(true);
expect(selectRunnerExecutions(parseRunnerSelectors(["--all"])).some(c => c.suite.id === suite.id)).toBe(false);
const env = buildRunnerE2EProcessEnvironment({}, [cells[0]!]);
expect(JSON.parse(env.PAPERCLIP_RUNNER_ACPX_QUALIFICATION!)).toEqual([{ agent: "hermes", model: HERMES_IMAGE_INPUT_MODEL }]);
expect(() => buildRunnerE2EProcessEnvironment({}, [{ ...cells[0]!, suite: { ...suite, manualOnly: false } }])).toThrow("explicit");
expect(() => buildRunnerE2EProcessEnvironment({}, [{ ...cells[0]!, profile: { ...cells[0]!.profile, qualificationCandidate: "pi" } }])).toThrow("explicit");
expect(suite.definitionMetadata).toMatchObject({ version: 1, qualification: "pending", providerTurns: 1,
maximumAttemptsPerCell: 1, budgetMonthlyCents: 200 });
});
it("keeps the expected code out of prompt, filename and PNG metadata", () => {
const image = hermesImageChallenge("image-fixture");
expect(image.code).toMatch(/^[A-F0-9]{8}$/);
expect(cells[0]!.task.buildPrompt("image-fixture")).not.toContain(image.code);
expect(image.filename).not.toContain(image.code);
expect(image.bytes.includes(Buffer.from(image.code))).toBe(false);
expect(explicitlyRequestsFileOutput(cells[0]!.task.buildPrompt("image-fixture"))).toBe(false);
expect(explicitlyRequestsTaskDocumentOutput(cells[0]!.task.buildPrompt("image-fixture"))).toBe(false);
expect(image.bytes.subarray(0, 8).toString("hex")).toBe("89504e470d0a1a0a");
const chunks: { name: string; body: Buffer }[] = [];
for (let at = 8; at < image.bytes.length;) {
const size = image.bytes.readUInt32BE(at);
chunks.push({ name: image.bytes.subarray(at + 4, at + 8).toString(), body: image.bytes.subarray(at + 8, at + 8 + size) });
at += size + 12;
}
expect(chunks.map(c => c.name)).toEqual(["IHDR", "IDAT", "IEND"]);
expect(chunks[0]!.body.readUInt32BE(0)).toBe(640);
expect(chunks[0]!.body.readUInt32BE(4)).toBe(180);
const pixels = inflateSync(chunks[1]!.body);
expect(pixels.length).toBe((640 * 3 + 1) * 180);
expect(pixels.subarray(1, 640 * 3 + 1).every(byte => byte === 255)).toBe(true);
expect(pixels.filter(byte => byte === 0).length).toBeGreaterThan(10_000);
expect(hermesImageChallenge("image-fixture").bytes).toEqual(image.bytes);
expect(hermesImageChallenge("different-fixture").bytes).not.toEqual(image.bytes);
});
const evidence = () => {
const image = hermesImageChallenge("image-fixture");
return { nonce: "image-fixture", companyId: "company", issueId: "task", runId: "run", downloadedBytes: image.bytes,
attachments: [{ id: "attachment", companyId: "company", issueId: "task", originalFilename: image.filename,
contentType: "image/png", byteSize: image.bytes.length, sha256: image.sha256 }],
events: [{ runId: "run", eventType: "tool.execution.started", payload: { prpEvent: {
schema: "paperclip.prp.event.v1", runId: "run", sourceKind: "runner", sourceInstanceId: "runner", normalizedSessionId: "session",
payload: { name: "paperclip_finish", namespace: "paperclip" },
} } }],
};
};
it("accepts independently downloaded matching bytes with native semantic completion", () => {
expect(gradeHermesImageInput(evidence()).every(c => c.passed)).toBe(true);
});
it.each(["companyId", "issueId", "originalFilename", "contentType", "sha256"])("rejects an image with the wrong %s", key => {
const input = evidence(); Object.assign(input.attachments[0]!, { [key]: "different" });
expect(gradeHermesImageInput(input).every(c => c.passed)).toBe(false);
});
it.each(["missing", "duplicate", "size", "bytes", "no-tools", "file-tool", "foreign-run", "foreign-native-run", "no-runner", "no-session"])("rejects %s evidence", variant => {
const input = evidence();
if (variant === "missing") input.attachments = [];
if (variant === "duplicate") input.attachments.push({ ...input.attachments[0]! });
if (variant === "size") input.attachments[0]!.byteSize++;
if (variant === "bytes") input.downloadedBytes = Buffer.from("not the image");
if (variant === "no-tools") input.events = [];
if (variant === "file-tool") input.events[0]!.payload.prpEvent.payload.name = "read_task_attachment";
if (variant === "foreign-run") input.events[0]!.runId = "foreign";
if (variant === "foreign-native-run") input.events[0]!.payload.prpEvent.runId = "foreign";
if (variant === "no-runner") input.events[0]!.payload.prpEvent.sourceInstanceId = "";
if (variant === "no-session") input.events[0]!.payload.prpEvent.normalizedSessionId = "";
expect(gradeHermesImageInput(input).every(c => c.passed)).toBe(false);
});
});
const settings = vi.hoisted(() => ({ contents: undefined as string | undefined }));
vi.mock("node:fs", async importOriginal => {
+101 -1
View File
@@ -1,6 +1,7 @@
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
import { isDeepStrictEqual } from "node:util";
import { deflateSync } from "node:zlib";
import type { AiProviderRouting } from "../../packages/shared/src/ai-provider-routing.js";
import { hasAcpxNativeOrigin } from "./acpx-native-origin.js";
import type { Page } from "@playwright/test";
@@ -48,8 +49,11 @@ function captureHermesQualificationBudgetCents(): number {
}
export const HERMES_API_CONNECTION_BUDGET_CENTS = captureHermesQualificationBudgetCents();
export const HERMES_NATIVE_INTERACTION_SUITE = "hermes-native-interactions";
export const HERMES_IMAGE_INPUT_SUITE = "hermes-image-input";
export const HERMES_IMAGE_INPUT_MODEL = "google/gemini-2.5-flash-lite";
export const isHermesConnectionSuite = (suiteId: string) =>
suiteId === "hermes-api-connections" || suiteId === "hermes-bedrock-connections" || suiteId === HERMES_NATIVE_INTERACTION_SUITE;
suiteId === "hermes-api-connections" || suiteId === "hermes-bedrock-connections"
|| suiteId === HERMES_NATIVE_INTERACTION_SUITE || suiteId === HERMES_IMAGE_INPUT_SUITE;
export const isHermesOpenRouterWorkflow = (execution: {
suite: { id: string }; profile: { qualificationCandidate?: string; credential: string };
}) => execution.suite.id === "extended-harnesses"
@@ -102,6 +106,102 @@ export const hermesNativeQuestionStopTask: RunnerTaskFixture = {
],
};
/** An undisclosed code exists only in PNG pixels, never in the filename or prompt. */
export function hermesImageChallenge(nonce: string) {
const code = createHash("sha256").update(`hermes-image-pixels:${nonce}`).digest("hex").slice(0, 8).toUpperCase();
const glyphs: Record<string, readonly string[]> = {
"0": ["01110", "10001", "10011", "10101", "11001", "10001", "01110"],
"1": ["00100", "01100", "00100", "00100", "00100", "00100", "01110"],
"2": ["01110", "10001", "00001", "00010", "00100", "01000", "11111"],
"3": ["11110", "00001", "00001", "01110", "00001", "00001", "11110"],
"4": ["00010", "00110", "01010", "10010", "11111", "00010", "00010"],
"5": ["11111", "10000", "10000", "11110", "00001", "00001", "11110"],
"6": ["01110", "10000", "10000", "11110", "10001", "10001", "01110"],
"7": ["11111", "00001", "00010", "00100", "01000", "01000", "01000"],
"8": ["01110", "10001", "10001", "01110", "10001", "10001", "01110"],
"9": ["01110", "10001", "10001", "01111", "00001", "00001", "01110"],
A: ["01110", "10001", "10001", "11111", "10001", "10001", "10001"],
B: ["11110", "10001", "10001", "11110", "10001", "10001", "11110"],
C: ["01111", "10000", "10000", "10000", "10000", "10000", "01111"],
D: ["11110", "10001", "10001", "10001", "10001", "10001", "11110"],
E: ["11111", "10000", "10000", "11110", "10000", "10000", "11111"],
F: ["11111", "10000", "10000", "11110", "10000", "10000", "10000"],
};
const width = 640, height = 180, scale = 12;
const pixels = Buffer.alloc((width * 3 + 1) * height, 255);
for (let y = 0; y < height; y++) pixels[y * (width * 3 + 1)] = 0;
[...code].forEach((character, index) => glyphs[character]!.forEach((row, y) => {
[...row].forEach((value, x) => {
if (value !== "1") return;
for (let dy = 0; dy < scale; dy++) for (let dx = 0; dx < scale; dx++) {
const offset = (48 + y * scale + dy) * (width * 3 + 1) + 1 + (38 + index * 6 * scale + x * scale + dx) * 3;
pixels.fill(0, offset, offset + 3);
}
});
}));
const chunk = (type: string, body: Buffer) => {
const payload = Buffer.concat([Buffer.from(type), body]);
let crc = 0xffffffff;
for (const byte of payload) {
crc ^= byte;
for (let bit = 0; bit < 8; bit++) crc = (crc >>> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
}
const length = Buffer.alloc(4), checksum = Buffer.alloc(4);
length.writeUInt32BE(body.length); checksum.writeUInt32BE((crc ^ 0xffffffff) >>> 0);
return Buffer.concat([length, payload, checksum]);
};
const header = Buffer.alloc(13); header.writeUInt32BE(width); header.writeUInt32BE(height, 4);
header[8] = 8; header[9] = 2;
const bytes = Buffer.concat([Buffer.from("89504e470d0a1a0a", "hex"), chunk("IHDR", header), chunk("IDAT", deflateSync(pixels)), chunk("IEND", Buffer.alloc(0))]);
return { code, bytes, filename: `hermes-image-${nonce}.png`, sha256: createHash("sha256").update(bytes).digest("hex") };
}
export const hermesImageInputTask: RunnerTaskFixture = {
id: "image-code-complete", label: "Read an uploaded image through native prompt content",
groups: ["native"], workMode: "standard", flow: "single_turn", expectedRunCount: 1,
automaticRetryPolicy: "single_attempt", attemptTimeoutMs: { local: 240_000, daytona: 360_000 },
expectedTerminalState: { issue: "done", run: "succeeded" },
buildTitle: nonce => `Read the attached Hermes image ${nonce}`,
buildPrompt: nonce => [
"Read the eight uppercase hexadecimal characters pictured in the attached image directly from the image input.",
"Do not read, decode or analyze the image with a tool. Do not guess the characters. Do not create files or plans. If you cannot see the image, report that limitation without claiming completion.",
`Form the completion summary as HERMES-IMAGE-${nonce}-<exact pictured characters>. The pictured code is not provided in this prompt.`,
"Call paperclip_finish with reportedWorkDisposition done, that computed summary, the current completion contract revision and satisfied objective criterion, no remaining work, and verification describing the image reading. Wait for acceptance, then emit only that exact summary as your final answer.",
].join("\n"),
buildVisibleMarker: nonce => `HERMES-IMAGE-${nonce}-${hermesImageChallenge(nonce).code}`,
buildMatchers: (nonce, execution) => [
{ kind: "message_exact", expected: `HERMES-IMAGE-${nonce}-${hermesImageChallenge(nonce).code}` },
{ kind: "message_occurrences", expected: `HERMES-IMAGE-${nonce}-${hermesImageChallenge(nonce).code}`, count: 1 },
{ kind: "issue_status", expected: "done" }, { kind: "run_status", expected: "succeeded" },
{ kind: "runtime_mode", expected: "native" }, { kind: "environment", expected: execution.environment.id },
],
};
/** Wrong scope/bytes or a tool-based substitute cannot qualify native image input. */
export function gradeHermesImageInput(input: {
nonce: string; companyId: string; issueId: string; runId: string;
attachments: readonly unknown[]; downloadedBytes: Buffer; events: readonly unknown[];
}) {
const expected = hermesImageChallenge(input.nonce), attachment = record(input.attachments[0]);
const tools = input.events.map(record).filter(row => row.eventType === "tool.execution.started")
.map(row => ({ row, event: record(record(row.payload).prpEvent) }));
const allowed = new Set(["paperclip_finish", "get_task_context", "set_task_title", "report_progress"]);
return [
{ id: "one-authorized-image", passed: present(input.companyId) && present(input.issueId)
&& input.attachments.length === 1 && present(attachment.id) && attachment.companyId === input.companyId
&& attachment.issueId === input.issueId && attachment.originalFilename === expected.filename
&& attachment.contentType === "image/png" && attachment.byteSize === expected.bytes.length && attachment.sha256 === expected.sha256 },
{ id: "uploaded-image-bytes", passed: input.downloadedBytes.equals(expected.bytes)
&& createHash("sha256").update(input.downloadedBytes).digest("hex") === expected.sha256 },
{ id: "native-image-without-file-tool-substitution", passed: present(input.runId) && tools.length > 0
&& tools.some(({ event }) => record(event.payload).name === "paperclip_finish")
&& tools.every(({ row, event }) => row.runId === input.runId && event.schema === "paperclip.prp.event.v1"
&& event.runId === input.runId && event.sourceKind === "runner" && present(event.sourceInstanceId)
&& present(event.normalizedSessionId) && record(event.payload).namespace === "paperclip"
&& allowed.has(String(record(event.payload).name))) },
];
}
/** Preserve the pinned native form; semantic tools cannot satisfy this oracle. */
export function hasHermesNativeQuestionBatch(value: unknown): boolean {
const set = record(value), questions = Array.isArray(set.questions) ? set.questions.map(record) : [];
+27 -2
View File
@@ -1,5 +1,5 @@
import { runPlanTaskFlow } from "./plan-task-flow.js";
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection, isHermesConnectionSuite, isHermesOpenRouterWorkflow, hasExactHermesNativeQuestionResponse, hasHermesNativeQuestionBatch, hermesNativeAnswerText, runHermesNativeQuestionStop } from "./hermes-api-connections.js";
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection, isHermesConnectionSuite, isHermesOpenRouterWorkflow, hasExactHermesNativeQuestionResponse, hasHermesNativeQuestionBatch, hermesNativeAnswerText, runHermesNativeQuestionStop, HERMES_IMAGE_INPUT_SUITE, hermesImageChallenge, gradeHermesImageInput } from "./hermes-api-connections.js";
import { hasAcpxNativeOrigin } from "./acpx-native-origin.js";
import { isDeepStrictEqual } from "node:util";
import { assertNativeCompletionSelection, NATIVE_COMPLETION_PREFLIGHT_ENV, verifyNativeCompletionPreflight } from "./native-completion-admission.js";
@@ -1168,6 +1168,9 @@ for (const execution of executions) {
{ timeout: Math.max(1, startedAtMs + deadlineMs - Date.now()) })
.catch((cause: unknown) => new Error("Could not capture task creation response", { cause }))
: null;
const imageChallenge = execution.suite.id === HERMES_IMAGE_INPUT_SUITE ? hermesImageChallenge(nonce) : null;
const imagePath = imageChallenge ? path.join(temporaryRoot, imageChallenge.filename) : null;
if (imagePath && imageChallenge) await writeFile(imagePath, imageChallenge.bytes, { flag: "wx", mode: 0o600 });
const createdTask = await createTaskThroughUi({
page,
issuePrefix,
@@ -1176,7 +1179,8 @@ for (const execution of executions) {
prompt,
workMode: execution.task.workMode,
projectName: fixtures.project?.name,
requireExplicitTitle: execution.suite.id === "task-titles" && Boolean(title),
requireExplicitTitle: (execution.suite.id === "task-titles" && Boolean(title)) || Boolean(imageChallenge),
...(imagePath ? { attachments: [imagePath] } : {}),
});
turnSubmissionTimesMs.push(createdTask.submittedAtMs);
@@ -3013,6 +3017,27 @@ for (const execution of executions) {
}
if (isHermesConnectionSuite(execution.suite.id)) {
if (!fixtures?.aiConnection || !issue?.id || !hermesApiAccountOwner?.expectedResponsibleUserId) throw new Error("Hermes connection qualification is missing its selected account, expected user or task");
if (execution.suite.id === HERMES_IMAGE_INPUT_SUITE) {
const attachments = await api.get<Record<string, unknown>[]>(`/api/issues/${issue.id}/attachments`);
const image = attachments[0];
const expectedImage = hermesImageChallenge(nonce);
let downloadedBytes: Buffer = Buffer.alloc(0);
if (attachments.length === 1 && typeof image?.id === "string" && image.companyId === fixtures.company.id
&& image.issueId === issue.id && image.contentType === "image/png"
&& image.byteSize === expectedImage.bytes.length && image.sha256 === expectedImage.sha256) {
const response = await api.request.get(`/api/attachments/${encodeURIComponent(image.id)}/content`);
if (response.ok()) downloadedBytes = await response.body();
}
const events = selectedRuns.length === 1 ? await collectRunEvents<RunEventRecord>((afterSeq, limit) =>
api.get(`/api/heartbeat-runs/${selectedRuns[0]!.id}/events?afterSeq=${afterSeq}&limit=${limit}`)) : [];
const imageChecks = gradeHermesImageInput({ nonce, companyId: fixtures.company.id, issueId: issue.id,
runId: selectedRuns[0]?.id ?? "", attachments, downloadedBytes, events });
matcherResults.push(...imageChecks.map(check => ({ matcher: { kind: "json_path" as const, path: `hermesImage.${check.id}`, expected: true },
passed: check.passed, detail: "The authorized uploaded image must match its source bytes and be read without a file-tool substitute." })));
await writeSanitizedJson(snapshotsDir, "hermes-image-input.json", { attachments,
downloadedByteSize: downloadedBytes.length, downloadedSha256: createHash("sha256").update(downloadedBytes).digest("hex"),
checks: imageChecks, oracle: "undisclosed-image-pixels-and-independent-authorized-download" }, secrets);
}
const expectedRunStatus = execution.task.flow === "native_question_stop" ? "cancelled" : "succeeded";
const checks = gradeHermesApiConnection({ companyId: fixtures.company.id, agentId: fixtures.agent.id,
issueId: issue.id, connectionId: fixtures.aiConnection.connectionId, provider: fixtures.aiConnection.binding.provider,