Skip to content

feat(mcp): elicitation during tool execution (phase 2)#2545

Merged
bug-ops merged 2 commits intomainfrom
elicitation-during-tool-exec
Mar 31, 2026
Merged

feat(mcp): elicitation during tool execution (phase 2)#2545
bug-ops merged 2 commits intomainfrom
elicitation-during-tool-exec

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 31, 2026

Summary

  • Fix deadlock: agent loop now drains MCP elicitation events concurrently with tool tier futures via tokio::select! in execute_native_tool_calls; previously MCP servers sending elicitation mid-tool-call would deadlock
  • Add TUI interactive modal dialog (ElicitationDialogState + widgets::elicitation) with keyboard navigation (Tab/Shift+Tab/Space/Up/Down/Enter/Esc); overrides vi-mode while active
  • Add Telegram sequential prompt flow with 120s per-field timeout, 1-based enum indexing, /cancel support, and sanitize_field_key() applied to all JSON response keys

Issues

Fixes #2522
Tracked: #2542 (elicitation deadlock in run_inline_tool_loop — phase 3)

Test plan

  • cargo nextest run --workspace --features full --lib --bins — 7665/7665 PASS
  • cargo clippy --features full --workspace -- -D warnings — PASS
  • cargo +nightly fmt --check — PASS
  • Live session test: MCP server with elicitation support — verify elicitation dialog appears mid-tool-call in CLI, TUI, and Telegram modes

@github-actions github-actions bot added enhancement New feature or request size/XL Extra large PR (500+ lines) documentation Improvements or additions to documentation channels zeph-channels crate (Telegram) rust Rust code changes core zeph-core crate and removed enhancement New feature or request size/XL Extra large PR (500+ lines) labels Mar 31, 2026
@bug-ops bug-ops force-pushed the elicitation-during-tool-exec branch from 7937e64 to 5282718 Compare March 31, 2026 19:13
@bug-ops bug-ops enabled auto-merge (squash) March 31, 2026 19:13
@github-actions github-actions bot added enhancement New feature or request size/XL Extra large PR (500+ lines) labels Mar 31, 2026
bug-ops added 2 commits March 31, 2026 21:18
- Fix deadlock: drain elicitation_rx concurrently with tool tier futures
  via tokio::select! loop in execute_native_tool_calls
- TUI: ElicitationDialogState widget with field navigation and render
- TUI: TuiChannel::elicit() via AgentEvent::ElicitationRequest oneshot
- Telegram: TelegramChannel::elicit() with sequential prompts, 120s timeout
- Security: sanitize all MCP-provided strings (ANSI, control chars)
- ELICITATION_TIMEOUT constant in zeph-channels
- Add 4 unit tests for TelegramChannel::elicit():
  - happy path string field → Accepted with correct key/value
  - /cancel command → Cancelled
  - timeout logic (rx-level isolation, matching confirm pattern)
  - sanitize_field_key strips dashes, spaces, special chars

- Fix sanitize_field_key test: function only strips non-alphanumeric/
  underscore chars, not ANSI sequences — corrected test assertion

- Update coverage-status.md: add row for MCP elicitation phase 2
  (status: Untested) in the zeph-mcp section
@bug-ops bug-ops force-pushed the elicitation-during-tool-exec branch from 5282718 to b9b99ef Compare March 31, 2026 19:18
@bug-ops bug-ops merged commit 101c51f into main Mar 31, 2026
27 checks passed
@bug-ops bug-ops deleted the elicitation-during-tool-exec branch March 31, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channels zeph-channels crate (Telegram) core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(mcp): elicitation during tool execution — phase 2

1 participant