From c97a5b69b5990517f476f3d0d8497ded3752e9eb Mon Sep 17 00:00:00 2001 From: Guitaraholic Date: Wed, 2 Sep 2026 17:23:04 +0100 Subject: [PATCH] Lower the default timeline window event budget to 400. The 1500-event cap assumed 0.06 ms/event and almost never bound. Measured p50 is 0.479 ms/event; 400 puts cold builds near 190 ms on small hosts and makes the cap apply to more than two threads. Override with BB_FF_TIMELINE_WINDOW_EVENT_BUDGET. Related: get-bb/bb#1749 --- apps/app/src/lib/system-config-atoms.ts | 2 +- apps/server/test/services/threads/timeline-event-budget.test.ts | 2 +- docs/configuration.md | 2 +- packages/config/test/config.test.ts | 2 +- packages/domain/src/feature-flags.ts | 2 +- packages/templates/src/templates/bb-guide-customization.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/app/src/lib/system-config-atoms.ts b/apps/app/src/lib/system-config-atoms.ts index 0122af4fbe..95197af8ab 100644 --- a/apps/app/src/lib/system-config-atoms.ts +++ b/apps/app/src/lib/system-config-atoms.ts @@ -31,7 +31,7 @@ const unavailableSystemConfig: SystemConfigResponse = { appearance: defaultAppTheme, customThemes: [], pluginThemes: [], - featureFlags: { placeholder: false, timelineWindowEventBudget: 1_500 }, + featureFlags: { placeholder: false, timelineWindowEventBudget: 400 }, hostDaemonPort: null, localHelperPorts: [], serverUrl: "", diff --git a/apps/server/test/services/threads/timeline-event-budget.test.ts b/apps/server/test/services/threads/timeline-event-budget.test.ts index 38aac0a75f..734d91fae7 100644 --- a/apps/server/test/services/threads/timeline-event-budget.test.ts +++ b/apps/server/test/services/threads/timeline-event-budget.test.ts @@ -418,7 +418,7 @@ describe("timeline event budget", () => { page, }; expect( - buildThreadTimeline(db, thread, { ...options, eventBudget: 1_500 }), + buildThreadTimeline(db, thread, { ...options, eventBudget: 400 }), ).toEqual( buildThreadTimeline(db, thread, { ...options, diff --git a/docs/configuration.md b/docs/configuration.md index 1546037dfa..2436f534c0 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -694,7 +694,7 @@ is synchronous, so it blocked the server's event loop — which also delayed dynamic tool call and before registering every interactive request. One slow thread therefore slowed agent work on _every_ thread on the host. -A window is capped at `BB_FF_TIMELINE_WINDOW_EVENT_BUDGET` events (default 1500) and returns however many whole turns fit. Older turns load automatically +A window is capped at `BB_FF_TIMELINE_WINDOW_EVENT_BUDGET` events (default 400) and returns however many whole turns fit. Older turns load automatically as you scroll toward the top of the loaded window; a manual "Load older messages" button remains on surfaces that render no scroll body, and after a failed page so a broken fetch is retried on request rather than in a loop. diff --git a/packages/config/test/config.test.ts b/packages/config/test/config.test.ts index 7cd1c18291..7d191ef101 100644 --- a/packages/config/test/config.test.ts +++ b/packages/config/test/config.test.ts @@ -310,7 +310,7 @@ describe("consumer-specific config", () => { expect(serverConfig.OPENAI_API_KEY).toBe("test-openai-key"); expect(serverConfig.featureFlags).toEqual({ placeholder: false, - timelineWindowEventBudget: 1_500, + timelineWindowEventBudget: 400, }); }); diff --git a/packages/domain/src/feature-flags.ts b/packages/domain/src/feature-flags.ts index ae8bf32142..ae2a423cf2 100644 --- a/packages/domain/src/feature-flags.ts +++ b/packages/domain/src/feature-flags.ts @@ -8,5 +8,5 @@ export type FeatureFlags = z.infer; export const defaultFeatureFlags: FeatureFlags = { placeholder: false, - timelineWindowEventBudget: 1_500, + timelineWindowEventBudget: 400, }; diff --git a/packages/templates/src/templates/bb-guide-customization.md b/packages/templates/src/templates/bb-guide-customization.md index 7caa3ba9a6..d83dd8b0ba 100644 --- a/packages/templates/src/templates/bb-guide-customization.md +++ b/packages/templates/src/templates/bb-guide-customization.md @@ -142,7 +142,7 @@ timelines and large expanded timeline details. Enable it with `bb settings experiment timelineWindowing true`. Thread timeline windows are bounded by event count as well as user-message -count (`BB_FF_TIMELINE_WINDOW_EVENT_BUDGET`, default 1500), so a long thread +count (`BB_FF_TIMELINE_WINDOW_EVENT_BUDGET`, default 400), so a long thread stops reprojecting its whole history — and blocking the server event loop — on every update. A turn still running is cut at the budget too, so a very long turn costs the budget per update instead of growing without limit. Older