Skip to content

Commit be0c319

Browse files
fix(server): probe cleanup relies on runtime capability gate
Main's ACP runtime already sends session/delete only when the agent advertises it, so the probe registers its cleanup unconditionally. The probe test now provides SecureRandom, which main's runtime requires. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent bb9aa8f commit be0c319

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎apps/server/src/provider/AcpRegistryProbe.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ describe("ACP Registry probe", () => {
432432
expect(requests.filter((request) => request.method === "session/delete")).toEqual([
433433
expect.objectContaining({ params: { sessionId: "mock-session-1" } }),
434434
]);
435-
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
435+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
436436
);
437437

438438
it("distinguishes authentication failures from generic probe failures", () => {

‎packages/provider-acp-registry/src/server/probe.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,12 @@ export const probeAcpRegistryConfiguration = Effect.fn("AcpRegistryProbe.probeCo
421421
}
422422
const started = startResult.success;
423423
// Agents that persist sessions (OpenCode) would otherwise keep one empty session per probe.
424-
if (started.initializeResult.agentCapabilities?.sessionCapabilities?.delete != null) {
425-
yield* Effect.addFinalizer(() =>
426-
runtime
427-
.deleteSession(started.sessionId)
428-
.pipe(Effect.timeoutOption(PROBE_SESSION_DELETE_TIMEOUT), Effect.ignore),
429-
);
430-
}
424+
// The runtime only sends session/delete when the agent advertises it.
425+
yield* Effect.addFinalizer(() =>
426+
runtime
427+
.deleteSession(started.sessionId)
428+
.pipe(Effect.timeoutOption(PROBE_SESSION_DELETE_TIMEOUT), Effect.ignore),
429+
);
431430
yield* Deferred.await(commandsAdvertised).pipe(
432431
Effect.timeoutOption(COMMAND_ADVERTISEMENT_GRACE),
433432
);

0 commit comments

Comments
 (0)