feat(sdk): expose headless patch generation - #774
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsBlocking findings (3)
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: e071faa9b1
ℹ️ 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.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08cdfc9323
ℹ️ 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: 8f69987795
ℹ️ 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: 9825b0b7a3
ℹ️ 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: 55cb677e2a
ℹ️ 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: e4e77a11af
ℹ️ 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".
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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: 1d9c787670
ℹ️ 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".
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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 Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: 42d5d2eaf9
ℹ️ 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.
|
This API now matches approval-gated remediation use case: patch an isolated workspace, return structured verification, and leave authoritative diff capture, approval, commit creation, PR delivery, and finding closure to the caller. Before adoption, we need the remaining project-trust issue resolved. An SDK patch operation must fail closed regardless of system-level For an embedding-safe default, please consider disabling repository MCP servers for
|
|
I checked the structured finding path. Object findings are passed through One non-blocking SDK contract improvement would help embedding applications: Please consider exporting a reusable |
There was a problem hiding this comment.
💡 Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: 7a0aaad402
ℹ️ 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.
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
patch() appears to drop command-authenticated custom provider configuration when it adds the trust overrides.
#createSessionCodex() first conditionally supplies configOverrides: modelProviderConfigOverride(sessionConfig) when commandAuth is true. That raw override is important because the function also deletes model_providers from the structured SDK config. But the later spread for the new configOverrides argument writes the same property again, so patch() replaces the provider override with only project_root_markers=[] and the untrusted-project entry.
A configuration using model_providers.<id>.auth can therefore work for existing SDK operations but lose the provider definition/auth command specifically in patch().
Could these arrays be merged instead of assigning configOverrides twice? I would add a patch test with a command-auth provider and assert that the final Codex options contain both the serialized model_providers=... override and the two trust overrides.
|
Addressed the provider-authentication review in c78412e. Provider configuration and patch trust overrides now share one ordered array. Tests cover both direct and profile-selected command authentication, preserve dotted provider IDs, and assert that both trust overrides remain present. Both new cases failed before the fix and pass afterward; the focused patch, credential, and native trust run passes all 30 tests. The branch is updated with Patch-risk assessment is recorded as follow-up SDK work. Finding input remains consistent with @mldangelo-oai, could you review the updated implementation and authorize the fork's CI workflows? The older automated comment identified in the disclosure section also needs its access-restricted report link removed. That attestation is intentionally left unchecked until cleanup. @codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
The current head is 98b9749. It includes the provider-authentication fix and the follow-up that keeps the public patch declarations self-contained. Strict NodeNext consumer compilation now passes, as do the full seeded SDK suite (2,421 passed, 43 skipped, 0 failed), all 23 MCP test files, formatting, typechecking, portable source checks, and the rebuilt 415-entry package archive inspection. @codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Fixes #681.
Add
CodexSecurity.patch({ repositoryPath, finding })so applications can generate and verify a patch through the TypeScript SDK. The supplied workspace is mutable; callers retain control of the authoritative diff, approval, commit creation, and delivery.Changes
PatchOptionsand a discriminatedPatchResultwithverified,no_change,blocked, andfailedoutcomes, verification or failure details, relative changed-file metadata, thread identity, and estimated cost.mainwhen resolving merge conflicts.Authentication defaults to
auto; model and reasoning effort inherit constructor configuration unless overridden per call. No public CLI commands, flags, environment variables, accepted values, or defaults change.Testing
Validation uses Node 24.11.1, pnpm 11.19.0, and Bun 1.3.14.
pnpm run typesandpnpm run format: passed.pnpm run test:mcp: all 23 test files passed.pnpm packand archive inspection: passed, 415 entries. The built SDKpatch()export check passed.ETARGETfor the repository's existing@openai/codex@0.149.1pin. This is not counted as passing validation.pnpm run test --seed 12345andpnpm run test: both passed, each with 2,421 passed, 43 skipped, and 0 failed tests.action_requiredand needs maintainer authorization.git diff --check: passed.Risk and rollout
This adds a public SDK method and types. Existing CLI behavior is unchanged. Failures or cancellation can leave partial workspace edits; callers should use a controlled workspace and inspect or discard its diff.
changedFilesis model-reported metadata, not an authoritative diff. Host-configured tools retain their existing host permissions.Patch-risk assessment remains follow-up SDK work from #681. Commit creation, publication, pull-request delivery, and finding closure remain caller-owned operations.
Public disclosure review
The remaining attestation needs maintainer cleanup: an existing automated review comment includes an access-restricted report link. Please remove that link before checking the attestation.