Skip to content
22 changes: 11 additions & 11 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@
"@types/express": "5.0.6",
"@types/pidusage": "2.0.5",
"@vercel/blob": "2.3.2",
"@xterm/addon-clipboard": "0.3.0-beta.219",
"@xterm/addon-fit": "0.12.0-beta.219",
"@xterm/addon-image": "0.10.0-beta.219",
"@xterm/addon-ligatures": "0.11.0-beta.219",
"@xterm/addon-progress": "0.3.0-beta.219",
"@xterm/addon-search": "0.17.0-beta.219",
"@xterm/addon-serialize": "0.15.0-beta.219",
"@xterm/addon-unicode11": "0.10.0-beta.219",
"@xterm/addon-webgl": "0.20.0-beta.218",
"@xterm/headless": "6.1.0-beta.219",
"@xterm/xterm": "6.1.0-beta.219",
"@xterm/addon-clipboard": "0.3.0-beta.220",
"@xterm/addon-fit": "0.12.0-beta.220",
"@xterm/addon-image": "0.10.0-beta.220",
"@xterm/addon-ligatures": "0.11.0-beta.220",
"@xterm/addon-progress": "0.3.0-beta.220",
"@xterm/addon-search": "0.17.0-beta.220",
"@xterm/addon-serialize": "0.15.0-beta.220",
"@xterm/addon-unicode11": "0.10.0-beta.220",
"@xterm/addon-webgl": "0.20.0-beta.219",
"@xterm/headless": "6.1.0-beta.220",
"@xterm/xterm": "6.1.0-beta.220",
"ai": "6.0.141",
"better-auth": "1.6.5",
"better-sqlite3": "12.6.2",
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/lib/terminal/terminal-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function loadAddons(terminal: XTerm): LoadAddonsResult {
webglAddon.onContextLoss(() => {
webglAddon?.dispose();
webglAddon = null;
suggestedRendererType = "dom";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this line: flips the module-local suggestedRendererType to "dom" after a real WebGL context-loss event, so every subsequent terminal in this session skips WebGL too — not just the one that lost context. Before this addition, only the catch block at line 59 set the flag (covers "WebGL throws at construction"); the onContextLoss path disposed the broken addon but left the flag unset, so each new tab kept re-attempting WebGL after one had already failed.

Why we still need it after the @xterm/ bump:* PR #5883 fixes the dominant failure mode (atlas-page-merge corruption — silent, no onContextLoss event fires). This line covers the orthogonal failure mode where WebGL context actually is lost (driver crash, OS sleep/wake, per-document WebGL context cap hit). The two changes catch different things; both needed for full coverage.

VSCode precedent: microsoft/vscode#120393 ("fall back to dom if webgl loses context"). One-way per session — fresh app launches retry WebGL (flag is in-memory only, not persisted).

Same one-line addition is mirrored in helpers.ts:143 for the v1-terminal-cache path, which uses an independent module-local copy of suggestedRendererType.

terminal.refresh(0, terminal.rows - 1);
});
terminal.loadAddon(webglAddon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export function createTerminalInWrapper(options: CreateTerminalOptions = {}): {
webglAddon.onContextLoss(() => {
webglAddon?.dispose();
webglAddon = null;
suggestedRendererType = "dom";
xterm.refresh(0, xterm.rows - 1);
});
xterm.loadAddon(webglAddon);
Expand Down
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"@trpc/server": "11.16.0",
"@trpc/tanstack-react-query": "11.16.0",
"@uiw/react-md-editor": "4.1.0",
"@xterm/addon-fit": "0.12.0-beta.219",
"@xterm/xterm": "6.1.0-beta.219",
"@xterm/addon-fit": "0.12.0-beta.220",
"@xterm/xterm": "6.1.0-beta.220",
"better-auth": "1.6.5",
"framer-motion": "12.38.0",
"geist": "1.7.0",
Expand Down
54 changes: 28 additions & 26 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.