review error

This commit is contained in:
Ian Gulliver
2026-10-17 07:43:33 -07:00
parent 4612aece55
commit 216f3dd737
13 changed files with 327 additions and 235 deletions
+9 -9
View File
@@ -81,23 +81,23 @@ function reviewImages(v) {
return h("figure", {}, h("a", { href: src, target: "_blank", rel: "noopener" }, h("img", { src, alt: caption || "screenshot", loading: "lazy" })), caption ? h("figcaption", {}, caption) : null);
}));
}
const stepChanges = new Map();
const stepPatches = new Map();
const snapChanges = new Map();
const snapPatches = new Map();
function snapshotPatch(taskId, n, path) {
const key = `${taskId}/${n}/${path}`;
const cached = stepPatches.get(key);
const cached = snapPatches.get(key);
if (cached) {
return cached;
}
const fetched = (async () => {
const ck = `${taskId}/${n}`;
let pending = stepChanges.get(ck);
let pending = snapChanges.get(ck);
if (!pending) {
pending = get("/api/tasks/{taskId}/changes", { path: { taskId }, query: { snapshot: n, step: true } });
stepChanges.set(ck, pending);
pending = get("/api/tasks/{taskId}/changes", { path: { taskId }, query: { snapshot: n } });
snapChanges.set(ck, pending);
}
const changes = await pending.catch((err) => {
stepChanges.delete(ck);
snapChanges.delete(ck);
throw err;
});
const f = changes.files.find((c) => c.path === path);
@@ -107,8 +107,8 @@ function snapshotPatch(taskId, n, path) {
const d = await get("/api/tasks/{taskId}/diff", { path: { taskId }, query: { base: changes.base, tree: changes.tree, path: f.path, old_path: f.old_path } });
return d.patch;
})();
stepPatches.set(key, fetched);
fetched.catch(() => stepPatches.delete(key));
snapPatches.set(key, fetched);
fetched.catch(() => snapPatches.delete(key));
return fetched;
}
function linesAround(patch, line, end) {
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1249,10 +1249,10 @@ export interface components {
*/
event_seq: number;
/**
* @description turn_end: after byre's end-of-turn commit. message (the agent wrote text after one or more tool calls), tool_call, ask_human and timer appear only on snapshots taken by earlier builds.
* @description turn_end: after byre's end-of-turn commit. requested: a task's agent or the lead asked for it with take_snapshot. message (the agent wrote text after one or more tool calls), tool_call, ask_human and timer appear only on snapshots taken by earlier builds.
* @enum {string}
*/
trigger: "message" | "turn_end" | "tool_call" | "ask_human" | "timer";
trigger: "message" | "turn_end" | "tool_call" | "ask_human" | "timer" | "requested";
/** Format: date-time */
created_at: string;
};
+9 -9
View File
@@ -144,24 +144,24 @@ function reviewImages(v: unknown): HTMLElement | null {
);
}
const stepChanges = new Map<string, Promise<Schemas["TaskChanges"]>>();
const stepPatches = new Map<string, Promise<string | undefined>>();
const snapChanges = new Map<string, Promise<Schemas["TaskChanges"]>>();
const snapPatches = new Map<string, Promise<string | undefined>>();
function snapshotPatch(taskId: string, n: number, path: string): Promise<string | undefined> {
const key = `${taskId}/${n}/${path}`;
const cached = stepPatches.get(key);
const cached = snapPatches.get(key);
if (cached) {
return cached;
}
const fetched = (async () => {
const ck = `${taskId}/${n}`;
let pending = stepChanges.get(ck);
let pending = snapChanges.get(ck);
if (!pending) {
pending = get("/api/tasks/{taskId}/changes", { path: { taskId }, query: { snapshot: n, step: true } });
stepChanges.set(ck, pending);
pending = get("/api/tasks/{taskId}/changes", { path: { taskId }, query: { snapshot: n } });
snapChanges.set(ck, pending);
}
const changes = await pending.catch((err: unknown) => {
stepChanges.delete(ck);
snapChanges.delete(ck);
throw err;
});
const f = changes.files.find((c) => c.path === path);
@@ -171,8 +171,8 @@ function snapshotPatch(taskId: string, n: number, path: string): Promise<string
const d = await get("/api/tasks/{taskId}/diff", { path: { taskId }, query: { base: changes.base, tree: changes.tree, path: f.path, old_path: f.old_path } });
return d.patch;
})();
stepPatches.set(key, fetched);
fetched.catch(() => stepPatches.delete(key));
snapPatches.set(key, fetched);
fetched.catch(() => snapPatches.delete(key));
return fetched;
}