Skip to content

Conversation

@pakrym-oai
Copy link
Collaborator

@pakrym-oai pakrym-oai commented Oct 6, 2025

make tool processing return a future and then collect futures.
handle cleanup on Drop

@pakrym-oai
Copy link
Collaborator Author

@codex give a thorough review, focus on lifetimes of tools call invocations

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting

Copy link
Contributor

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Much cleaner with the handled moved in the async block

- Replace manual pending call tracking with FuturesOrdered for response processing
- Use RwLock and abort-on-drop for tool parallelization, supporting parallel and serial modes
- Switch tokio-util dependency to use "rt" feature
- Cleanup error handling and streamline handling of tool and non-tool response items
@pakrym-oai pakrym-oai force-pushed the pakrym/simplify-parallel branch from 258b068 to cbf6ced Compare October 6, 2025 22:59
@pakrym-oai pakrym-oai marked this pull request as ready for review October 6, 2025 23:13
Copy link
Contributor

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Ok once the comments are fixed

tracker: SharedTurnDiffTracker,
sub_id: String,
pending_calls: Vec<PendingToolCall>,
lock: Arc<RwLock<bool>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

lock is very generic (and even a reserved key word in some languages)

  • this looks a bit like a hack. You do not even need the bool. At least, have an empty lock

match handle.await {
Ok(Ok(response)) => Ok(response),
Ok(Err(FunctionCallError::Fatal(message))) => Err(CodexErr::Fatal(message)),
Ok(Err(other)) => Err(CodexErr::Fatal(other.to_string())),
Copy link
Contributor

Choose a reason for hiding this comment

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

This will change a bit how the errors bubble. It means that in the serial path, if there is an error, we don't bubble it directly
Find by me but this changes the behaviour so we need to make sure it does not cause any issues

@pakrym-oai pakrym-oai merged commit f255542 into main Oct 7, 2025
20 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/simplify-parallel branch October 7, 2025 17:12
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2025
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.

2 participants