Skip to content

Conversation

@aibrahim-oai
Copy link
Collaborator

@aibrahim-oai aibrahim-oai commented Oct 22, 2025

Currently we collect all all turn items in a vector, then we add it to the history on success. This result in losing those items on errors including aborting ctrl+c.

This PR:

  • Adds the ability for the tool call to handle cancellation
  • bubble the turn items up to where we are recording this info

Admittedly, this logic is an ad-hoc logic that doesn't handle a lot of error edge cases. The right thing to do is recording to the history on the spot as items/tool calls output come. However, this isn't possible because of having different task_kind that has different conversation_histories. The try_run_turn has no idea what thread are we using. We cannot also pass an arc to the conversation_histories because it's a private element of state.

That's said, abort is the most common case and we should cover it until we remove task kind

@aibrahim-oai aibrahim-oai changed the title Add tools abort Oct 22, 2025
@aibrahim-oai aibrahim-oai marked this pull request as ready for review October 22, 2025 23:36
@aibrahim-oai
Copy link
Collaborator Author

@codex review this

for window in input.windows(2) {
let current = &window[0];
let next = &window[1];
if current.get("type").and_then(|v| v.as_str()) == Some("function_call")
Copy link
Collaborator

Choose a reason for hiding this comment

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

are there some universally useful test helper we can add to make this and other tests more readable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll look into it.

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ 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 "@codex address that feedback".

Copy link
Collaborator

@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 when all the comments are processed. Not 100% convince by the design around the error but it will work

@aibrahim-oai aibrahim-oai merged commit f59978e into main Oct 23, 2025
20 checks passed
@aibrahim-oai aibrahim-oai deleted the add-tools-abort branch October 23, 2025 15:47
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants