You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(web-ui,session-runtime): coalesce list updates, reuse thread forest, and offload running animations to GPU - #1187
Fixes severe CPU saturation and UI lag in the macOS CodexHost.app WKWebView shell (and reduces background Web UI CPU in browsers) when hundreds of local/remote Threads are loaded with live sessions running:
Deduplicate identical server projection writes (packages/session-runtime/src/session-log.ts):
SessionLog.setProjection now skips writing projections.json and skips invoking onProjection when the new value is structurally equal to the current stored value.
Filter, deduplicate, and frame-coalesce client session-list updates (apps/web-ui/packages/api/session-controller/src/client/sessions/):
ProjectionValueStore skips notifications on structurally identical apply/applyLive/applyCached/seed writes and supports ignoring conversation-only high-frequency keys (WEB_FOLLOW_PROJECTION_KEYS, codexhostUsage, codexhostTurnTimes, contextPressure, contextBreakdown, inbox, queueState, turnOutline, sessionStats, compacting) on its coarse subscribeAny channel while keeping per-key useProjection updates immediate.
SessionManager batches live WebSocket stream list updates (handleControlFrame, handleSessionAdded/Removed/Status/Activity, projectionStore updates) through Notifier.markFrameDirty() (requestAnimationFrame in browsers, microtask fallback in Node), avoids cloning arrays or dirtying on no-op mutations in applyMutation, and caches unchanged projectionsBySession entries.
ClientSessions.projectList reuses cached SessionSummary rows when entry and retainedBy are unchanged.
Narrowed ThreadTreeViewProvider workspace subscriptions and exposed the memoized forest through context.
Added optional precomputed forest/roots/order reuse to threadTreeOrderSource, pinOrderSource, deriveGroups, deriveFlat, and nativeSectionLayout, plus an empty-list short-circuit in deriveFlat, eliminating 4–5 redundant full-catalog forest derivations per sidebar render.
Offload running-state animations to GPU compositing (StateDot.module.css, TextShimmer.module.css, ThreadTreeRing.module.css):
Removed the non-composited SVG stroke-dasharray/stroke-dashoffset animation on .spinnerArc while keeping the 1.5s transform: rotate(360deg) spin at the midpoint arc geometry, switched TextShimmer from steps(48, end) to linear, and added will-change: transform + contain: layout style paint isolation.
Related issues
N/A
UI Demo
No visual changes: StateDot keeps the same 1.5s continuous spinning arc at its existing midpoint geometry (stroke-dasharray: 18 150), and TextShimmer / ThreadTreeRing preserve the same sweep and rotation effects with GPU compositor hints and CSS containment.
npx vitest run on apps/web-ui/packages/api/session-controller/test/{archived-query,prompt-delivery}.test.ts — 16/16 passed (including new chat-only key filtering, no-op suppression, and requestAnimationFrame coalescing test)
The change reduces CPU use and UI lag from redundant projection updates. A few edge cases can leave the list showing stale state until the next update: a projection briefly disappearing after a race, a stale "discovered by direct read" flag, or an outdated running state on subagent rows. These are narrow and self-recovering, so they should be fixed in follow-up or before merge, but they are not likely to cause serious failures.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Applicability reference: AGENTS.md: # Repository Guidelines `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees.
Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: docs/product/standalone-web.md:0-0
Timestamp: 2026-11-25T14:42:04.148Z
Learning: Applies to apps/web-ui/** : Applicability reference:
AGENTS.md: # Repository Guidelines
## Testing & Completion
- `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees. Both interrupt running tasks: run them only when the user asks, never as validation. Details: `docs/product/standalone-web.md`.
Source excerpt:
# 独立 Web 应用
## 代码与构建
- `apps/web-ui`:从 DSH 衍生的浏览器界面、Cordis 浏览器运行时与协议源码;仅保留所选界面依赖,来源和许可见其 README。未迁入 DSH CLI、独立 Agent Loop、原仓库 CI 或 Git 历史。
Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: docs/product/standalone-web.md:0-0
Timestamp: 2026-11-24T16:39:52.636Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Testing & Completion
- `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees. Both interrupt running tasks: run them only when the user asks, never as validation. Details: `docs/product/standalone-web.md`.
Source excerpt:
# 独立 Web 应用
## 代码与构建
仓库统一使用 npm Workspace 和 `package-lock.json`。Web 消费公共插件上下文与命令类型;现有会话投影仍使用结构化类型子集,并不是新的 Harness 专属实现。旧 DSH 协议字段 `provider` 在本应用中携带 Harness ID,不表示 Model Provider。
```sh
npm ci
npm run build:web
npm start web
# 4400 已有旧 Web 服务时,不重启 Desktop;改用另一端口:
npm start web -- --port 4401
```
The codexhostTurnChanges producer in publishFileChanges builds a new top-level value on each call, and summarizeTurnDiffs does not mutate the previous summary. The Object.is shortcut cannot return true for this key, so the skipped write path described in the comment is not reached through this producer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes severe CPU saturation and UI lag in the macOS
CodexHost.appWKWebView shell (and reduces background Web UI CPU in browsers) when hundreds of local/remote Threads are loaded with live sessions running:packages/session-runtime/src/session-log.ts):SessionLog.setProjectionnow skips writingprojections.jsonand skips invokingonProjectionwhen the new value is structurally equal to the current stored value.apps/web-ui/packages/api/session-controller/src/client/sessions/):ProjectionValueStoreskips notifications on structurally identicalapply/applyLive/applyCached/seedwrites and supports ignoring conversation-only high-frequency keys (WEB_FOLLOW_PROJECTION_KEYS,codexhostUsage,codexhostTurnTimes,contextPressure,contextBreakdown,inbox,queueState,turnOutline,sessionStats,compacting) on its coarsesubscribeAnychannel while keeping per-keyuseProjectionupdates immediate.SessionManagerbatches live WebSocket stream list updates (handleControlFrame,handleSessionAdded/Removed/Status/Activity,projectionStoreupdates) throughNotifier.markFrameDirty()(requestAnimationFramein browsers, microtask fallback in Node), avoids cloning arrays or dirtying on no-op mutations inapplyMutation, and caches unchangedprojectionsBySessionentries.ClientSessions.projectListreuses cachedSessionSummaryrows whenentryandretainedByare unchanged.deriveThreadForestrebuilds (apps/web-ui/packages/client/ui-workspace/src/client/):ThreadTreeViewProviderworkspace subscriptions and exposed the memoizedforestthrough context.threadTreeOrderSource,pinOrderSource,deriveGroups,deriveFlat, andnativeSectionLayout, plus an empty-list short-circuit inderiveFlat, eliminating 4–5 redundant full-catalog forest derivations per sidebar render.StateDot.module.css,TextShimmer.module.css,ThreadTreeRing.module.css):stroke-dasharray/stroke-dashoffsetanimation on.spinnerArcwhile keeping the 1.5stransform: rotate(360deg)spin at the midpoint arc geometry, switchedTextShimmerfromsteps(48, end)tolinear, and addedwill-change: transform+contain: layout style paintisolation.Related issues
N/A
UI Demo
No visual changes:
StateDotkeeps the same 1.5s continuous spinning arc at its existing midpoint geometry (stroke-dasharray: 18 150), andTextShimmer/ThreadTreeRingpreserve the same sweep and rotation effects with GPU compositor hints and CSS containment.Test plan
Automated tests & builds executed locally:
npx tsc -b packages/session-runtime— passednode --import tsx --test packages/web-server/test/ch-scoped-projections.test.ts packages/web-server/test/ch-catalog-updates.test.ts packages/web-server/test/usage-projection.test.ts packages/web-server/test/projector.test.ts packages/web-server/test/ch-realtime.test.ts packages/web-server/test/remote-sessions.test.ts— 82/82 passed (including newSessionLog.setProjectiondedup test)npx vitest runonapps/web-ui/packages/api/session-controller/test/{archived-query,prompt-delivery}.test.ts— 16/16 passed (including new chat-only key filtering, no-op suppression, andrequestAnimationFramecoalescing test)node --import tsx --test apps/web-ui/packages/client/ui-workspace/test/thread-tree.test.ts— 17/17 passed (including precomputed forest/order parity and emptyderiveFlatshort-circuit test)node --import tsx apps/web-ui/scripts/build.ts— all 43 client plugins and Vite bundle built cleanlynpx prettier --checkon modified files — formatted cleanly before commitLive verification (macOS 15.6.1 arm64, locally packed
0.26.1CodexHost.appwith ~487 local + remote peer Threads over 28 minutes):WebKit.WebContent: 100%–123% CPU / 1.35–2.3 GB (locked) -> 0.0% idle, 5.2% 28-min avg / 536 MB (stable sawtooth GC)WebKit.GPU: 10%–13% CPU -> 0.0% idle, 0.7% 28-min avg / 35 MBCodexHost.app: 0.0% idle, 0.4% 28-min avg / 27 MBNot run locally: full-repo
npm run check/npm run lint(deferred to CI).