Skip to content

fix(mcp+chat): spawn_blocking tool execution; never drop typed input - #126

Merged
ajianaz merged 2 commits into
developfrom
fix/mcp-blocking-chat-drops
Sep 22, 2026
Merged

ajianaz merged 2 commits into
developfrom
fix/mcp-blocking-chat-drops

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

What (description of the change)

Two cora full-scan MAJORs, one PR:

  1. mcp_server.rs — call_tool now runs execute_checked via tokio::task::spawn_blocking. Tool execution is synchronous and can block for a long time (git 120s, run_command 420s budgets); running it inline pinned the async runtime's workers, stalling every other request the server was serving. RegistryServer is now Clone (Arc-shared registry) so a handle moves into the blocking task.
  2. chat REPL (main.rs) — the mid-flight resolve loop flagged dropped_message only for ApprovalRequired/ProviderFailed. UnknownTool, BudgetExhausted, LoopDetected, and Storage outcomes — and the resolve Err path — silently continued as if the typed line had been recorded. All of them now set dropped_message (the "message you just typed was NOT recorded" note), and the Err path prints the same note before bailing.

Why (the problem you're solving)

Closes #121 (cora full-scan MAJORs #29 and #7). #29 starves the MCP server's runtime under one slow tool. #7 violates B1's core contract — the dispatch loop must never drop user input silently.

Testing (how you verified this works)

  • All 5 existing MCP end-to-end tests exercise the new spawn_blocking path (mcp feature): lists, schemas, write-without-allow, write-with-allow, destructive-absent, unknown-tool — all green.
  • Full workspace suites green; mobile (--no-default-features) green; clippy -D warnings clean; cora review: No issues found.

…121)

- mcp_server call_tool runs execute_checked (subprocess waits of up
  to 420s) via tokio::task::spawn_blocking so one slow tool call
  cannot pin the async runtime's workers; RegistryServer is now
  Arc-Clone to move a handle into the blocking task. Existing
  end-to-end MCP tests exercise the new path (mcp feature).
- chat REPL resolve loop: UnknownTool / BudgetExhausted /
  LoopDetected / Storage outcomes and resolve Err now flag
  dropped_message (the typed line never reached the durable log) and
  the Err path prints the same NOT-recorded note before bailing —
  closing the silent-input-drop gap cora full-scan #7 flagged for
  non-retryable outcomes (B1 contract: user input is never silently
  dropped).
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit a4dddd1 into develop Sep 22, 2026
16 checks passed
@ajianaz
ajianaz deleted the fix/mcp-blocking-chat-drops branch September 22, 2026 15:29
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.

mcp_server: spawn_blocking for tool execution; chat: never drop typed input silently

1 participant