refactor: remove unnecessary Arc<Mutex> from tool execution pipeline#7979
Merged
jh-block merged 2 commits intoblock:mainfrom Mar 18, 2026
Merged
refactor: remove unnecessary Arc<Mutex> from tool execution pipeline#7979jh-block merged 2 commits intoblock:mainfrom
jh-block merged 2 commits intoblock:mainfrom
Conversation
All writes to tool response messages and tool futures are sequential (never concurrent), so the per-request Arc<Mutex<Message>> and the Arc<Mutex<Vec<ToolStream>>> were unnecessary. - Replace per-message Arc<Mutex<Message>> with a plain HashMap<String, Message> using direct &mut access and a new add_tool_response_with_metadata(&mut self) method for in-place mutation. - Replace Arc<Mutex<Vec<ToolStream>>> for tool_futures with &mut Vec, eliminating the lock/drain round-trip in the approval stream. This removes Arc allocations, Mutex lock cycles, and Message clones on consumption (.remove() takes ownership instead). Change-Id: If6b009f2cdfa872b41e71851ef24ee7fe19c97c1 Signed-off-by: rabi <ramishra@redhat.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60a6b96ce9
ℹ️ 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".
* main: (32 commits) Revert message flush & test (block#7966) docs: add Remote Access section with Telegram Gateway documentation (block#7955) fix: update webmcp blog post metadata image URL (block#7967) fix: clean up OAuth token cache on provider deletion (block#7908) fix: hard-coded tool call id in code mode callback (block#7939) Fix SSE parsers to accept optional space after data: prefix (block#7929) docs: add GOOSE_INPUT_LIMIT to config-files.md (block#7961) Add WebMCP for Beginners blog post (block#7957) Fix download manager (block#7933) Improve the formatting of tool calls, show thinking, treat Reasoning and Thinking as the same thing (sorry Kant) (block#7626) don't imply running builds all the time in AGENTS.md (block#7865) fix: unregister goosed child process's listener (block#7956) feat: adversarial agent for preventing leaking of info and more (block#7948) Update contributing.md (block#7927) docs: add credit balance monitoring section (block#7952) docs: add Cerebras provider to supported providers list (block#7953) docs: add TUI client documentation to ACP clients guide (block#7950) fix: removed double dash in pnpm command (block#7951) docs: polish ACP docs (block#7946) claude adaptive thinking (block#7944) ...
jh-block
approved these changes
Mar 18, 2026
lifeizhou-ap
added a commit
that referenced
this pull request
Mar 20, 2026
* main: (22 commits) feat: add gemini-acp provider, update docs on subscription models + improvements to codex (#8000) fix(openai): use Responses API for gpt-5.4 (#7982) Remove lead/worker provider (#7989) chore(release): release version 1.28.0 (#7991) Fix empty tool results from resource content (e.g. auto visualiser) (#7866) Separate SSE streaming from POST work submission (#7834) fix: include token usage in Databricks streaming responses (#7959) Optimize tool summarization (#7938) fix: overwrite the deprecated googledrive extension config (#7974) refactor: remove unnecessary Arc<Mutex> from tool execution pipeline (#7979) Revert message flush & test (#7966) docs: add Remote Access section with Telegram Gateway documentation (#7955) fix: update webmcp blog post metadata image URL (#7967) fix: clean up OAuth token cache on provider deletion (#7908) fix: hard-coded tool call id in code mode callback (#7939) Fix SSE parsers to accept optional space after data: prefix (#7929) docs: add GOOSE_INPUT_LIMIT to config-files.md (#7961) Add WebMCP for Beginners blog post (#7957) Fix download manager (#7933) Improve the formatting of tool calls, show thinking, treat Reasoning and Thinking as the same thing (sorry Kant) (#7626) ...
elijahsgh
pushed a commit
to elijahsgh/goose
that referenced
this pull request
Mar 21, 2026
…lock#7979) Signed-off-by: rabi <ramishra@redhat.com> Co-authored-by: jh-block <jhugo@block.xyz> Signed-off-by: esnyder <elijah.snyder1@gmail.com>
elijahsgh
pushed a commit
to elijahsgh/goose
that referenced
this pull request
Mar 21, 2026
…lock#7979) Signed-off-by: rabi <ramishra@redhat.com> Co-authored-by: jh-block <jhugo@block.xyz> Signed-off-by: esnyder <elijah.snyder1@gmail.com>
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.
Summary
All writes to tool response messages and tool futures are sequential (never concurrent), so the per-request Arc<Mutex> and the Arc<Mutex<Vec>> were unnecessary.
This removes Arc allocations, Mutex lock cycles, and Message clones on consumption (.remove() takes ownership instead).
Testing
Tested locally and there seems no regression.