From 0b47626131659fb4401ce7cf3f152c7184cff7e6 Mon Sep 17 00:00:00 2001 From: Dotta Date: Fri, 9 Oct 2026 02:14:38 -0500 Subject: [PATCH] fix(hermes): keep native account probes on their harness Co-Authored-By: Paperclip --- .../agent-test-environment-routes.test.ts | 27 +++++++++++++++++++ server/src/routes/agents.ts | 8 ++++++ 2 files changed, 35 insertions(+) diff --git a/server/src/__tests__/agent-test-environment-routes.test.ts b/server/src/__tests__/agent-test-environment-routes.test.ts index 2c2499e4f34..6951f9a44ee 100644 --- a/server/src/__tests__/agent-test-environment-routes.test.ts +++ b/server/src/__tests__/agent-test-environment-routes.test.ts @@ -511,6 +511,33 @@ describe("agent test-environment route", () => { } }); + it("keeps native Hermes account qualification pending without probing another harness", async () => { + mockManagedRuntime("subscription"); + const { registerServerAdapter, getServerAdapter, unregisterServerAdapter } = await import("../adapters/index.js"); + const previous = getServerAdapter("paperclip_runner"); + unregisterServerAdapter("paperclip_runner"); + registerServerAdapter({ ...externalAdapter, type: "paperclip_runner" }); + testEnvironmentSpy.mockResolvedValue({ adapterType: "paperclip_runner", status: "warn", + checks: [{ code: "acpx_candidate_qualification_only", level: "warn", message: "Pinned runtime verified; Hermes remains pending." }], + testedAt: new Date(0).toISOString() }); + try { + const app = await createApp(); + const res = await request(app) + .post("/api/companies/company-1/adapters/paperclip_runner/test-environment") + .send({ adapterConfig: { provider: "acpx", acpxAgent: "hermes", model: "hermes-qualification-fixture" }, + aiConnection: { provider: "anthropic", method: "subscription", mode: "responsible_user" } }); + expect(res.status).toBe(200); + expect(res.body.status).toBe("warn"); + expect(res.body.checks.map((check: { code: string }) => check.code)).toContain("hermes_connection_qualification_required"); + expect(testEnvironmentSpy).toHaveBeenCalledTimes(1); + expect(mockValidateAiApiKey).not.toHaveBeenCalled(); + expect(mockMarkAuthenticationFailed).not.toHaveBeenCalled(); + } finally { + unregisterServerAdapter("paperclip_runner"); + if (previous) registerServerAdapter(previous); + } + }); + it("passes one-shot provider credentials only to the probe, never persistence normalization", async () => { const app = await createApp(); const res = await request(app) diff --git a/server/src/routes/agents.ts b/server/src/routes/agents.ts index 083608e3a55..09015389830 100644 --- a/server/src/routes/agents.ts +++ b/server/src/routes/agents.ts @@ -3500,6 +3500,14 @@ export function agentRoutes( } return result; } + if (adapterType === "paperclip_runner" && context.config.provider === "acpx" && context.config.acpxAgent === "hermes") { + // Hermes consumes the managed account through its native runtime. A + // different provider CLI cannot prove that projection or its model access. + result.status = "warn"; + result.checks.push({ code: "hermes_connection_qualification_required", level: "warn", + message: "The Hermes runtime is verified. This account and model still need an operator-controlled qualification run." }); + return result; + } if (!result.checks.some(check => check.code.includes("hello_probe"))) { const providerAdapter = context.config.managedAiRouting ? aiRoutingHarness(adapterType, context.config.provider, context.config.acpxAgent) : { anthropic: "claude_local", openai: "codex_local", openrouter: "opencode_local", xai: "grok_local", google: "gemini_local" }[binding.provider]; const probe = await requireServerAdapter(providerAdapter).testEnvironment({ ...context, adapterType: providerAdapter, config: { ...context.config, engine: "cli" } });