fix: detach RunState interruption snapshots - #4409
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 768ba9ad63
ℹ️ 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".
768ba9a to
46b5c92
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46b5c92e45
ℹ️ 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".
| _TOOL_APPROVAL_MODEL_ADAPTERS: tuple[tuple[type[Any], TypeAdapter[Any]], ...] = ( | ||
| (ResponseFunctionToolCall, TypeAdapter(ResponseFunctionToolCall)), | ||
| (McpCall, TypeAdapter(McpCall)), | ||
| (McpApprovalRequest, TypeAdapter(McpApprovalRequest)), | ||
| (LocalShellCall, _LOCAL_SHELL_CALL_ADAPTER), |
There was a problem hiding this comment.
Support every approval-bearing response model
When a CustomTool with needs_approval receives the normal ResponseCustomToolCall that turn_resolution.py queues verbatim, get_interruptions() now passes that model to _copy_tool_approval_raw_item(), but no adapter matches and the method raises UserError instead of returning the pending approval. ResponseFunctionShellToolCall is omitted for the same reason. Derive this set from the approval-processing pipeline or add adapters and regression coverage for these production models.
AGENTS.md reference: AGENTS.md:L93-L93
Useful? React with 👍 / 👎.
This pull request fixes
RunState.get_interruptions()so it returns detachedToolApprovalItemsnapshots instead of exposing mutable approval content owned byRunState.Agent.approve()andreject()routing through canonical invocation identity.UserError.