Skip to content

Commit fffce79

Browse files
authored
fix(sessions): keep streaming live when the window is backgrounded
Streamed agent events are committed to the conversation store via a short setTimeout flush in the renderer. Chromium clamps and (when the window is occluded/hidden) freezes renderer timers, so while the app is backgrounded that flush never runs: streamed events pile up unflushed and only render in a burst when the timer thaws on refocus. This is why a waiting/looping agent appears to hang and its messages all appear at once after the user sends a follow-up. Set backgroundThrottling: false on the main window so renderer timers keep running at full speed while backgrounded, letting live streaming flow during long-running agent runs. Generated-By: PostHog Code Task-Id: d38d3951-6357-4d57-809c-74d47581a163
1 parent 6d6de93 commit fffce79

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

apps/code/src/main/window.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ export function createWindow(): void {
215215
webPreferences: {
216216
nodeIntegration: false,
217217
contextIsolation: true,
218+
// Keep the renderer running at full speed when the window is backgrounded
219+
// or occluded. Chromium otherwise clamps (and, once the window is hidden,
220+
// effectively freezes) renderer timers, which stalls the setTimeout-based
221+
// flush that commits streamed agent events to the conversation store. That
222+
// stall is what makes a waiting/looping agent appear to hang while
223+
// backgrounded — its messages pile up unflushed and only render in a burst
224+
// when the window is refocused (e.g. by sending a follow-up). Disabling
225+
// throttling keeps live streaming flowing while the app sits in the
226+
// background during long-running agent runs.
227+
backgroundThrottling: false,
218228
preload: path.join(__dirname, "preload.js"),
219229
enableBlinkFeatures: "GetDisplayMedia",
220230
partition: "persist:main",

0 commit comments

Comments
 (0)