Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hindsight-integrations/coding-agents/src/core/hook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -163,7 +163,7 @@ describe("buildHookOutput", () => {
cacheFile,
});
expect(client.reflect).toHaveBeenCalledWith(buildReflectQuery("the prompt"), {
budget: "high",
budget: "low",
timeoutMs: 25000,
});
});
Expand All @@ -179,7 +179,7 @@ describe("buildHookOutput", () => {
cacheFile,
});
expect(client.reflect).toHaveBeenCalledWith(buildReflectQuery("the prompt"), {
budget: "high",
budget: "low",
timeoutMs: 5000,
});
});
Expand Down
5 changes: 4 additions & 1 deletion hindsight-integrations/coding-agents/src/core/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down