|
6 | 6 | snapshotComposerSend, |
7 | 7 | withMessageContext, |
8 | 8 | deriveAvailableRevertTurnCounts, |
| 9 | + deriveThreadPendingBackgroundTasks, |
9 | 10 | deriveWorkspaceMutationId, |
10 | 11 | } from "./ChatView.logic"; |
11 | 12 | import { recallCheckoutIsRepo, rememberCheckoutIsRepo } from "./ChatView.logic"; |
@@ -1214,6 +1215,38 @@ describe("deriveAvailableRevertTurnCounts", () => { |
1214 | 1215 | }); |
1215 | 1216 | }); |
1216 | 1217 |
|
| 1218 | +describe("deriveThreadPendingBackgroundTasks", () => { |
| 1219 | + function projection(subagentRunOrdinal: number) { |
| 1220 | + const base = makeThreadProjectionFixture(); |
| 1221 | + return { |
| 1222 | + ...base, |
| 1223 | + runs: [ |
| 1224 | + { id: RunId.make("run-1"), ordinal: 1, status: "completed" }, |
| 1225 | + { id: RunId.make("run-2"), ordinal: 2, status: "running" }, |
| 1226 | + ], |
| 1227 | + turnItems: [ |
| 1228 | + { |
| 1229 | + id: TurnItemId.make("subagent"), |
| 1230 | + runId: RunId.make(`run-${subagentRunOrdinal}`), |
| 1231 | + type: "subagent", |
| 1232 | + status: "running", |
| 1233 | + title: "Review", |
| 1234 | + }, |
| 1235 | + ], |
| 1236 | + } as unknown as ReturnType<typeof makeThreadProjectionFixture>; |
| 1237 | + } |
| 1238 | + |
| 1239 | + it("keeps an earlier turn's subagent while a follow-up turn runs", () => { |
| 1240 | + expect(deriveThreadPendingBackgroundTasks(projection(1))).toEqual([ |
| 1241 | + { taskId: "subagent", kind: "subagent", description: "Review" }, |
| 1242 | + ]); |
| 1243 | + }); |
| 1244 | + |
| 1245 | + it("leaves the running turn's own subagents to the timeline", () => { |
| 1246 | + expect(deriveThreadPendingBackgroundTasks(projection(2))).toEqual([]); |
| 1247 | + }); |
| 1248 | +}); |
| 1249 | + |
1217 | 1250 | describe("deriveWorkspaceMutationId", () => { |
1218 | 1251 | const item = (id: string, type: string, status: string) => |
1219 | 1252 | ({ |
|
0 commit comments