Skip to content

Fix: eliminate visible repaint flicker when switching agents and workspaces - #143

Merged
DevMando merged 7 commits into
mainfrom
codex/multi-agent-rendering
Nov 13, 2026
Merged

DevMando merged 7 commits into
mainfrom
codex/multi-agent-rendering

Conversation

@DevMando

@DevMando DevMando commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Switching agents or workspaces could make the CLI feel sluggish. The most noticeable case was moving from a workspace with three agents to a blank workspace: users could watch a black sweep clear the screen from top to bottom.

This PR makes those transitions smoother by delivering each completed screen update together and removing unnecessary redraws. The updated build was tested interactively, and the visible black sweep was confirmed resolved in the user's terminal.

What improves

  • Agent highlighting and workspace switching produce fewer repeated screen updates.
  • Switching from a busy, multi-agent workspace to a blank conversation no longer exposes the same row-by-row clearing effect in the tested terminal.
  • Idle workspaces stop rebuilding their content when nothing has changed.
  • Longer conversations avoid repeatedly copying and reorganizing unchanged history during status updates.

How it works

The CLI previously delivered screen updates in many small pieces. This change collects a completed frame and sends it to the terminal in one write, with synchronized-output controls that ask supporting terminals to present it together.

Workspace switching now sends one completed change notification instead of three. Status and Git indicators refresh only when their values change, and unchanged conversation history is reused. Background sessions, streamed replies, tool expansion, and keyboard focus retain their existing behavior.

Validation

  • All 59 selected rendering, workspace, and output-routing tests passed on both .NET 8 and .NET 10.
  • A test using RazorConsole's actual renderer switches from 38 occupied rows to a blank screen. It verifies that the output remains identical while being delivered in one write.
  • Additional checks cover agent focus, idle updates, workspace transitions, new and cleared conversations, late agent replies, and cleanup if a screen update is interrupted.
  • Manual testing confirmed improved agent switching and resolution of the black sweep when moving from three agents to a blank workspace.
  • An earlier full-suite run during this work passed 1,924 tests with one skip on .NET 10. On .NET 8, 1,923 passed, one skipped, and the previously observed ACP command-notification timeout occurred. The final frame-delivery change was validated with the 59 selected tests above; the full suite was not rerun after that change.

Changelog and scope

The changelog is updated under [Unreleased], preserving Tesey's ACP client (#140), the RazorConsole upgrade (#141), and Codex ACP support (#142).

These improvements apply to native and ACP panes in the MandoCode CLI. Visual results can vary by terminal, particularly where synchronized output is unsupported. Cross-terminal performance measurements remain future work.

Make closing an already-closed workspace picker a no-op, preventing tab selection from focusing the previous agent before the intended one. Poll top-level chrome for actual status/tip changes instead of rerendering all agents every 300ms.

Let the root propagate workspace and resize changes once rather than subscribing each nested view to the same events. Skip unchanged Git-header renders. Retain standalone workspace subscriptions, deferred focus, dimming, and per-session streaming refresh.
Reproduce three failures on the prior implementation: unnecessary closed-picker refocus, two transitions per tab selection, and six idle agent-body rebuilds over 750ms. Verify no extra idle rebuilds after the fix, one repaint per agent on focus, and refresh only when awaiting-input state changes.

All 54 focused workspace and transcript checks pass on net8.0 and net10.0. Record the behavior and regression evidence under Unreleased.
Cache session entry arrays until append or clear, and preserve transcript partitions when the entry snapshot is unchanged. Keep transient status and mutable tool and agent activity live. Add regressions for long histories, clear, preview updates, expansion, and late agent replies.
Enable RazorConsole synchronized output so terminals supporting DEC mode 2026 present completed frames together during pane dimming and workspace switches.
Suppress intermediate registry notifications while updating workspace visibility and restoring pane focus. Preserve nested transition batching and add a regression asserting one notification with final visibility and focus state.
Buffer output only between synchronized-frame markers, then deliver the completed frame together. Preserve terminal capabilities and normal output, handle fragmented markers, bound buffering, and close interrupted frames on shutdown. Verify identical ANSI output through the actual RazorConsole live canvas for a large-to-blank transition, plus workspace and routing regressions.
Keep Tesey's ACP client, RazorConsole upgrade, and Codex ACP entries under Unreleased. Add rendering highlights, frame-delivery evidence, and accurate targeted and full-suite validation history.
@DevMando DevMando changed the title Smooth agent and workspace switching and reduce terminal repaint flicker Fix: eliminate visible repaint flicker when switching agents and workspaces Nov 13, 2026
@DevMando
DevMando merged commit 877f820 into main Nov 13, 2026
4 checks passed
@DevMando
DevMando deleted the codex/multi-agent-rendering branch November 13, 2026 06:39
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.

1 participant