fix: reconcile resumed tool name collisions - #4145
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4517f74a93
ℹ️ 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".
4517f74 to
e0f0b50
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0f0b501ad
ℹ️ 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".
e0f0b50 to
69dddfc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69dddfc2d3
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 521b12dedc
ℹ️ 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".
521b12d to
96e096e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96e096ef20
ℹ️ 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".
This pull request fixes stale tool and handoff routing when a run resumes after a human-in-the-loop approval.
Before this change, queued function-tool and handoff runs retained the tool objects selected before the pause. If the enabled tools, handoffs, or their ordering changed while the run was interrupted, resuming could execute a stale or disabled tool even when
RunConfig.tool_name_collision_policyselected a different current winner.The resume path now rebuilds the current tool inventory using a consistent enabled-handoff snapshot, applies the canonical collision resolver, and reconciles queued calls with the resulting winners before allowing side effects. Under the default
warnpolicy, queued calls are rebound to the current winning function tool or handoff. Under theerrorpolicy, current collisions fail before tool execution or handoff transfer.The implementation also:
tool_not_found_behaviorwhen a queued tool is no longer available;Agent.as_tool()state when a strict missing-tool error or formatter cancellation aborts a resume;get_mcp_tools()andget_all_tools()overrides that delegate to the base implementation.This does not add a new public API or change the serialized
RunStateschema. It uses the existingtool_name_collision_policyconfiguration.Queued calls with duplicate call IDs intentionally retain the existing ordered owner-binding behavior because they cannot be reconciled unambiguously. Applications that need tool replacement across an interruption should use unique provider call IDs. Replacing an interrupted
Agent.as_tool()with a different owner before deserializing the state also remains unsupported because the current persisted state does not contain a durable owner identity.Documentation is intentionally excluded from this pull request and will be handled separately.
This pull request resolves #4116.