diff --git a/hindsight-integrations/coding-agents/src/core/hook.test.ts b/hindsight-integrations/coding-agents/src/core/hook.test.ts index ca2218a8a..d9832bd42 100644 --- a/hindsight-integrations/coding-agents/src/core/hook.test.ts +++ b/hindsight-integrations/coding-agents/src/core/hook.test.ts @@ -152,7 +152,7 @@ describe("buildHookOutput", () => { expect(client.reflect).toHaveBeenCalledTimes(1); }); - it("caps the reflect timeout at 25000ms even when config asks for more", async () => { + it("uses a bounded low-budget reflect and caps its timeout at 25000ms", async () => { const cfg = resolveConfig({}); // reflectTimeoutMs default 120000 const client = makeClient(); await buildHookOutput({ @@ -163,7 +163,7 @@ describe("buildHookOutput", () => { cacheFile, }); expect(client.reflect).toHaveBeenCalledWith(buildReflectQuery("the prompt"), { - budget: "high", + budget: "low", timeoutMs: 25000, }); }); @@ -179,7 +179,7 @@ describe("buildHookOutput", () => { cacheFile, }); expect(client.reflect).toHaveBeenCalledWith(buildReflectQuery("the prompt"), { - budget: "high", + budget: "low", timeoutMs: 5000, }); }); diff --git a/hindsight-integrations/coding-agents/src/core/hook.ts b/hindsight-integrations/coding-agents/src/core/hook.ts index b879de592..f90b74926 100644 --- a/hindsight-integrations/coding-agents/src/core/hook.ts +++ b/hindsight-integrations/coding-agents/src/core/hook.ts @@ -112,7 +112,10 @@ export async function buildHookOutput(args: { const t0 = Date.now(); try { reflectAnswer = await client.reflect(buildReflectQuery(prompt), { - budget: "high", + // Automatic reflection runs inside a hard 25s hook window. Hindsight's low budget is the + // supported default for bounded reflect calls; callers that explicitly invoke the MCP + // tool still get the deeper high-budget path. + budget: "low", timeoutMs: Math.min(cfg.reflectTimeoutMs, HOOK_REFLECT_CAP_MS), }); diag(harness, reflectAnswer ? "reflect_ok" : "reflect_empty", {