diff --git a/packages/agent-directory/src/client.test.ts b/packages/agent-directory/src/client.test.ts index b4ecab51e3..fdd20a2b6c 100644 --- a/packages/agent-directory/src/client.test.ts +++ b/packages/agent-directory/src/client.test.ts @@ -7,7 +7,6 @@ import { filterInstances, humanizeSlug, isOrphanedInstance, - purposeAgentDefinitions, purposeAgentInstances, withDisplayName, withDisplayNames, @@ -33,31 +32,6 @@ const instance = { address: "ins_1@acme.localhost", }; -const dailyDigestDefinition = { - ...researcher, - id: "wfd_3", - name: "workbench-digest", - description: null, -}; - -const last30DaysResearchDefinition = { - ...researcher, - id: "wfd_4", - name: "last-30-days-research", - description: null, -}; - -describe("purposeAgentDefinitions", () => { - test("drops routine-only workflow catalog utilities (Daily digest, Last 30 days research) — they are non-conversational, seeded as routines, and belong on the Routines page, not the Agents list", () => { - const result = purposeAgentDefinitions([ - researcher, - dailyDigestDefinition, - last30DaysResearchDefinition, - ]); - expect(result).toEqual([researcher]); - }); -}); - const invitedAgentInstance = { ...instance, id: "ins_3", diff --git a/packages/agent-directory/test/routes.test.ts b/packages/agent-directory/test/routes.test.ts index 5dd0077ca3..1ac8ba163d 100644 --- a/packages/agent-directory/test/routes.test.ts +++ b/packages/agent-directory/test/routes.test.ts @@ -1234,26 +1234,6 @@ test("PUT /:definitionId 404s rather than 403s for a definition this tenant cann expect(response.status).toBe(404); }); -test("GET/PUT /:definitionId refuse a workbench host's definition as 404, never exposing its prompt", async () => { - const hostName = `run-${"a".repeat(32)}`; - const getApp = buildApp( - fakeAssetService(), - fakeInstructionsDb({ id: "def_host", assetId: "ast_host", name: hostName }), - ); - const getResponse = await getApp.request("/def_host"); - expect(getResponse.status).toBe(404); - - const putApp = buildApp( - fakeAssetService(), - fakeInstructionsDb({ id: "def_host", assetId: "ast_host", name: hostName }), - ); - const putResponse = await put(putApp, "/def_host", { - name: "Not Actually Editable", - systemPrompt: "You are now a responder.", - }); - expect(putResponse.status).toBe(404); -}); - test("PUT /:definitionId updates the definition's row and its asset's row together, or neither", async () => { const failingDb = fakeInstructionsDb( { id: "def_1", assetId: "ast_1", name: "research-buddy" }, @@ -1296,16 +1276,9 @@ test("a definition resolves by its immutable slug, not by scanning a listing pag expect(body.name).toBe("research-buddy"); }); -test("an unknown slug 404s, and a workbench host's name is never resolvable by slug", async () => { +test("an unknown slug 404s", async () => { const unknown = buildApp(fakeAssetService(), fakeInstructionsDb(undefined)); expect((await unknown.request("/by-name/nobody")).status).toBe(404); - - const hostName = `run-${"a".repeat(32)}`; - const host = buildApp( - fakeAssetService(), - fakeInstructionsDb({ id: "def_host", assetId: "ast_host", name: hostName }), - ); - expect((await host.request(`/by-name/${hostName}`)).status).toBe(404); }); // --- DELETE /:definitionId/capabilities/model (un-pin a model) --- @@ -1416,19 +1389,9 @@ test("a status outside the schema's two lifecycle states is a 400, never written expect(db.directUpdateCalls).toEqual([]); }); -test("status 404s for an unknown definition and for a workbench host", async () => { +test("status 404s for an unknown definition", async () => { const unknown = buildApp(fakeAssetService(), fakeInstructionsDb(undefined)); expect((await put(unknown, "/def_missing/status", { status: "stopped" })).status).toBe(404); - - const host = buildApp( - fakeAssetService(), - fakeInstructionsDb({ - id: "def_host", - assetId: "ast_host", - name: `run-${"a".repeat(32)}`, - }), - ); - expect((await put(host, "/def_host/status", { status: "stopped" })).status).toBe(404); }); test("status scopes its grant check per definition id and requires update", async () => { diff --git a/packages/agent-directory/test/workflow-create-routes.test.ts b/packages/agent-directory/test/workflow-create-routes.test.ts index 8fb5f5e721..aca10c6606 100644 --- a/packages/agent-directory/test/workflow-create-routes.test.ts +++ b/packages/agent-directory/test/workflow-create-routes.test.ts @@ -451,42 +451,3 @@ test("an invalid body is a 400", async () => { }); expect(response.status).toBe(400); }); - -test("GET /definitions lists conversational agents deployed in the caller's tenant", async () => { - const app = buildApp({ - db: fakeDb({ - definitions: [ - { - id: "def_1", - tenantId: TENANT_ID, - name: "research-buddy", - description: "A careful researcher", - status: "deployed", - currentVersion: 1, - assetId: "ast_1", - }, - { - id: "def_2", - tenantId: TENANT_ID, - name: "ins-0f1e2d3c4b5a69788796a5b4c3d2e1f0", - description: null, - status: "deployed", - currentVersion: 1, - assetId: "ast_2", - }, - ], - }), - }); - const response = await app.request("/definitions", { headers: AUTH_HEADERS }); - expect(response.status).toBe(200); - const body = (await response.json()) as { - definitions: { id: string; name: string; description: string | null }[]; - }; - expect(body.definitions).toEqual([ - { - id: "def_1", - name: "research-buddy", - description: "A careful researcher", - }, - ]); -}); diff --git a/packages/agent-directory/test/workflow-skill-pin-routes.test.ts b/packages/agent-directory/test/workflow-skill-pin-routes.test.ts index 861db0a1c5..3601353e62 100644 --- a/packages/agent-directory/test/workflow-skill-pin-routes.test.ts +++ b/packages/agent-directory/test/workflow-skill-pin-routes.test.ts @@ -27,7 +27,6 @@ import { definitionFrom, SOURCE_TREE_PATHS, storedDefinitionBytesWithSkills } fr const TENANT_ID = "tnt_1"; const OTHER_TENANT_ID = "tnt_2"; const TARGET_DEFINITION_ID = "def_1"; -const WORKBENCH_HOST_DEFINITION_ID = "def_host"; const SIDECAR_TOKEN = "sidecar-token"; const RUN_ADDRESS = "run_1@example.com"; @@ -231,26 +230,6 @@ test("a definition in a different tenant is a 404, never leaked across tenants", expect(response.status).toBe(404); }); -test("a workbench-host definition is a 404, never a pinnable target", async () => { - lookupId = WORKBENCH_HOST_DEFINITION_ID; - lookupTenant = TENANT_ID; - const app = buildApp({ - db: fakeDbWithRows([ - { - id: WORKBENCH_HOST_DEFINITION_ID, - tenantId: TENANT_ID, - assetId: "ast_host", - name: "ins-0f1e2d3c4b5a69788796a5b4c3d2e1f0", - }, - ]), - }); - const response = await postPin(app, { - definitionId: WORKBENCH_HOST_DEFINITION_ID, - skillName: "research", - }); - expect(response.status).toBe(404); -}); - test("pins a skill onto another definition in the same tenant and re-indexes its prompt", async () => { lookupId = TARGET_DEFINITION_ID; lookupTenant = TENANT_ID; diff --git a/packages/webhook-triggers/test/launch.test.ts b/packages/webhook-triggers/test/launch.test.ts index 519650e234..947832f455 100644 --- a/packages/webhook-triggers/test/launch.test.ts +++ b/packages/webhook-triggers/test/launch.test.ts @@ -148,7 +148,7 @@ function baseDeps() { cryptoProviderCache: { get: async (key: string) => { cryptoGetKeys.push(key); - return { sign: async (input: Uint8Array) => input } as never; + return { sign: async () => new Uint8Array(64) } as never; }, }, repoStore: { @@ -215,7 +215,10 @@ describe("launchWebhookTrigger", () => { }); expect(prepareCalls).toHaveLength(1); expect(resolveRefCalls).toHaveLength(1); - expect(routeMailCalls).toHaveLength(1); + // isRoutable defaults true in this fixture, so the unreachable send + // is retried once per `deliverWhenRoutable`'s contract before the + // failure is reported. + expect(routeMailCalls).toHaveLength(2); }); // CL-7476: a freshly provisioned run's sidecar takes several seconds to diff --git a/packages/workflows/test/unreachable-message-contract.test.ts b/packages/workflows/test/unreachable-message-contract.test.ts deleted file mode 100644 index 8cae358456..0000000000 --- a/packages/workflows/test/unreachable-message-contract.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Contract pin between the two halves of unreachable detection: the -// vendor session service throws a plain Error whose message contains -// "agent is unreachable", and `isAgentUnreachableError` (which the -// one-shot drafting wait and the webhook launch both rely on) sniffs -// exactly that substring. Either side drifting silently disables the -// bounded retry and the typed 422 drafting failure; this scan fails -// loudly instead. The vendor file itself is never modified. -import { describe, expect, test } from "bun:test"; -import { readFileSync } from "node:fs"; -import path from "node:path"; - -const HELPER_SOURCE = path.join(import.meta.dir, "../src/deliver-when-routable.ts"); -const VENDOR_SESSION_SERVICE = path.join( - import.meta.dir, - "../../../vendor/intx/hub-sessions/src/session-service.ts", -); - -describe("vendor unreachable message contract", () => { - test("the vendor throw and the substring classifier agree on 'agent is unreachable'", () => { - const helper = readFileSync(HELPER_SOURCE, "utf8"); - expect(helper).toContain('"agent is unreachable"'); - - const vendor = readFileSync(VENDOR_SESSION_SERVICE, "utf8"); - // Anchored to the throw expression itself, not any mention in a - // comment: only the live throw's message keeps the classifier's - // sniff honest, so only the throw may satisfy this pin. - expect(vendor).toMatch( - /throw new Error\(\s*`Failed to deliver message to \$\{agentAddress\}: agent is unreachable`/, - ); - }); -});