test(pi): verify poll lifecycle without replacing availability

The lifecycle fixture injects its Pi runtime, so its executable probe should use a real configured executable rather than depend on an installed provider or replace the availability method.

Co-authored-by: Kushal Bairagya <bairagyakushal4@gmail.com>
This commit is contained in:
paseo-bot[bot]
2026-10-17 16:26:50 +02:00
co-authored by Kushal Bairagya
parent 9ae7a64aa7
commit 1ea820ca17
@@ -428,10 +428,13 @@ describe("provider subagent finalize", () => {
// The real Pi adapter, so the miss ticks come from the poll that protects the row instead of
// from a hand-written upsert.
const pi = new FakePi();
const client = new PiRpcAgentClient({ logger: pino({ level: "silent" }), runtime: pi });
// CI runners have no pi installation; the runtime is the FakePi above, so only the
// availability probe needs a stub.
vi.spyOn(client, "isAvailable").mockResolvedValue(true);
const client = new PiRpcAgentClient({
logger: pino({ level: "silent" }),
runtime: pi,
// The injected runtime owns execution; use an existing executable for the real availability
// probe so this test does not depend on a Pi installation or replace a client method.
runtimeSettings: { command: { mode: "replace", argv: [process.execPath] } },
});
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-provider-subagent-poll-"));
const manager = new AgentManager({
clients: { pi: client },