fix(computer_use): reconnect cua-driver stdio session between turns#30133
Open
cjinzy wants to merge 1 commit into
Open
fix(computer_use): reconnect cua-driver stdio session between turns#30133cjinzy wants to merge 1 commit into
cjinzy wants to merge 1 commit into
Conversation
cua-driver's stdio MCP subprocess exits after each tool call sequence (initialize → calls → shutdown). _CuaDriverSession cached the session object, so the second capture() call tried to write to a dead pipe, resulting in empty exceptions and "capture failed". This adds a single retry in _CuaDriverSession.call_tool(): on any transport error, tear down the session and re-spawn a fresh stdio connection, then retry the same tool call once. Also adds --no-daemon-relaunch to _CUA_DRIVER_ARGS so the stdio process stays in-process (matching the terminal's TCC context) rather than relaunching via open -a CuaDriver. Fixes NousResearch#24170 (capture fails on 2nd+ call).
28aa5fe to
0c663e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: cua-driver stdio MCP subprocess exits after each tool call sequence. _CuaDriverSession cached the dead session, so 2nd+ capture() failed with empty exceptions (fixes #24170).
Fix: call_tool() now:
Also adds --no-daemon-relaunch to _CUA_DRIVER_ARGS to keep the driver in-process (matching terminal TCC context).
Reviewed by: Codex CLI -- flagged thread-safety, broad exception handling, and resource cleanup; all addressed in v2 of this patch.