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
12 changes: 11 additions & 1 deletion convex/pullRequests/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ const REVIEW_TURNS = 8;
// SLOW_REQUEST_MIN_MS is not sent, since it would likely be cut off.
const LATE_REQUEST_END_MS = 8 * 60_000;
const SLOW_REQUEST_MIN_MS = 90_000;
// A reasoning model can spend over two minutes on the turn that writes its
// findings. Cutting it off leaves its usage unknown and blocks the account's
// AI work for 30 minutes, so review requests wait this long by default,
// still never past ACTION_REQUEST_END_MS.
const REVIEW_REQUEST_TIMEOUT_MS = 4 * 60_000;
const ACTION_REQUEST_END_MS = 9 * 60_000;
// After the main review, focused second looks at the same source. Each one
// resends the main review's last request with only its closing state
Expand Down Expand Up @@ -356,7 +361,12 @@ export async function reviewWithContext(args: {
{
operation: `Request AI review (${options.billingLabel ?? "generation"})`,
},
() => args.provider.chat(messages, { endBy, ...options }),
() =>
args.provider.chat(messages, {
endBy,
timeoutMs: REVIEW_REQUEST_TIMEOUT_MS,
...options,
}),
);
};
let readBudget = 0;
Expand Down
4 changes: 3 additions & 1 deletion test/convex/pullRequests/recovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@ describe("uncertain review candidates", () => {
// The closing synthesis may run past the usual two minutes.
expect(requestOptions[8].timeoutMs).toBeGreaterThan(120_000);
expect(requestOptions[8].timeoutMs).toBeLessThanOrEqual(300_000);
expect(requestOptions[7]).not.toHaveProperty("timeoutMs");
// A main turn waits up to four minutes, never past the action's end.
expect(requestOptions[7].timeoutMs).toBe(240_000);
expect(requestOptions[7].endBy).toBeGreaterThan(Date.now());
expect(requests[8][0].content).toContain("Commit suggestions are disabled");
});

Expand Down
Loading