Skip to content

🤖 perf: speed up workspace-open transcript paint#2426

Merged
ammario merged 4 commits intomainfrom
perf/workspace-open-optimizations
Feb 14, 2026
Merged

🤖 perf: speed up workspace-open transcript paint#2426
ammario merged 4 commits intomainfrom
perf/workspace-open-optimizations

Conversation

@ammar-agent
Copy link
Collaborator

Summary

Follow-up perf pass for workspace-open rendering that reduces critical-path work in the transcript UI and message utilities. This improves startup paint times for loaded workspaces, especially on long tool-heavy histories.

Background

PR #2397 added automated perf profiling for workspace-open flows. Those artifacts showed recurring renderer-side hot spots during initial transcript paint (message-row prop churn, per-row grouping scans, and unnecessary live subscriptions after completion).

Implementation

  • ChatPane render-path reductions
    • Precompute bash_output grouping once per message snapshot (computeBashOutputGroupInfos) instead of per-row scans.
    • Pass taskReportLinking only to task / task_await rows.
    • Precompute stable userMessageNavigation objects by historyId so non-message state bumps stop invalidating row props.
  • Workspace caught-up sequencing
    • Defer the caught-up usageStore.bump() to idle (requestIdleCallback with timeout fallback) so initial transcript paint is prioritized.
  • Reasoning row rendering
    • Use a plain truncated summary line in collapsed headers.
    • Avoid rendering full collapsed markdown body unless expanded/streaming.
  • Bash row subscriptions
    • Gate live-output / latest-streaming / foreground-id subscriptions to rows that still need live state (executing or completed-without-final-output).
  • Transcript truncation policy
    • Reduce MAX_DISPLAYED_MESSAGES from 128 → 64.
    • Preserve user prompts + structural markers by default; allow older assistant/tool/reasoning rows to stay behind history-hidden until “Load all”.
  • Desktop dist/e2e stability fix
    • Replace @/... alias imports in src/desktop/main.ts with relative imports so dist runs do not emit unresolved alias require() calls.

Validation

  • bun test src/browser/utils/messages/messageUtils.test.ts src/browser/utils/messages/StreamingMessageAggregator.test.ts src/browser/stores/WorkspaceStore.test.ts
  • make static-check
  • Perf scenario (dist build path):
    • MUX_E2E_RUN_PERF=1 MUX_PROFILE_REACT=1 MUX_E2E_LOAD_DIST=1 xvfb-run -a bun x playwright test tests/e2e/scenarios/perf.workspaceOpen.spec.ts --project=electron --workers=1

Perf wall-time (isolated profile runs)

Profile Before (ms) After (ms) Delta
small 211 202 -4.3%
medium 212 186 -12.3%
large 244 200 -18.0%
tool-heavy 252 185 -26.6%
reasoning-heavy 174 171 -1.7%

Risks

  • Transcript visibility tradeoff (intentional): older assistant rows can now be omitted behind history-hidden by default; users can restore with “Load all”.
  • Reasoning header formatting tradeoff (intentional): collapsed summary is plain text (no markdown formatting) to avoid markdown render cost in headers.
  • Bash subscription gating: completed rows now skip live subscriptions unless needed; behavior still preserves executing and completed-without-output cases.

Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $4.95

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49c9a72a39

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Tighten the workspace-open critical path by reducing message-row recomputation,
cutting unnecessary live subscriptions, and deferring non-critical usage updates.
Also fix dist/e2e startup by replacing desktop alias imports that were emitted as
unresolved runtime requires.

---

_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$4.95`_

<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=4.95 -->
Keep latest-streaming bash subscription active for expanded rows so auto-expanded
completed rows still collapse when a newer bash starts. This avoids a regression
introduced by over-scoping live subscription guards.

---

_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$4.95`_

<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=4.95 -->
Fix a regression where completed reasoning blocks immediately re-collapsed after
clicking expand. Auto-collapse now only triggers on streaming->completed
transitions.

Also add a lightweight summary parser for leading markdown bold segments
(`**...**`) so common OpenAI reasoning headers keep their emphasis without
bringing back full markdown rendering on collapsed rows.

---

_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$4.95`_

<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=4.95 -->
@ammar-agent ammar-agent force-pushed the perf/workspace-open-optimizations branch from d4e6120 to 4d2c6ad Compare February 14, 2026 17:23
@ammar-agent
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent ammar-agent force-pushed the perf/workspace-open-optimizations branch from c12821e to 7634bbc Compare February 14, 2026 17:43
@ammario ammario merged commit ae562a1 into main Feb 14, 2026
23 checks passed
@ammario ammario deleted the perf/workspace-open-optimizations branch February 14, 2026 17:54
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