mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 03:36:57 +01:00
fix(hermes): retain usage after input-yield shutdown
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
391e56d8a0
commit
ef1c8d805b
21 files changed
+319
-12
No files matched your search
@@ -1478,6 +1478,13 @@ need their separate conformance/qualification evidence.
|
||||
Hermes uses an existing managed OpenRouter connection through the ordinary
|
||||
connection fixture. It remains pending qualification; the native transport
|
||||
fixture does not substitute for these browser and remote workflows.
|
||||
The ten Hermes/OpenRouter cells set 200-cent company and agent budgets and
|
||||
verify them through public reads before creating work. Before cleanup, every
|
||||
run, including a run that yields for human input, must have settled reported
|
||||
wire cost and healthy budget state. The per-run receipts are retained in
|
||||
`hermes-openrouter-workflow-settlement.json`; `api-state.json` also retains all
|
||||
selected runs. Extended-harnesses definition version 2 records this stronger
|
||||
oracle. Older behavioral passes do not prove this accounting requirement.
|
||||
|
||||
Before loading local credentials, the launcher records the checked-out controller
|
||||
SHA and ref for every selected Hermes candidate, including API and Bedrock cells.
|
||||
|
||||
@@ -1210,7 +1210,8 @@ export const runnerSuites: readonly RunnerSuiteFixture[] = [
|
||||
groups: ["native"], profiles: extendedHarnessProfiles, environments: runnerEnvironments,
|
||||
tasks: [...openRouterBreadthTasks, localIntegrityTasks[1]!, extendedHarnessFileTask],
|
||||
expectedMatrixSize: 40,
|
||||
definitionMetadata: { version: 1, qualification: "pending", scheduling: "explicit-only", admission: "host-exact-candidate-and-model", authenticatedDiscoveryDate: "2026-09-28" },
|
||||
definitionMetadata: { version: 2, qualification: "pending", scheduling: "explicit-only", admission: "host-exact-candidate-and-model", authenticatedDiscoveryDate: "2026-09-28",
|
||||
hermesBilling: "per-run-reported-cost-and-budget-health", hermesBudgetMonthlyCents: 200, hermesSettlementSourceDigest: hermesApiConnectionDefinitionDigest },
|
||||
},
|
||||
{
|
||||
id: "hermes-api-connections", label: "Hermes managed API connections", manualOnly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { runnerMatrix, runnerSuites, suiteDefinitionHash } from "./catalog.js";
|
||||
import { buildMatrixJobs, parseRunnerSelectors, selectRunnerExecutions } from "./selectors.js";
|
||||
import { buildRunnerE2EProcessEnvironment } from "./harness-env.js";
|
||||
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection } from "./hermes-api-connections.js";
|
||||
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection, isHermesOpenRouterWorkflow } from "./hermes-api-connections.js";
|
||||
|
||||
describe("Hermes managed API connection qualification", () => {
|
||||
const suite = runnerSuites.find(s => s.id === "hermes-api-connections")!;
|
||||
@@ -15,6 +15,16 @@ describe("Hermes managed API connection qualification", () => {
|
||||
expect(suite.definitionMetadata).toMatchObject({ qualification: "pending", accountMethod: "api_key", accountMode: "responsible_user", coverage: "api-account-native-completion-only", budgetMonthlyCents: 200, maximumAttemptsPerCell: 1 });
|
||||
expect(selectRunnerExecutions(parseRunnerSelectors(["--all"])).some(e => e.suite.id === suite.id)).toBe(false);
|
||||
});
|
||||
it("requires accounting for every Hermes OpenRouter product workflow without widening other provider cells", () => {
|
||||
const workflow = runnerMatrix.filter(isHermesOpenRouterWorkflow);
|
||||
expect(workflow).toHaveLength(10);
|
||||
expect(new Set(workflow.map(cell => cell.task.id))).toEqual(new Set([
|
||||
"hello-complete", "question-resume-complete", "plan-approve-complete", "structured-question-restart-resume", "file-edit-validate",
|
||||
]));
|
||||
expect(workflow.every(cell => cell.suite.definitionMetadata?.hermesBudgetMonthlyCents === 200)).toBe(true);
|
||||
expect(isHermesOpenRouterWorkflow({ ...workflow[0]!, profile: { ...workflow[0]!.profile, qualificationCandidate: "cursor" } })).toBe(false);
|
||||
expect(isHermesOpenRouterWorkflow({ ...workflow[0]!, profile: { ...workflow[0]!.profile, credential: "ANTHROPIC_API_KEY" } })).toBe(false);
|
||||
});
|
||||
it.each([
|
||||
["XAI_API_KEY", "grok-4.7"],
|
||||
["GEMINI_API_KEY", "gemini-3.8-flash"],
|
||||
|
||||
@@ -10,6 +10,10 @@ const present = (value: unknown) => typeof value === "string" && value.trim().le
|
||||
export const HERMES_API_CONNECTION_BUDGET_CENTS = 200;
|
||||
export const isHermesConnectionSuite = (suiteId: string) =>
|
||||
suiteId === "hermes-api-connections" || suiteId === "hermes-bedrock-connections";
|
||||
export const isHermesOpenRouterWorkflow = (execution: {
|
||||
suite: { id: string }; profile: { qualificationCandidate?: string; credential: string };
|
||||
}) => execution.suite.id === "extended-harnesses"
|
||||
&& execution.profile.qualificationCandidate === "hermes" && execution.profile.credential === "OPENROUTER_API_KEY";
|
||||
export const hermesBedrockConnectionChoice = {
|
||||
credential: "AWS_BEARER_TOKEN_BEDROCK",
|
||||
model: "us.anthropic.claude-haiku-4-5-20251001-v1:0",
|
||||
|
||||
@@ -97,6 +97,7 @@ describe("live runner fixtures", () => {
|
||||
["runner-acpx-hermes-api-openai", "hermes-api-connections", "hello-complete"],
|
||||
["runner-acpx-hermes-api-xai", "hermes-api-connections", "hello-complete"],
|
||||
["runner-acpx-hermes-api-google", "hermes-api-connections", "hello-complete"],
|
||||
["runner-acpx-hermes", "extended-harnesses", "question-resume-complete"],
|
||||
["runner-acpx-hermes-bedrock", "hermes-bedrock-connections", "hello-complete"],
|
||||
["runner-codex", "hiring-templates", "hire-coder-template-reuse"],
|
||||
["runner-acpx-claude", "hiring-templates", "hire-coder-template-reuse"],
|
||||
@@ -161,7 +162,7 @@ describe("live runner fixtures", () => {
|
||||
},
|
||||
});
|
||||
expect(connected).toBe(true);
|
||||
if (["hermes-api-connections", "hermes-bedrock-connections"].includes(suite)) {
|
||||
if (["hermes-api-connections", "hermes-bedrock-connections"].includes(suite) || profile === "runner-acpx-hermes") {
|
||||
expect(companyBody.budgetMonthlyCents).toBe(200);
|
||||
expect(agentBody.budgetMonthlyCents).toBe(200);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NATIVE_COMPLETION_BUDGET_CENTS } from "./native-completion-defaults.js";
|
||||
import { HERMES_API_CONNECTION_BUDGET_CENTS, isHermesConnectionSuite } from "./hermes-api-connections.js";
|
||||
import { HERMES_API_CONNECTION_BUDGET_CENTS, isHermesConnectionSuite, isHermesOpenRouterWorkflow } from "./hermes-api-connections.js";
|
||||
import type { AiConnectionBinding } from "../../packages/shared/src/ai-connections.js";
|
||||
import path from "node:path";
|
||||
import { installedReleaseDaytonaPlugin } from "./installed-release.js";
|
||||
@@ -137,7 +137,7 @@ export async function setupLiveFixtures(input: {
|
||||
return api.post<CompanyRecord>("/api/companies", {
|
||||
name: `Runner E2E ${execution.id} ${input.executionNonce}`,
|
||||
description: "Ephemeral paid full-stack runner acceptance fixture",
|
||||
budgetMonthlyCents: isHermesConnectionSuite(execution.suite.id) ? HERMES_API_CONNECTION_BUDGET_CENTS
|
||||
budgetMonthlyCents: isHermesConnectionSuite(execution.suite.id) || isHermesOpenRouterWorkflow(execution) ? HERMES_API_CONNECTION_BUDGET_CENTS
|
||||
: ["native-completion", "native-instruction-consolidation", "native-connection-guidance"].includes(execution.suite.id)
|
||||
|| (execution.suite.id === "everyday-workflows" && ["hire-reuse", "delegate-feedback"].includes(execution.task.id)) ? NATIVE_COMPLETION_BUDGET_CENTS
|
||||
: execution.suite.id === "task-titles" ? TASK_TITLE_BUDGET_CENTS
|
||||
@@ -306,7 +306,7 @@ export async function setupLiveFixtures(input: {
|
||||
|| (execution.suite.id === "everyday-workflows" && ["hire-reuse", "delegate-feedback"].includes(execution.task.id))) {
|
||||
agent.budgetMonthlyCents = 1_000;
|
||||
}
|
||||
if (isHermesConnectionSuite(execution.suite.id)) agent.budgetMonthlyCents = HERMES_API_CONNECTION_BUDGET_CENTS;
|
||||
if (isHermesConnectionSuite(execution.suite.id) || isHermesOpenRouterWorkflow(execution)) agent.budgetMonthlyCents = HERMES_API_CONNECTION_BUDGET_CENTS;
|
||||
if (managedHiring) {
|
||||
const account = value<ManagedAccountFixture>(resolved, "ai-connection");
|
||||
const config = agent.adapterConfig as Record<string, unknown>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { runPlanTaskFlow } from "./plan-task-flow.js";
|
||||
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection, isHermesConnectionSuite } from "./hermes-api-connections.js";
|
||||
import { captureHermesApiAccountOwner, captureHermesApiBudgets, captureHermesOpenRouterSettlement, gradeHermesApiConnection, isHermesConnectionSuite, isHermesOpenRouterWorkflow } from "./hermes-api-connections.js";
|
||||
import { assertNativeCompletionSelection, NATIVE_COMPLETION_PREFLIGHT_ENV, verifyNativeCompletionPreflight } from "./native-completion-admission.js";
|
||||
import { assertNativeInstructionSelection, verifyNativeInstructionPreflight, NATIVE_INSTRUCTION_PREFLIGHT_ENV, NATIVE_INSTRUCTION_SUITE, NATIVE_INSTRUCTION_DEFAULT_SHA256 } from "./native-instruction-consolidation.js";
|
||||
import { captureNativeDefault, gradeNativeDefault, nativeCompletionWorkspaceDigest } from "./native-completion-defaults.js";
|
||||
@@ -907,6 +907,11 @@ for (const execution of executions) {
|
||||
await writeSanitizedJson(snapshotsDir, "hermes-api-budgets-before-execution.json", receipt, secrets);
|
||||
if (!receipt.checks.every(check => check.passed)) throw new Error("Hermes API budgets failed admission before task creation");
|
||||
}
|
||||
if (isHermesOpenRouterWorkflow(execution)) {
|
||||
const receipt = await captureHermesApiBudgets({ api, companyId: fixtures.company.id, agentId: fixtures.agent.id });
|
||||
await writeSanitizedJson(snapshotsDir, "hermes-workflow-budgets-before-execution.json", receipt, secrets);
|
||||
if (!receipt.checks.every(check => check.passed)) throw new Error("Hermes workflow budgets failed admission before task creation");
|
||||
}
|
||||
if (["native-completion", NATIVE_INSTRUCTION_SUITE].includes(execution.suite.id)) {
|
||||
const receipt = await captureNativeDefault({ api, agentId: fixtures.agent.id, companyId: fixtures.company.id });
|
||||
const grade = gradeNativeDefault(receipt, execution.suite.id === NATIVE_INSTRUCTION_SUITE ? NATIVE_INSTRUCTION_DEFAULT_SHA256 : undefined);
|
||||
@@ -2707,6 +2712,7 @@ for (const execution of executions) {
|
||||
{
|
||||
issue,
|
||||
run,
|
||||
runs: selectedRuns,
|
||||
comments: terminal.comments,
|
||||
interactions: terminal.interactions,
|
||||
planLifecycleEvidence,
|
||||
@@ -2916,6 +2922,22 @@ for (const execution of executions) {
|
||||
await writeSanitizedJson(snapshotsDir, "hermes-api-connection.json", { checks }, secrets);
|
||||
expect(checks.every(check => check.passed), "Hermes managed account and native model attribution").toBe(true);
|
||||
}
|
||||
if (isHermesOpenRouterWorkflow(execution)) {
|
||||
let receipts: Array<Awaited<ReturnType<typeof captureHermesOpenRouterSettlement>>> = [];
|
||||
try {
|
||||
await expect.poll(async () => {
|
||||
receipts = await Promise.all(selectedRuns.map(run => captureHermesOpenRouterSettlement({ api,
|
||||
companyId: fixtures!.company.id, agentId: fixtures!.agent.id, issueId: issue!.id, runId: run.id })));
|
||||
return receipts.length === selectedRuns.length && receipts.every(receipt => receipt.checks.every(check => check.passed));
|
||||
}, { timeout: 30_000, message: "Every Hermes workflow run must settle reported cost and retain budget health before cleanup" }).toBe(true);
|
||||
} finally {
|
||||
await writeSanitizedJson(snapshotsDir, "hermes-openrouter-workflow-settlement.json", { receipts }, secrets);
|
||||
matcherResults.push(...receipts.flatMap((receipt, index) => receipt.checks.map(check => ({
|
||||
matcher: { kind: "json_path" as const, path: `hermesBilling.run${index + 1}.${check.id}`, expected: true }, passed: check.passed,
|
||||
detail: "Each public run, including input-yield runs, must have settled reported cost and healthy budgets before teardown.",
|
||||
}))));
|
||||
}
|
||||
}
|
||||
if (runsCompletionUpdateProbe(execution) && credentials.OPENAI_API_KEY) {
|
||||
const qualification = completionQualityStatus(completionQuality);
|
||||
if (qualification === "unqualified") {
|
||||
|
||||
Reference in new issue
Block a user