Skip to content

Fix abort turn handling#1

Open
shayne wants to merge 2 commits intomainfrom
fix-abort-turn-handling
Open

Fix abort turn handling#1
shayne wants to merge 2 commits intomainfrom
fix-abort-turn-handling

Conversation

@shayne
Copy link
Owner

@shayne shayne commented Jan 29, 2026

fix: respond to tool calls on turn aborted

Issue:

  • tools/call requests can hang after a user aborts a turn, leaving the MCP request open
  • subsequent prompts may be ignored because the prior request still owns the response

Reason:

  • the MCP tool runner ignored EventMsg::TurnAborted, so it never sent a response or cleared the request map

Solution:

  • send a CallToolResult marked isError on TurnAborted, remove the request from the map, and exit the event loop
  • add a regression test that cancels an in-flight tool call and asserts a response is returned
  • add a test helper to send notifications/cancelled

Test:

  • cargo test -p codex-mcp-server -- test_tool_call_returns_on_turn_aborted

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.

1 participant