chore: bump version to 17.3.7
Retry: widened agent dequeue-hook deadline budgets from 25ms to 1s — the run loop checks the deadline before invoking dequeue hooks, so a cold or CPU-starved mock roundtrip expired the deadline first and the hooks never ran (deterministic failure in isolation, flaky under CI parallel load).
This commit is contained in:
@@ -279,7 +279,11 @@ describe("Agent", () => {
|
||||
});
|
||||
it("keeps follow-up ownership when the deadline expires during a dequeue hook", async () => {
|
||||
const mock = createMockModel({ responses: [{ content: ["done"] }] });
|
||||
const agent = new Agent({ streamFn: mock.stream, deadline: Date.now() + 25 });
|
||||
// Generous budget: the loop checks the deadline before invoking dequeue
|
||||
// hooks, so the mock roundtrip must beat it even on starved CI runners.
|
||||
// The hook itself parks until the deadline timer aborts the loop signal,
|
||||
// so the expiry-during-hook branch stays exercised.
|
||||
const agent = new Agent({ streamFn: mock.stream, deadline: Date.now() + 1_000 });
|
||||
let hookSignal: AbortSignal | undefined;
|
||||
agent.addBeforeQueuedMessageDequeueHook(async signal => {
|
||||
if (!signal) throw new Error("Expected the active loop signal");
|
||||
@@ -297,7 +301,8 @@ describe("Agent", () => {
|
||||
expect(agent.peekFollowUpQueue()).toHaveLength(1);
|
||||
});
|
||||
it("keeps queued work when continue() reaches its deadline inside a dequeue hook", async () => {
|
||||
const agent = new Agent({ deadline: Date.now() + 25 });
|
||||
// Same starvation guard as above: hook entry must precede expiry.
|
||||
const agent = new Agent({ deadline: Date.now() + 1_000 });
|
||||
agent.replaceMessages([createAssistantMessage([{ type: "text", text: "ready" }])]);
|
||||
agent.addBeforeQueuedMessageDequeueHook(async signal => {
|
||||
if (!signal) throw new Error("Expected the deadline-aware dequeue signal");
|
||||
|
||||
Reference in New Issue
Block a user