Skip to content

feat: edit detached native sampling requests - #5518

Merged
markstuart-oai merged 90 commits into
feat/codex-harnessfrom
codex/request-editor-v1-32e1e9dd
Nov 5, 2026
Merged

markstuart-oai merged 90 commits into
feat/codex-harnessfrom
codex/request-editor-v1-32e1e9dd

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add prepare_request to Agent.run, Agent.run_sync, and Session.submit. The callback edits a detached sampling copy of instructions, input, tool descriptions, and JSON schemas. Canonical history, execution handlers, argument validators, and approval policies keep their existing owners.

The supported profile uses direct root Responses HTTP requests with eager ordinary function and MCP tools. Admission checks the actual opened Session, including delegated async/sync Agent.session overrides. Each new sampling request invokes the callback; HTTP retries reuse its frozen edit. The callback retains the submitting workflow's trace identity and privacy restrictions. Default calls preserve existing method overrides.

Pre-turn and mid-turn automatic compaction reject before hidden model dispatch. Post-turn compaction skips that hidden request and retains the completed answer. Active editor state cannot be exported; portable restore requires a fresh callback. Dynamic before_step selection controls whether an unhandled manual tool needs an interaction handler.

Test plan

Current head 73498b9215 includes the actual target a1b704ad. Normal source preparation verifies the complete native recipe at Core 4f78f452. A new wheel and fixture passed 154 installed feature checks, 68 tracing checks, and 3 archive checks with zero skips. All 50 installed SDK/native files match the wheel. The focused 10-case matrix covers delegated HTTP/WebSocket admission and pre/mid/post-turn compaction.

The old native build reproduced the post-turn bug: normal compaction retained the answer, while an editor raised Fatal after completion. The corrected build passes both cases. Two fresh independent source reviews passed on the current head.

Required formatting, lint, type checks, and the full SDK gate passed: 4,445 parallel tests passed with 176 skips, followed by 41 serial passes. The run used eight workers. Source fingerprints and all installed SDK/native files stayed unchanged before and after verification. All 29 current hosted checks are terminal green or skipped.

Issue number

REQ106

Checks

  • Added real-native and caller-compatibility regression coverage.
  • Documented request editing and compaction boundaries.
  • Qualified the current packaged SDK, tracing, and archive contents.
  • Completed two fresh independent source reviews.
  • Passed the mandatory full SDK gate and current hosted CI.

@markstuart-oai
markstuart-oai marked this pull request as ready for review November 5, 2026 05:26
@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners November 5, 2026 05:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T19:21:18.546055Z 73498b9 New commits
🔒 Security Review ✅ Completed 2026-11-05T19:21:37.613781Z 73498b9 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: bb800c9163

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/session.py Resolved

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested for the independently validated existing finding #5518 (comment) . Both entry points validate the entire opening Agent tool roster before resolving per-operation selection. An omitted deferred or hosted declaration therefore rejects an otherwise supported eager-only or empty request. Validate the effective selected roster after resolving operation defaults while retaining the global environment/transport restrictions. No duplicate inline comment added.

The operation/turn/store ownership, cancellation joining, immutable capture, dispatch revalidation and canonical-history isolation otherwise look sound. Ordinary runs borrow the prompt and pending manual resumes reject a newly supplied callback. Hosted native builds remain pending with no observed failures. Static review only; no candidate code or local tests ran.

@markstuart-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The selected-roster validation fixes the prior finding: excluded deferred/hosted tools no longer reject supported operations, dynamic rosters retain native validation before editor/provider dispatch, and fixed hosted registrations remain excluded. Selected manual tools require a handler for edited one-shot runs. No new findings. Hosted native CI is pending. Coordinator and independent static review; no candidate code or local tests executed.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 5d4eb2f366

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 5d4eb2f366

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/session.py Resolved
@markstuart-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: cd0c73a2d3

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: cd0c73a2d3

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

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at d26ada5. Combined forwarding preserves parent_trace and prepare_request, captured workflow policy, restored/manual continuations, compaction and output repair. Integrity-reason handling and callback admission fixes remain intact. All four stack heads contain the exact reviewed W3C security patch from 5451026; the inherited tracing blocker is addressed here. Final ancestry commits do not change the reviewed trees.

Hosted checks: 12 SUCCESS, 8 SKIPPED. Windows, typing and macOS sandbox checks were skipped, not passed. Coordinator and independent static review found no actionable integration regressions. No candidate code or local tests executed; no CI reruns requested.

Base automatically changed from codex/context-metadata-v1-32e1e9dd to feat/codex-harness November 5, 2026 18:46

@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: 41d1f49209

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/agent.py Resolved

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes at 41d1f49. Coordinator and independent static review confirm the existing P2 delegated-provider finding; no duplicate inline finding added. Agent.run checks the agent/default provider before invoking an overridden Agent.session factory. With no agent-level provider, it treats the provider as WebSocket-enabled and rejects prepare_request even when the override supplies a supported HTTP NativeProvider. Defer this provider validation to the opened session (Session.submit already checks its actual transport), or limit the preliminary check to the default factory. Add async/sync regression coverage for an override supplying HTTP and a control rejecting an actual WebSocket session.

All 43 files changed by the merge match the landed base exactly; all 19 feature-specific files are unchanged from the previous reviewed head. This is a newly confirmed existing feature issue, not a regression introduced by the merge. Hosted CI remains pending. No candidate code, local tests, builds or CI reruns executed.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at af77762. The delegated-provider finding is addressed: preliminary output/profile validation now applies only to the default session factory. Delegated sessions still validate their actual transport, output and environment in Session.submit. Four regressions cover async/sync HTTP success and actual WebSocket rejection before editor/provider work. The three CodeQL cache-removal files match the landed base exactly.

Coordinator and independent static review found no actionable issues. This supersedes my prior request-changes decision. Hosted CI remains pending. No candidate code, local tests, builds or CI reruns executed.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at 73498b9. The three-line guard skips only post-turn compaction when request preparation is active, preserving the completed answer. Pinned upstream and patch 0018 confirm the previous Fatal propagation from this caller; pre/mid-turn rejection and general error handling remain intact. The editor and ordinary control regressions check final output, one versus two provider requests, and callback indices/count. Patch checksum matches the manifest; delegated-provider fix is unchanged.

Coordinator and independent static review found no actionable issues. Hosted CI remains pending. No candidate code, local tests, builds or CI reruns executed.

@markstuart-oai
markstuart-oai merged commit 6bc55f7 into feat/codex-harness Nov 5, 2026
29 checks passed
@markstuart-oai
markstuart-oai deleted the codex/request-editor-v1-32e1e9dd branch November 5, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants