Skip to content

Fix startup screen filling with repeated prompt borders (v0.16.2) - #138

Merged
DevMando merged 1 commit into
mainfrom
fix/focus-reentrancy-duplicate-render
Nov 11, 2026
Merged

DevMando merged 1 commit into
mainfrom
fix/focus-reentrancy-duplicate-render

Conversation

@DevMando

Copy link
Copy Markdown
Owner

Summary

Fixes the startup bug where MandoCode opened to a screen full of repeated prompt borders and the first agent could not take input. Ships as v0.16.2.

Startup screen before this fix

What users experienced

  • On launch, the area below the agent header filled with rows of prompt borders instead of the welcome screen and prompt.
  • The first agent was stuck. Typing did nothing.
  • The only way out was a workaround: open a second agent (Alt+N), then close the first one (Alt+W).
  • It happened on some launches and not others, which made it look random. It has been in the product since v0.16.0 (October 6).

Why it happened

When the prompt appears, MandoCode asks the screen framework (RazorConsole 0.6.0) to give it keyboard focus. If that request landed at exactly the wrong moment, while the framework was still drawing, the framework drew the same update twice. The prompt and everything inside it ended up on screen in duplicate, many times over, and the layout collapsed into the rows of borders shown above.

The "wrong moment" depended on background timing, which is why it was intermittent. The v0.16.1 startup fix targeted a different timing problem, so it did not resolve this one.

What this PR changes

  • Focus requests made while a screen element is still being drawn now wait until drawing has finished. This applies to the prompt and to every panel that takes focus when it opens (16 components, one line each).
  • One new helper, DeferredFocus, holds that rule in one place and documents the reason.
  • Focus changes triggered by key presses and clicks are untouched.
  • Version bumped to 0.16.2, changelog and README patch note updated, and the screenshot added to the docs.

How it was verified

  • Reproduced first. The released 0.16.1 tool was launched in an automated terminal and showed the broken screen. Forcing the timing made an unfixed build fail 5 of 5 launches.
  • Fix confirmed. With the same forced timing, the fixed build failed 0 of 11 launches, and typed text reached the prompt.
  • Release package checked. The packed 0.16.2 tool was installed in isolation and launched 5 times: 0 failures.
  • Test suite. All 1,247 tests pass on both .NET 10 and .NET 8.

…pare v0.16.2

On some launches the first agent drew its prompt as rows of bottom
borders and could not take input.

PromptInput requests focus from OnAfterRenderAsync. When RazorConsole's
focus manager already knew the prompt's key, it dispatched focusin and
focusout inside the render batch still in progress. That event's render
pass started before the batch was cleared, so RazorConsole 0.6.0 applied
the batch a second time and inserted every component it created twice.
Whether the key was already known depended on a thread-pool observer,
which made the failure intermittent.

Focus requests made from OnAfterRenderAsync now go through DeferredFocus,
which yields to the dispatcher so the batch finishes first. Focus calls
in key and click handlers are unchanged.

Also bumps the version to 0.16.2, rolls the changelog, and adds a
screenshot of the failure.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@DevMando
DevMando merged commit 641fed5 into main Nov 11, 2026
3 of 4 checks passed
@DevMando
DevMando deleted the fix/focus-reentrancy-duplicate-render branch November 11, 2026 18:25
DevMando added a commit that referenced this pull request Nov 11, 2026
TeseySTD pushed a commit to TeseySTD/MandoCode that referenced this pull request Nov 12, 2026
…embedding it

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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