@@ -954,39 +954,46 @@ describe("threadHistoryPaging", () => { |
954 | 954 | expect(bounded.projection.visibleTurnItems).toEqual(actionable.visibleTurnItems); |
955 | 955 | }); |
956 | 956 |
|
957 | | - it("keeps agent-only turns visible when checkpoint file lists fill the byte budget", () => { |
958 | | - const items = Array.from({ length: 3 }, (_, turn) => { |
959 | | - const first = makeRow(turn * 5); |
960 | | - const prompt = { |
961 | | - ...first, |
962 | | - item: { |
963 | | - ...first.item, |
964 | | - type: "user_message" as const, |
965 | | - createdBy: "agent" as const, |
966 | | - creationSource: "provider" as const, |
967 | | - inputIntent: "turn_start" as const, |
968 | | - messageId: MessageId.make(`agent-prompt-${turn}`), |
969 | | - text: `Step ${turn}`, |
970 | | - attachments: [], |
971 | | - }, |
972 | | - } as OrchestrationV2ProjectedTurnItem; |
973 | | - return [prompt, ...Array.from({ length: 4 }, (_, index) => makeRow(turn * 5 + index + 1))]; |
974 | | - }).flat(); |
975 | | - const files = Array.from( |
976 | | - { length: 15_000 }, |
977 | | - (_, index) => |
978 | | - `work/ws-${index % 40}/.jj/repo/store/extra/${index.toString(16).padStart(40, "0")}`, |
979 | | - ); |
980 | | - const projection = { |
981 | | - ...makeProjection(items), |
982 | | - checkpoints: [{ id: "checkpoint-1", files }], |
983 | | - } as unknown as ReturnType<typeof makeProjection>; |
| 957 | + it.each([false, true])( |
| 958 | + "keeps agent-only turns visible when checkpoint file lists fill the byte budget (stored interrupt request: %s)", |
| 959 | + (withInterruptRequest) => { |
| 960 | + const items = Array.from({ length: 3 }, (_, turn) => { |
| 961 | + const first = makeRow(turn * 5); |
| 962 | + const prompt = { |
| 963 | + ...first, |
| 964 | + item: { |
| 965 | + ...first.item, |
| 966 | + type: "user_message" as const, |
| 967 | + createdBy: "agent" as const, |
| 968 | + creationSource: "provider" as const, |
| 969 | + inputIntent: "turn_start" as const, |
| 970 | + messageId: MessageId.make(`agent-prompt-${turn}`), |
| 971 | + text: `Step ${turn}`, |
| 972 | + attachments: [], |
| 973 | + }, |
| 974 | + } as OrchestrationV2ProjectedTurnItem; |
| 975 | + return [prompt, ...Array.from({ length: 4 }, (_, index) => makeRow(turn * 5 + index + 1))]; |
| 976 | + }).flat(); |
| 977 | + const files = Array.from( |
| 978 | + { length: 15_000 }, |
| 979 | + (_, index) => |
| 980 | + `work/ws-${index % 40}/.jj/repo/store/extra/${index.toString(16).padStart(40, "0")}`, |
| 981 | + ); |
| 982 | + const base = makeProjection(items); |
| 983 | + const projection = { |
| 984 | + ...base, |
| 985 | + turnItems: withInterruptRequest |
| 986 | + ? [interruptItem("old-interrupt-req", "run_interrupt_request", 0), ...base.turnItems] |
| 987 | + : base.turnItems, |
| 988 | + checkpoints: [{ id: "checkpoint-1", files }], |
| 989 | + } as unknown as ReturnType<typeof makeProjection>; |
984 | 990 |
|
985 | | - const bounded = buildBoundedThreadProjection({ projection, snapshotSequence: 1 }); |
| 991 | + const bounded = buildBoundedThreadProjection({ projection, snapshotSequence: 1 }); |
986 | 992 |
|
987 | | - expect(bounded.projection.visibleTurnItems).toHaveLength(items.length); |
988 | | - expect(bounded.hasMoreHistory).toBe(false); |
989 | | - }); |
| 993 | + expect(bounded.projection.visibleTurnItems).toHaveLength(items.length); |
| 994 | + expect(bounded.hasMoreHistory).toBe(false); |
| 995 | + }, |
| 996 | + ); |
990 | 997 |
|
991 | 998 | it("keeps paged historical plan detail in the turn item and only status in its artifact", () => { |
992 | 999 | const detail = "Implement the historical plan exactly.\n".repeat(1_000); |
|