From 67595ea980bbef3d00c64a6b16878c78924a7c61 Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Sun, 18 Oct 2026 14:03:01 +0200 Subject: [PATCH] perf(story-mode): a page budget that halves the longest live pages A sweep of the Story core over every local transcript (1,311 files, 3,855 turns: no errors, never more than 12 panels, the slowest page 12 ms) found pages up to 551 KB (157 KB gzipped), refetched every few seconds while a long turn runs. The page text budget (outputs, hunks, helper texts; the oldest events give theirs up first) goes from 400,000 to 120,000 characters: 94% of turns never reach it, and the longest page is now 74 KB gzipped. An edit whose lines the budget dropped now says so ("left out to keep a long turn fast"), instead of the wording for a file a script wrote. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/story-mode.ts | 8 ++++++-- src/web/public/story-mode.js | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/story-mode.ts b/src/story-mode.ts index 680d79a2..0b873702 100644 --- a/src/story-mode.ts +++ b/src/story-mode.ts @@ -61,8 +61,12 @@ export const STORY_LIMITS = Object.freeze({ todoItems: 12, eventsPerPage: 800, panelsPerPage: 12, - /** Characters of output, hunk and helper text per page; older events give theirs up first. */ - pageTextBudget: 400_000, + /** + * Characters of output, hunk and helper text per page; older events give theirs up first. Sized on + * 3,855 local turns: 94% never reach it, and the longest live page went from 157 KB to 74 KB + * gzipped (it is refetched every few seconds while it changes). + */ + pageTextBudget: 120_000, turnsListed: 60, }); diff --git a/src/web/public/story-mode.js b/src/web/public/story-mode.js index 922bda41..3db4c310 100644 --- a/src/web/public/story-mode.js +++ b/src/web/public/story-mode.js @@ -3448,7 +3448,9 @@ Object.assign(CodemanApp.prototype, { 'story-empty', edit.hunks?.length ? 'Some lines of this edit were left out. Open the file to see all of it.' - : 'What changed is not in the transcript: a script or another program wrote this file. Open it to see it as it is now.' + : edit.added || edit.removed + ? 'The lines of this edit were left out to keep a long turn fast. Open the file to see it as it is now.' + : 'What changed is not in the transcript: a script or another program wrote this file. Open it to see it as it is now.' ) ); return section;