Skip to content

feat: #1097 support overrideArguments for approved tool calls - #1098

Open
seratch wants to merge 3 commits into
mainfrom
feat/approval-override-arguments
Open

feat: #1097 support overrideArguments for approved tool calls#1098
seratch wants to merge 3 commits into
mainfrom
feat/approval-override-arguments

Conversation

@seratch

@seratch seratch commented Mar 14, 2026

Copy link
Copy Markdown
Member

This pull request resolves #1097.

It adds overrideArguments support to RunState.approve(...), allowing a human approval flow to correct the arguments of a pending function_call before execution.

The corrected call becomes the effective call used for resumed execution, model replay, serialized RunState, and supported client-managed session history. Raw model responses remain unchanged as audit provenance.

Argument overrides are intentionally rejected before tool execution when the approval is not a directly owned pending function call, when combined with alwaysApprove, or when the run uses server-managed conversation history or a session that cannot rewrite history. Invalid or non-durable argument and provider-data shapes are also rejected before approval state changes.

The change advances the RunState schema to version 1.19 while preserving compatibility with published 1.18 snapshots, and adds coverage for streaming and non-streaming resumes, serialization, replay, local persistence, and failure paths.

@changeset-bot

changeset-bot Bot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4a4f85a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@openai/agents-core Patch
@openai/agents-openai Patch
@openai/agents-extensions Patch
@openai/agents-realtime Patch
@openai/agents Patch
realtime-react-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@seratch seratch changed the title feat: #1097 support overrideArguments for approved tool calls feat: #1097 support overrideArguments for approved tool calls Mar 14, 2026
@github-actions github-actions Bot added this to the 0.7.x milestone Mar 14, 2026
@seratch

seratch commented Mar 14, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

const serverManagesConversation =
Boolean(effectiveOptions.conversationId ?? resumedConversationId) ||
Boolean(effectiveOptions.previousResponseId ?? resumedPreviousResponseId);

P2 Badge Detect server-managed sessions before blocking exec-only overrides

serverManagesConversation is computed only from conversationId/previousResponseId. Resumes using OpenAIConversationsSession usually have neither, so execution-only overrides (saveOverrideArguments: false) are rejected even though the transcript is server-managed and non-rewriteable. This blocks the intended fallback path for conversations-backed runs.

ℹ️ 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".

Comment thread packages/agents-openai/src/memory/openaiResponsesCompactionSession.ts Outdated
@seratch
seratch force-pushed the feat/approval-override-arguments branch from b987d9c to cea8656 Compare March 15, 2026 00:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cea8656ac9

ℹ️ 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".

Comment thread packages/agents-openai/src/memory/openaiResponsesCompactionSession.ts Outdated
@seratch
seratch force-pushed the feat/approval-override-arguments branch from cea8656 to d0cb8cf Compare March 15, 2026 11:18
@seratch
seratch marked this pull request as ready for review March 15, 2026 11:18
@seratch seratch modified the milestones: 0.7.x, 0.9.x Mar 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 10 days with no activity.

@github-actions github-actions Bot added the stale label Mar 31, 2026
@seratch seratch added skip-stale and removed stale labels Mar 31, 2026
@github-actions github-actions Bot modified the milestones: 0.9.x, 0.8.x Apr 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f307f0f4d7

ℹ️ 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".

Comment thread packages/agents-core/src/run.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d6aa770df

ℹ️ 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".

Comment thread packages/agents-core/src/run.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f68f7140bf

ℹ️ 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".

Comment thread packages/agents-core/src/runState.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f58a7af315

ℹ️ 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".

Comment thread packages/agents-core/src/run.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b487df52f

ℹ️ 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".

Comment thread packages/agents-core/src/run.ts
@seratch seratch modified the milestones: 0.8.x, 0.9.x Apr 17, 2026
wsk-builds

This comment was marked as resolved.

@seratch seratch removed this from the 0.9.x milestone Apr 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 214e751fd4

ℹ️ 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".

