Gateway: review fixes for stale summaries, history cursors that survive a moving window, timeouts on T3 calls, push size, T3's snooze rules, and input checks
Gateway / check (push) Successful in 9s
Gateway / image (push) Successful in 21s

This commit is contained in:
gib committed 2026-11-02 14:59:32 -05:00
1 parent edc4b88990
commit 99b300855e
13 files changed
+208 -58

No files matched your search

+23 -1
View File
@@ -1,7 +1,7 @@
// Cases ported from T3 Code's agentAwareness.test.ts, so the gateway notifies when T3's own app would.
import { describe, expect, it } from "bun:test";
import { threadPhase } from "../src/awareness.ts";
import { isSnoozed, threadPhase } from "../src/awareness.ts";
import type { ThreadShell } from "../src/t3/types.ts";
const thread = (overrides: Partial<ThreadShell> = {}): ThreadShell => ({
@@ -104,3 +104,25 @@ describe("threadPhase", () => {
expect(threadPhase(thread({ delegatedFrom, pendingRuntimeRequest: request("command") }))).toBe("waiting_for_approval");
});
});
describe("isSnoozed", () => {
const now = Date.parse("2026-11-01T12:00:00.000Z");
const snoozed = {
snoozedUntil: "2026-11-01T18:00:00.000Z",
snoozedAt: "2026-11-01T10:00:00.000Z",
latestRunCompletedAt: "2026-11-01T09:00:00.000Z",
status: "completed",
pendingRuntimeRequest: null,
} as const;
it("hides a thread until its time, as T3 does", () => {
expect(isSnoozed(snoozed, now)).toBe(true);
expect(isSnoozed({ ...snoozed, snoozedUntil: "2026-11-01T11:00:00.000Z" }, now)).toBe(false);
});
it("wakes a thread that waits on someone or failed after the snooze", () => {
expect(isSnoozed({ ...snoozed, pendingRuntimeRequest: { id: "r", kind: "command", createdAt: "" } }, now)).toBe(false);
expect(isSnoozed({ ...snoozed, status: "failed", latestRunCompletedAt: "2026-11-01T11:00:00.000Z" }, now)).toBe(false);
expect(isSnoozed({ ...snoozed, status: "failed" }, now)).toBe(true);
});
});