Skip to content

fix(desktop): bump @xterm/* to beta.220 for upstream WebGL atlas-merge fix - #4893

Merged
Kitenite merged 8 commits into
ParadevAI:mainfrom
justincrich:improvement/GH-3572-terminal-webgl-dom-fallback
May 24, 2026
Merged

Kitenite merged 8 commits into
ParadevAI:mainfrom
justincrich:improvement/GH-3572-terminal-webgl-dom-fallback

Conversation

@justincrich

@justincrich justincrich commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Picks up xtermjs/xterm.js#5883 "Fix webgl rendering corruption from atlas page merges" — merged 2026-05-21 by xterm.js maintainer Tyriar. The PR fixes two atlas-merge bugs (stale texture binding after same-index page swap; stale texturePage in vertex buffer after mid-update merge) that produce the wrong-glyph rendering reported in #3572 and the sibling cluster (#3527, #3794, #4601, #4639).

Tyriar's approval comment on PR #5883 explicitly cites our use case:

"This has been an issue for a long time, I think it's popped up more recently due to agentic CLIs using a much wider range of character styles."

Adopting via dep bump (we are already on the beta.220 train at beta.219):

  • @xterm/xterm, @xterm/headless, @xterm/addon-* → 6.1.0-beta.220 (or 0.x.0-beta.220 for the addons)
  • @xterm/addon-webgl: 0.20.0-beta.218 → 0.20.0-beta.219 (peer-dep on ^6.1.0-beta.220)

Also aligns apps/web deps to the same versions (sherif workspace consistency check).

Defense-in-depth: VSCode-pattern fallback

Adds one line inside both onContextLoss handlers (terminal-addons.ts, helpers.ts) to set the module-local suggestedRendererType = "dom" — modeled on microsoft/vscode#120393. The catch-block on initial WebGL load already did this; the onContextLoss handler had the documented gap. Cheap belt-and-suspenders for the rarer GPU-process-death class of failure that bypasses the atlas-merge fix.

Out of scope (deferred follow-ups)

  • Vendor-patch postinstall recipe (Ouroboros pattern) — not needed since we're already on the beta train
  • Periodic Terminal.clearTextureAtlas() heal on tab-visibility-change — PR fix(desktop): preserve pane layout when removing a workspace from the sidebar #5883 should remove the need
  • Recovery-back-to-WebGL after fallback (Hermes Agent pattern) — defer; VSCode ships one-way-only
  • Multi-stage frame-budget watchdog (VSCode #118064 "> 50ms avg → DOM") — not load-bearing
  • Removing @xterm/addon-webgl dep (original Strategic option from scope investigation) — moot once upstream fix is adopted
  • Migration off the beta train when xterm.js 7.0.0 GAs

Test plan

  • bun run typecheck (@superset/desktop) — clean
  • bun run lint (repo) — clean (Biome treats warnings as errors)
  • bun install resolves bun.lock with new versions; native modules rebuild cleanly
  • Manual smoke test (reviewer / on merge): open ≥7 Claude Code workspace tabs on macOS, sustained streaming (tail -f, large cat), verify no glyph corruption over 15+ min; confirm WebGL canvas still active in DevTools

Closes

Notes for reviewer

  • Beta.220 was published to npm on 2026-05-21 (3 days ago at merge time). VSCode, Alfredo, and Ouroboros have all bumped or vendored this fix. Bun's minimumReleaseAge=259200 may briefly require --minimum-release-age=0 on a fresh local install until the package is ≥3 days old.
  • The apps/desktop/src/lib/trpc/routers/permissions.ts and other unrelated changes in the diff vs main come from commits already on main since I started this branch; they are NOT introduced by this PR.

Open in Stage

Summary by cubic

Bump @xterm/* to beta.220 to pick up the upstream WebGL atlas-merge fix, preventing wrong-glyph rendering in the terminal. Add a DOM fallback on WebGL context loss for safer recovery. Addresses #3572 and related reports.

  • Bug Fixes

    • Adopt upstream fix for WebGL atlas page merge corruption from xterm.js (prevents stale texture and vertex references).
    • On WebGL context loss, dispose the addon and set suggestedRendererType = "dom" so new terminals fall back to DOM.
  • Dependencies

    • apps/desktop: @xterm/xterm, @xterm/headless, @xterm/addon-* → 6.1.0-beta.220; @xterm/addon-webgl → 0.20.0-beta.219.
    • apps/web: align @xterm/xterm and @xterm/addon-fit → 6.1.0-beta.220.

Written for commit d938793. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Chores

    • Updated terminal library dependencies to latest beta versions
  • Bug Fixes

    • Improved terminal rendering stability by ensuring proper fallback to standard rendering mode when graphics acceleration encounters failures

Review Change Stack

…e fix

Picks up xtermjs/xterm.js#5883 "Fix webgl rendering corruption from atlas
page merges" (merged 2026-05-21 by Tyriar). The PR fixes two atlas-merge
bugs that match the reported symptom in ParadevAI#3572 (and the sibling cluster
ParadevAI#3527, ParadevAI#3794, ParadevAI#4601, ParadevAI#4639): texture binding stays bound to the old page's
canvas after a same-index page swap during merge, so glyphs sample garbage.

Maintainer Tyriar on the PR: "This has been an issue for a long time, I
think it's popped up more recently due to agentic CLIs using a much wider
range of character styles."

Also adds a one-line VSCode-pattern (microsoft/vscode#120393) fallback
inside both onContextLoss handlers: set the module-local
suggestedRendererType = "dom" so subsequent terminals on the same path
avoid WebGL after a context-loss event. Defense-in-depth for the rarer
GPU-process-death class that bypasses the upstream atlas-merge fix.

Refs ParadevAI#3572
@capy-ai

capy-ai Bot commented May 23, 2026

Copy link
Copy Markdown

Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

@ghost

ghost commented May 23, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Upgrade xterm.js dependencies to beta.220
2 Add DOM renderer fallback on context loss
3 Other changes
Open in Stage

Chapters generated by Stage for commit d938793 on May 23, 2026 6:46pm UTC.

@coderabbitai

coderabbitai Bot commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 92a4ce12-f5c6-4795-8ddf-5591a78cbe0c

📥 Commits

Reviewing files that changed from the base of the PR and between 00f5dd7 and d938793.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • apps/desktop/package.json
  • apps/desktop/src/renderer/lib/terminal/terminal-addons.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/helpers.ts
  • apps/web/package.json

📝 Walkthrough

Walkthrough

This PR upgrades xterm dependencies to beta.220 across desktop and web applications and enhances WebGL failure recovery. When WebGL context loss occurs at runtime, terminals now persistently disable WebGL for subsequent creation by setting suggestedRendererType to "dom".

Changes

xterm Updates and WebGL Fallback Enhancement

Layer / File(s) Summary
WebGL context loss fallback
apps/desktop/src/renderer/lib/terminal/terminal-addons.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/helpers.ts
WebGL context loss handlers now set suggestedRendererType = "dom" to ensure future terminals in the same renderer process skip WebGL rendering after the first runtime context loss event.
xterm dependency upgrades to beta.220
apps/desktop/package.json, apps/web/package.json
@xterm packages (@xterm/addon-webgl, @xterm/addon-fit, @xterm/headless, @xterm/xterm) bumped from beta.218/219 to beta.220 releases in both desktop and web applications.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • superset-sh/superset#3794: The PR directly addresses WebGL context loss handling by setting suggestedRendererType to "dom" in the same code paths this issue tracks.

Possibly related PRs

  • superset-sh/superset#4541: Both PRs modify the terminal WebGL lifecycle in terminal-addons.ts and related helpers to handle WebGL fallback recovery using suggestedRendererType.

Poem

🐰 A rabbit hops through xterm's glow,
When WebGL fails, to "dom" we go,
Beta.220 speeds the way,
Fallbacks ready, come what may! 🎨✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: bumping @xterm packages to beta.220 to fix WebGL atlas-merge issues.
Description check ✅ Passed The description includes detailed sections (Summary, Defense-in-depth, Test plan, Closes, Notes for reviewer) and covers the bug fix rationale, related issues, and testing status.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Bumps all @xterm/* packages from beta.219 to beta.220 (with @xterm/addon-webgl going to beta.219, which is where the upstream WebGL atlas-merge fix landed) and adds suggestedRendererType = "dom" to both onContextLoss handlers to close the gap that existed between the existing catch-block fallback and GPU-process-death failures.

  • Dep bump: all @xterm/xterm, @xterm/headless, and addon packages → beta.220; @xterm/addon-webgl → beta.219 (peer-dep updated to ^6.1.0-beta.220), matching the upstream release that contains the atlas-merge fix.
  • onContextLoss hardening (terminal-addons.ts, helpers.ts): one-line addition mirrors the catch-block pattern already in both files, ensuring suggestedRendererType is set to "dom" on context loss so future terminal instances skip WebGL automatically.
  • Lockfile note: @superset/host-service was not updated and now installs a second copy of @xterm/headless@6.1.0-beta.219 alongside the promoted beta.220, which may trip the sherif workspace-consistency check.

Confidence Score: 4/5

Safe to merge; the code changes are a minimal one-line addition to two parallel handlers and the dep bump is straightforward.

The onContextLoss additions are correct and consistent with the pre-existing catch-block pattern in both files. The dep bump is coherent — addon-webgl intentionally staying at beta.219 while xterm core moves to beta.220 is expected given where the upstream fix landed. The only wrinkle is that packages/host-service was not updated, causing bun to install a second copy of @xterm/headless@beta.219 alongside the new beta.220, which is a workspace-consistency issue but does not affect runtime behaviour.

bun.lock — the new @superset/host-service/@xterm/headless@6.1.0-beta.219 scoped entry signals that packages/host-service/package.json still pins beta.219 and may need a matching bump to clean up the duplicate install.

Important Files Changed

Filename Overview
apps/desktop/package.json Bumps all @xterm/* packages from beta.219 to beta.220; @xterm/addon-webgl intentionally lags at beta.219 (contains the WebGL atlas-merge fix, peer-dep updated to ^6.1.0-beta.220).
apps/web/package.json Aligns @xterm/addon-fit and @xterm/xterm to beta.220 to match desktop workspace — workspace consistency alignment.
apps/desktop/src/renderer/lib/terminal/terminal-addons.ts Adds suggestedRendererType = "dom" to the onContextLoss handler, closing the gap between the catch-block fallback and the GPU-process-death failure mode.
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/helpers.ts Mirrors the same onContextLoss → suggestedRendererType = "dom" fix from terminal-addons.ts for the createTerminalInWrapper code path.
bun.lock Updated hashes for all @xterm/* packages; introduces a new scoped entry @superset/host-service/@xterm/headless@6.1.0-beta.219, meaning host-service was not updated and now installs a second copy of @xterm/headless alongside beta.220.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Terminal Created] --> B{suggestedRendererType == dom?}
    B -- yes --> C[Skip WebGL, use DOM renderer]
    B -- no --> D[rAF: attempt WebglAddon load]
    D --> E{Load succeeds?}
    E -- no / catch --> F[suggestedRendererType = dom]
    F --> C
    E -- yes --> G[WebGL rendering active]
    G --> H{onContextLoss fires?}
    H -- yes --> I[dispose webglAddon]
    I --> J[suggestedRendererType = dom NEW]
    J --> K[terminal.refresh 0..rows-1]
    K --> C
    H -- no --> G
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
bun.lock:6598
**`@superset/host-service` left on `@xterm/headless@6.1.0-beta.219`**

The lockfile now contains a scoped entry `@superset/host-service/@xterm/headless@6.1.0-beta.219` that wasn't present before, meaning bun had to install a second copy because `packages/host-service/package.json` still pins beta.219 while `apps/desktop` and `apps/web` moved to beta.220. The PR description mentions aligning `apps/web` for sherif consistency but doesn't cover `host-service`. Since `@xterm/headless` is headless (no WebGL canvas), the atlas-merge bug itself won't surface there — but two installed copies of the same package add disk bloat and will likely be flagged by the sherif workspace-consistency check on the next run.

Reviews (1): Last reviewed commit: "chore(GH-3572): remove orchestration art..." | Re-trigger Greptile

Comment thread bun.lock

"@slack/web-api/eventemitter3": ["eventemitter3@5.0.4", "", {}, "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw=="],

"@superset/host-service/@xterm/headless": ["@xterm/headless@6.1.0-beta.219", "", {}, "sha512-k0ilgU1jmvW8L1GfR6Zo5tIFEhOZdwsNdmYKx+CkDBobxpu+rHb5O4iD/ehIlxSupGPzOvIw6+1tRJq3Ky+kZw=="],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 @superset/host-service left on @xterm/headless@6.1.0-beta.219

The lockfile now contains a scoped entry @superset/host-service/@xterm/headless@6.1.0-beta.219 that wasn't present before, meaning bun had to install a second copy because packages/host-service/package.json still pins beta.219 while apps/desktop and apps/web moved to beta.220. The PR description mentions aligning apps/web for sherif consistency but doesn't cover host-service. Since @xterm/headless is headless (no WebGL canvas), the atlas-merge bug itself won't surface there — but two installed copies of the same package add disk bloat and will likely be flagged by the sherif workspace-consistency check on the next run.

Prompt To Fix With AI
This is a comment left during a code review.
Path: bun.lock
Line: 6598

Comment:
**`@superset/host-service` left on `@xterm/headless@6.1.0-beta.219`**

The lockfile now contains a scoped entry `@superset/host-service/@xterm/headless@6.1.0-beta.219` that wasn't present before, meaning bun had to install a second copy because `packages/host-service/package.json` still pins beta.219 while `apps/desktop` and `apps/web` moved to beta.220. The PR description mentions aligning `apps/web` for sherif consistency but doesn't cover `host-service`. Since `@xterm/headless` is headless (no WebGL canvas), the atlas-merge bug itself won't surface there — but two installed copies of the same package add disk bloat and will likely be flagged by the sherif workspace-consistency check on the next run.

How can I resolve this? If you propose a fix, please make it concise.

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 5 files

Re-trigger cubic

@Kitenite
Kitenite merged commit bada448 into ParadevAI:main May 24, 2026
2 checks passed
Kitenite added a commit that referenced this pull request May 24, 2026
The xterm bump (#4893) left a stale nested
@superset/host-service/@xterm/headless@6.1.0-beta.219 entry while
host-service's package.json declared 6.1.0-beta.220, breaking
electron-builder's production dep traversal during desktop packaging.
Kitenite added a commit that referenced this pull request May 24, 2026
* feat(desktop): skippable v2 onboarding + Settings re-run entry

- Add a "Skip for now" button to the onboarding footer, available on every
  step (including the GitHub-CLI step). Calls completeOnboarding, refetches
  the session, then routes to /v2-workspaces — the whole flow is escapable,
  not just the gh-cli gate that main already removed.
- Add a "Run setup again" row in Settings → Experimental that re-opens
  onboarding for already-onboarded users. Backed by a transient
  onboarding-rerun store so the layout's onboardedAt redirect makes an
  exception only for this explicit re-launch; not persisted, so a restored
  /onboarding route on next launch falls back to the redirect.
- Footer aligns to the same max-w-2xl px-8 column as the step content (was
  max-w-[1200px] px-12), with a border-t divider. Action cluster grouped
  Linear-style: meta/help left (Back + icon-only Get support tooltip),
  flow actions right (Skip for now, Continue).

* refactor(desktop): replace onboarding rerun store with route search param

* chore: refresh bun.lock to drop stale host-service nested xterm/headless

The xterm bump (#4893) left a stale nested
@superset/host-service/@xterm/headless@6.1.0-beta.219 entry while
host-service's package.json declared 6.1.0-beta.220, breaking
electron-builder's production dep traversal during desktop packaging.
MocA-Love pushed a commit to MocA-Love/superset that referenced this pull request May 25, 2026
…e fix (ParadevAI#4893)

* improvement(ParadevAIGH-3572): capture brief

* improvement(ParadevAIGH-3572): scope proposal v1

* improvement(ParadevAIGH-3572): scope challenged + user pushback note

* improvement(ParadevAIGH-3572): deep-research findings (PR ParadevAI#5883 + beta.220)

* fix(desktop): bump @xterm/* to beta.220 for upstream WebGL atlas-merge fix

Picks up xtermjs/xterm.js#5883 "Fix webgl rendering corruption from atlas
page merges" (merged 2026-05-21 by Tyriar). The PR fixes two atlas-merge
bugs that match the reported symptom in ParadevAI#3572 (and the sibling cluster
canvas after a same-index page swap during merge, so glyphs sample garbage.

Maintainer Tyriar on the PR: "This has been an issue for a long time, I
think it's popped up more recently due to agentic CLIs using a much wider
range of character styles."

Also adds a one-line VSCode-pattern (microsoft/vscode#120393) fallback
inside both onContextLoss handlers: set the module-local
suggestedRendererType = "dom" so subsequent terminals on the same path
avoid WebGL after a context-loss event. Defense-in-depth for the rarer
GPU-process-death class that bypasses the upstream atlas-merge fix.

Refs ParadevAI#3572

* improvement(ParadevAIGH-3572): bind scope to option α (upstream bump + fallback)

* fix(web): align @xterm/* to beta.220 (matches desktop)

* chore(ParadevAIGH-3572): remove orchestration artifacts before PR push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants