GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): a stopped run no longer shrinks thread history to one ro… · incognitojam/styal@6b13ed1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2
    • threadHistoryPaging.test.ts
    • threadHistoryPaging.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/threadHistoryPaging.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/threadHistoryPaging.test.ts
+38-31Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -954,39 +954,46 @@ describe("threadHistoryPaging", () => {
954954
expect(bounded.projection.visibleTurnItems).toEqual(actionable.visibleTurnItems);
955955
});
956956

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>;
984990

985-
const bounded = buildBoundedThreadProjection({ projection, snapshotSequence: 1 });
991+
const bounded = buildBoundedThreadProjection({ projection, snapshotSequence: 1 });
986992

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+
);
990997

991998
it("keeps paged historical plan detail in the turn item and only status in its artifact", () => {
992999
const detail = "Implement the historical plan exactly.\n".repeat(1_000);
Collapse file

‎apps/server/src/orchestration-v2/threadHistoryPaging.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/threadHistoryPaging.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,9 @@ export function buildBoundedThreadProjection(input: {
677677
turnItems: [],
678678
visibleTurnItems: [],
679679
});
680-
// Keep the control-only window minimum, but required dependency cards claim their reserve first.
680+
// Control state cannot be paged, so the window keeps half the budget; dependency cards take their reserve from that half.
681681
const windowBudget = Math.max(
682-
dependencyReserve === 0 ? policy.maxEncodedBytes / 2 : 0,
682+
Math.max(policy.maxEncodedBytes / 2 - dependencyReserve, 0),
683683
policy.maxEncodedBytes - dependencyReserve - controlBytes - 1_024,
684684
);
685685
const windowPolicy: ThreadHistoryPagePolicy = { ...policy, maxEncodedBytes: windowBudget };

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.