-
Couldn't load subscription status.
- Fork 6k
Simplify parallel #4829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify parallel #4829
Conversation
|
@codex give a thorough review, focus on lifetimes of tools call invocations |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting |
There was a problem hiding this 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
258b068 to
cbf6ced
Compare
There was a problem hiding this 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
codex-rs/core/src/tools/parallel.rs
Outdated
| tracker: SharedTurnDiffTracker, | ||
| sub_id: String, | ||
| pending_calls: Vec<PendingToolCall>, | ||
| lock: Arc<RwLock<bool>>, |
There was a problem hiding this comment.
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())), |
There was a problem hiding this comment.
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
make tool processing return a future and then collect futures.
handle cleanup on Drop