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
This commit is contained in:
1 parent
edc4b88990
commit
99b300855e
13 files changed
+208
-58
No files matched your search
@@ -266,12 +266,19 @@ describe("thread history", () => {
|
||||
const host = { bounded: () => Promise.resolve(window) } as unknown as T3Host;
|
||||
|
||||
it("pages back through the bounded window, then hands over to T3's cursor", async () => {
|
||||
expect(summarize(window as BoundedThread, thread()).earlierCursor).toBe("w25");
|
||||
const first = await loadHistory(host, thread(), "w25");
|
||||
expect([first.messages[0]?.text, first.messages.at(-1)?.text, first.earlierCursor]).toEqual(["m5", "m24", "w5"]);
|
||||
const second = await loadHistory(host, thread(), "w5");
|
||||
expect(summarize(window as BoundedThread, thread()).earlierCursor).toBe("wm25");
|
||||
const first = await loadHistory(host, thread(), "wm25");
|
||||
expect([first.messages[0]?.text, first.messages.at(-1)?.text, first.earlierCursor]).toEqual(["m5", "m24", "wm5"]);
|
||||
const second = await loadHistory(host, thread(), "wm5");
|
||||
expect([second.messages.length, second.earlierCursor]).toEqual([5, "ht3-cursor"]);
|
||||
});
|
||||
|
||||
it("names a message, so new messages moving the window do not repeat or skip any", async () => {
|
||||
const grown = { ...window, projection: { ...window.projection, messages: [...messages.slice(3), message("user", "m45"), message("assistant", "m46"), message("user", "m47")] } };
|
||||
const moved = { bounded: () => Promise.resolve(grown) } as unknown as T3Host;
|
||||
const page = await loadHistory(moved, thread(), "wm25");
|
||||
expect([page.messages[0]?.text, page.messages.at(-1)?.text]).toEqual(["m5", "m24"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("projectThreads", () => {
|
||||
@@ -297,14 +304,15 @@ describe("projectThreads", () => {
|
||||
|
||||
describe("latestChanges", () => {
|
||||
it("sums each file the latest run changed, most lines first", () => {
|
||||
const change = (runId: string, fileName: string, additions: number, deletions: number) =>
|
||||
({ type: "file_change", runId, fileName, additions, deletions });
|
||||
const change = (runId: string, fileName: string, additions: number, deletions: number, status = "completed") =>
|
||||
({ type: "file_change", runId, status, fileName, additions, deletions });
|
||||
expect(
|
||||
latestChanges([
|
||||
change("run-1", "old.ts", 50, 0),
|
||||
change("run-2", "gateway/compose.yml", 3, 2),
|
||||
change("run-2", "gateway/Containerfile", 31, 0),
|
||||
change("run-2", "gateway/compose.yml", 6, 4),
|
||||
change("run-2", "declined.ts", 80, 0, "cancelled"),
|
||||
{ type: "assistant_message", runId: "run-2" },
|
||||
]),
|
||||
).toEqual([
|
||||
|
||||
Reference in new issue
Block a user