Skip to content

fix(acp): dispatch Code Mode callbacks on main runtime to prevent hangs - #10484

Merged
Abhijay007 merged 2 commits into
aaif-goose:mainfrom
Abhijay007:fix/code-mode-callback-cross-runtime-hang
Jul 17, 2026
Merged

fix(acp): dispatch Code Mode callbacks on main runtime to prevent hangs#10484
Abhijay007 merged 2 commits into
aaif-goose:mainfrom
Abhijay007:fix/code-mode-callback-cross-runtime-hang

Conversation

@Abhijay007

@Abhijay007 Abhijay007 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

fixes : #10463

Summary

problem was : execute_typescript intermittently hangs when a Code Mode callback calls a subprocess MCP tool (e.g. Tavily). The callback dispatch uses Tokio primitives (Mutex, oneshot) that must be driven by the main multi-thread runtime, but the Deno op executor runs on a current_thread runtime. Polling these primitives across runtime boundaries leaves wakers stale — the task never gets woken up and hangs indefinitely.

to fix this : Capture tokio::runtime::Handle::current() in handle_execute_typescript and thread it down to create_tool_callback. The full dispatch + result-await is wrapped in rt.spawn(...) so it runs on the main runtime. The Deno op only awaits the JoinHandle, which is safe across runtime boundaries.

Testing

mannual and test

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ce8e4e763

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/goose/src/agents/platform_extensions/code_execution.rs

@michaelneale michaelneale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice one.

@Abhijay007
Abhijay007 added this pull request to the merge queue Jul 17, 2026
Merged via the queue into aaif-goose:main with commit f13ae10 Jul 17, 2026
25 checks passed
@Abhijay007
Abhijay007 deleted the fix/code-mode-callback-cross-runtime-hang branch July 17, 2026 10:28
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.

execute_typescript intermittently hangs when calling subprocess MCP tools

2 participants