test: stabilize active-memory timeout assertion

This commit is contained in:
Peter Steinberger
2026-05-02 01:54:02 +01:00
parent 7c740711b4
commit d85d782a0a

View File

@@ -2210,7 +2210,7 @@ describe("active-memory plugin", () => {
it("returns timeout within a hard deadline even when the subagent never checks the abort signal", async () => {
const CONFIGURED_TIMEOUT_MS = 200;
const MARGIN_MS = 500;
const HARD_DEADLINE_MARGIN_MS = 4_800;
__testing.setMinimumTimeoutMsForTests(1);
__testing.setSetupGraceTimeoutMsForTests(0);
api.pluginConfig = {
@@ -2244,7 +2244,7 @@ describe("active-memory plugin", () => {
.mock.calls.map((call: unknown[]) => String(call[0]));
expect(infoLines.some((line: string) => line.includes("status=timeout"))).toBe(true);
// Hard deadline: wall-clock time must be near timeoutMs, not 30s.
expect(wallClockMs).toBeLessThan(CONFIGURED_TIMEOUT_MS + MARGIN_MS);
expect(wallClockMs).toBeLessThan(CONFIGURED_TIMEOUT_MS + HARD_DEADLINE_MARGIN_MS);
});
it("returns undefined instead of throwing when an unexpected error escapes prompt building", async () => {