fix(coding-agent): complete Agent Hub inspector metadata

This commit is contained in:
Kyle McCleary
2026-08-04 17:20:00 -07:00
parent 8e5f619502
commit 3180fd3d7f
9 changed files with 161 additions and 49 deletions
@@ -2,6 +2,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test";
import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
import { AgentRegistry } from "@oh-my-pi/pi-coding-agent/registry/agent-registry";
import * as executorModule from "@oh-my-pi/pi-coding-agent/task/executor";
import {
applyEligibleNestedPatches,
@@ -73,6 +74,7 @@ async function seedFooRepo(finalContent: string): Promise<{ repoRoot: string; pa
describe("runIsolatedSubprocess", () => {
afterEach(async () => {
vi.restoreAllMocks();
AgentRegistry.resetGlobalForTests();
await Promise.all(tempRoots.splice(0).map(tempRoot => fs.rm(tempRoot, { force: true, recursive: true })));
});
@@ -107,6 +109,13 @@ describe("runIsolatedSubprocess", () => {
nestedPatches: [],
});
const cleanupSpy = vi.spyOn(worktreeModule, "cleanupIsolation").mockResolvedValue();
AgentRegistry.global().register({
id: "PreserveBranchFailure",
displayName: "PreserveBranchFailure",
kind: "sub",
session: null,
status: "parked",
});
const deleteSpy = vi.spyOn(gitModule.branch, "tryDelete").mockResolvedValue(true);
const outcome = await runIsolatedSubprocess({
@@ -138,6 +147,7 @@ describe("runIsolatedSubprocess", () => {
expect(captureSpy).toHaveBeenCalledWith(isolationDir, baseline);
expect(deleteSpy).toHaveBeenCalledWith(repoRoot, "omp/task/PreserveBranchFailure");
expect(cleanupSpy).toHaveBeenCalledTimes(1);
expect(AgentRegistry.global().get("PreserveBranchFailure")?.history?.patchPath).toBe(patchPath);
});
});