Skip to content

TUI: route elicitation responses to request thread#23241

Merged
etraut-openai merged 1 commit into
mainfrom
etraut/fix-elicitation-thread-routing
May 18, 2026
Merged

TUI: route elicitation responses to request thread#23241
etraut-openai merged 1 commit into
mainfrom
etraut/fix-elicitation-thread-routing

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai commented May 18, 2026

Why

Fixes #21894.

When the TUI handles an MCP elicitation, the request payload already includes the thread that generated the elicitation. ChatWidget::handle_elicitation_request_now was ignoring that value and using the currently visible chat thread instead. In a multi-session TUI, that can send resolve_elicitation to an older visible thread rather than the session that owns the pending elicitation, producing elicitation request not found and leaving the prompt unresolved.

What changed

  • Parse McpServerElicitationRequestParams.thread_id in the ChatWidget elicitation handler and use it for app-link, form, fallback approval, and auto-decline resolution paths.
  • Keep the existing visible-thread fallback only for malformed request payloads with an invalid thread id.
  • Update the invalid URL elicitation regression test so the visible thread and request thread intentionally differ.

@etraut-openai etraut-openai changed the title fix(tui): route elicitation responses to request thread tui: route elicitation responses to request thread May 18, 2026
@etraut-openai etraut-openai changed the title tui: route elicitation responses to request thread TUI: route elicitation responses to request thread May 18, 2026
Copy link
Copy Markdown
Contributor

@canvrno-oai canvrno-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with an MCP server

@etraut-openai etraut-openai merged commit 53a1f4c into main May 18, 2026
31 checks passed
@etraut-openai etraut-openai deleted the etraut/fix-elicitation-thread-routing branch May 18, 2026 18:33
@github-actions github-actions Bot locked and limited conversation to collaborators May 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: resolve_elicitation routed to wrong thread_id on multi-session race condition

2 participants