Skip to content

fix: TUI first paint no longer waits on companion MCP - #664

Closed
justrach wants to merge 3 commits into
mainfrom
cursor/tui-boot-hang-4ffc
Closed

fix: TUI first paint no longer waits on companion MCP#664
justrach wants to merge 3 commits into
mainfrom
cursor/tui-boot-hang-4ffc

Conversation

@justrach

@justrach justrach commented Aug 28, 2026

Copy link
Copy Markdown
Owner

What you saw

graff tui --yolo
plugins: 16 plugin(s) in 1ms (7 dirs)

Then nothing for a long time. Plugin scan was already fine. The hang was the next work, with no receipt.

Where the time went

After plugins:, interactive --yolo still did two things on the main thread before the alt screen:

  1. Companion auto-connect. Deferred MCP leaves registry.tools empty, so a PATH-installed codedb-pro looked “not connected” and addServer ran the full stdio probe + handshake (5s / 15s caps) in front of first paint.
  2. codedb-pro probe with timeout 0. If that binary blocks, boot never continues.

A defer_join fan-out that could not io.concurrent also fell back to io.async, which can run the handshake inline.

What we did

  • Print dim receipts after plugins: so the next phase is named:
    • mcp: N server(s) in background / mcp: connecting N server(s)...
    • mcp: ready in Xms if that wait is ≥80ms
    • companion: codedb-pro (background)
  • Queue companion onto pending_starts on interactive --yolo (same as ADR 0035 MCP defer). Native tools run now; catalogs merge on the next request.
  • Cap codedb-pro probe at 2s.
  • Skip a server rather than inline-async when defer_join cannot get a thread.
  • Print any boot phase ≥80ms without GRAFF_BOOT_DEBUG.

How it looks

Line REPL (graff --yolo) keeps the same dim plugins: line and adds two siblings:

plugins: 16 plugin(s) in 1ms (7 dirs)
mcp: 3 server(s) in background
companion: codedb-pro (background)

graff tui --yolo prints those, then takes the alt screen. First paint is the welcome composer — no plugins: / companion: on the grid.

Check

graff tui --yolo should paint right after the plugin line. You should see companion: codedb-pro (background) if the binary is on PATH. MCP tools still arrive on the next turn / /mcp.

Opt out of the companion the same way as before: {"skills": {"codedbpro": false}}.

Tier 1 green (1762 tests).

Open in Web Open in Cursor 

After the plugins receipt, interactive --yolo still handshook
codedb-pro on the main thread (registry empty under defer_join)
and probed with timeout 0. Print mcp/companion receipts, queue
the companion like deferred MCP, cap the probe, and skip inline
io.async when concurrent fails.
The previous check rejected any '256, 256, 0' substring, including
the comment that explained the old unbounded runCapped.
@justrach
justrach marked this pull request as ready for review August 28, 2026 11:33
plugins:/mcp:/companion: are the same dim session_notice as the
existing plugins line. connectCompanion with a PATH stub emits
the companion receipt and does not addServer. TUI first paint
stays the welcome composer — those lines print before alt-screen.
cursor Bot pushed a commit that referenced this pull request Aug 29, 2026
…companion MCP

Queue codedb-pro onto pending_starts on interactive --yolo, cap the
license probe at 2s, and print dim mcp:/companion: receipts after
plugins: so a hang is named.
cursor Bot pushed a commit that referenced this pull request Aug 29, 2026
Companion MCP queues in the background so first paint is not the
handshake. Mid-turn stall/reconnect stays off the transcript.
@justrach

Copy link
Copy Markdown
Owner Author

Landed on release/v0.0.281 (#670) as merge 54601b1. Closing this vs main so it does not double-land; it ships when 281 merges.

@justrach justrach closed this Aug 29, 2026
@cursor
cursor Bot deleted the cursor/tui-boot-hang-4ffc branch August 31, 2026 01:31
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