Skip to content

Conversation

@OscSer
Copy link

@OscSer OscSer commented Jan 18, 2026

What does this PR do?

Prevents Command.state() from waiting on MCP prompt loading, allowing user commands to appear immediately on startup without being blocked by MCP initialization.

Key changes:

  • Separates user command loading (synchronous) from MCP command loading (background)
  • Initializes MCP commands asynchronously via Command.initMCPCommands() called during bootstrap
  • Publishes command.updated event when MCP commands are ready, syncing the TUI without blocking
  • Reduces startup impact from slow or failing remote MCPs (which attempt two transports sequentially: StreamableHTTP → SSE)
  • Adds guard clause in Session.prompt.command() to handle missing commands gracefully

How did you verify your code works?

  • Tested with multiple remote MCPs configured
  • Verified custom user commands appear immediately on startup without waiting for MCP initialization
  • Confirmed MCP commands appear progressively as each MCP finishes loading

Issues

Fixes #8868
Fixes #8017

@github-actions
Copy link
Contributor

Hey! Your PR title Avoid blocking command load on MCP init doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@OscSer OscSer changed the title Avoid blocking command load on MCP init fix: defer MCP command loading to background Jan 18, 2026
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.

Agents and Commands are not shown Custom slash commands not available until ~1 minute after startup

1 participant