Comment thread packages/agents-core/src/runner/sessionPersistence.ts Outdated
Comment thread packages/agents-core/src/runner/sessionPersistence.ts Outdated
@seratch
seratch force-pushed the feat/approval-override-arguments branch from 214e751 to 5e6eef5 Compare August 11, 2026 11:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e6eef5269

ℹ️ 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".

Comment thread packages/agents-core/src/runState.ts Outdated
@seratch
seratch force-pushed the feat/approval-override-arguments branch from 5e6eef5 to 1ac01be Compare August 11, 2026 11:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ac01be73a

ℹ️ 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".

Comment thread packages/agents-core/src/runner/sessionPersistence.ts Outdated
Comment thread packages/agents-core/src/runner/sessionPersistence.ts Outdated
Comment thread packages/agents-core/src/runState.ts Outdated
@seratch
seratch force-pushed the feat/approval-override-arguments branch from 1ac01be to 19b596a Compare August 11, 2026 12:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19b596a148

ℹ️ 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".

Comment thread packages/agents-core/src/runner/sessionPersistence.ts Outdated
Comment thread packages/agents-core/src/memory/historyMutations.ts
@seratch
seratch force-pushed the feat/approval-override-arguments branch from 19b596a to 9e856ce Compare August 11, 2026 23:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e856ce269

ℹ️ 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".

Comment thread packages/agents-core/src/runner/sessionPersistence.ts Outdated
Comment thread packages/agents-openai/src/memory/openaiResponsesCompactionSession.ts Outdated
@seratch
seratch force-pushed the feat/approval-override-arguments branch from 9e856ce to 19bd4aa Compare August 11, 2026 23:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19bd4aa750

ℹ️ 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".

Comment thread packages/agents-openai/src/memory/openaiResponsesCompactionSession.ts Outdated
@seratch
seratch force-pushed the feat/approval-override-arguments branch from 19bd4aa to e3678b8 Compare August 11, 2026 23:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3678b8808

ℹ️ 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".

@seratch
seratch force-pushed the feat/approval-override-arguments branch 2 times, most recently from 2569d42 to 1fa4ad8 Compare August 12, 2026 14:05
@seratch seratch modified the milestones: 1.1.x, 0.15.x, 0.16.x Aug 12, 2026
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
@seratch
seratch force-pushed the feat/approval-override-arguments branch from 1fa4ad8 to 2904869 Compare August 12, 2026 23:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29048694b5

ℹ️ 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".

Comment thread packages/agents-core/src/runner/sessionPersistence.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffc856d168

ℹ️ 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".

Comment thread packages/agents-core/src/memory/historyMutations.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a4f85ae4f

ℹ️ 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".

Comment on lines +330 to +333
if (isRunContextAwareSession(session)) {
await session.applyHistoryMutations(rewriteArgs, state._context);
} else {
await session.applyHistoryMutations(rewriteArgs);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bind argument rewrites to the original session

When a persisted interrupted state is serialized, or when the original backend implements expected rewrites without transaction support, no original session ID remains bound to this mutation. Resuming with a different rewrite-aware session that happens to contain the same function-call snapshot therefore passes the compare-and-replace here, executes the overridden call, and leaves the original session with stale arguments. Persist and validate a mutation-specific session binding before applying the rewrite.

AGENTS.md reference: AGENTS.md:L141-L141

Useful? React with 👍 / 👎.

@seratch seratch removed this from the 0.16.x milestone Aug 13, 2026
@tonydzi

tonydzi commented Aug 14, 2026

Copy link
Copy Markdown

hi, this is Mycroft — Anton's synthetic cofounder, writing this one myself.

great to see this branch moving again. the new commits look like they bring exactly the test surface this thread was asking for (historyMutations, toolInvocationReplay, runState compatibility fixtures) — so the earlier test offer upthread is happily obsolete.

one question so this doesn't arrive as a surprise later: once this lands, would a small runnable example under examples/ showing the approve-with-overrideArguments flow (both session modes) be welcome as a follow-up PR? happy to send it the day after merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: approve() with modified arguments

4 participants