Skip to content

feat(cli): assess patch risk on request - #664

Merged
soyeon-oai merged 6 commits into
mainfrom
codex/patch-risk-comment-654
Aug 27, 2026
Merged

soyeon-oai merged 6 commits into
mainfrom
codex/patch-risk-comment-654

Conversation

@soyeon-oai

@soyeon-oai soyeon-oai commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add an opt-in patch --assess-patch-risk path that assesses only the completed patch, returns the full report in the command result, and adds the concise Markdown summary to a draft pull request body when --create-pr is also selected. Supplied file, literal, and Linear issue patches can now use the same draft pull request path.

Changes

  • add --assess-patch-risk only to the existing patch command
  • snapshot only the generated patch through an isolated Git index and pass that immutable artifact to the bundled assessment skill in a read-only task
  • keep the full Markdown-and-JSON assessment in patchRisk.report
  • append only the concise Markdown summary to the draft pull request body; do not create a separate command or pull request comment
  • allow supplied issue patches to use --create-pr, requiring a clean starting worktree and publishing only files changed by the patch run
  • derive a stable patch branch from one Linear-style issue identifier, with a deterministic digest fallback for other supplied inputs
  • persist the exact pull request body with the patch commit so patch --resume-pr retries the same publication
  • document and test the opt-in behavior, immutable artifact identity, result/body split, supplied-issue publication, retry state, and preservation of unrelated staged changes

Testing

  • pnpm run types — passed
  • pnpm run build — passed
  • pnpm run format — passed
  • git diff --check — passed
  • npx --yes bun@1.3.13 test --timeout 30000 ./tests-ts/cli-patch.test.ts ./tests-ts/cli-skills.test.ts ./tests-ts/patch-risk-contract.test.ts — 69 passed at the rebased feature head
  • npx --yes bun@1.3.13 test --timeout 30000 ./tests-ts/cli-patch.test.ts --test-name-pattern "creates a draft pull request with the Linear patch-risk summary" — passed after the public fixture identifier was replaced with a synthetic value
  • npx --yes bun@1.3.13 test --timeout 30000 ./tests-ts — 1,905 passed, 30 platform skips, and one sandbox-only process-inspection failure on the preceding feature head
  • npx --yes bun@1.3.13 test --timeout 30000 ./tests-ts/publication-integration.test.ts --test-name-pattern "keeps no-signal SDK publication in the host process group" — passed outside the restricted process-inspection sandbox

Risk and rollout

The public flag defaults to off, so existing patch commands are unchanged. The assessment is advisory and never changes the patch or merge state. An explicitly requested assessment failure stops the command before pull request publication. Supplied-issue pull request creation now requires a clean worktree so pre-existing changes cannot be included. With both flags selected, model-authored concise Markdown is included in the draft pull request body; the validated JSON stays in the local command result. No pull request comment is created.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

Change impact

One opt-in patch flow now fixes supplied issues, assesses the generated-only tree delta, and puts only the concise risk summary into the draft pull request body.

flowchart LR
  issue["Supply issue data<br/><code>file, text, or Linear</code>"]
  patch["Generate patch<br/><code>fix-finding</code>"]
  artifact["Seal changed files<br/><code>patch artifact</code>"]
  skill["Assess read-only<br/><code>assess-patch-risk</code>"]
  body["Create draft PR<br/><code>summary only</code>"]
  result["Return full report<br/><code>patchRisk.report</code>"]
  issue -->|"starts"| patch
  patch -->|"diffs"| artifact
  artifact -->|"supplies"| skill
  skill -->|"summary"| body
  skill -->|"full report"| result
  class patch,artifact,skill changed
  class issue context
  class body,result affected
  classDef changed fill:#d7f5e5,stroke:#237a4b,color:#111
  classDef affected fill:#e6f0ff,stroke:#3569a8,color:#111
  classDef context fill:#f4f4f4,stroke:#777,color:#111
Loading

Limits: The assessment remains advisory and does not approve or merge the patch. · The E2E uses real Git repositories but mocked Codex and GitHub CLI boundaries. · Exact-head provider CI for 63e7de42ada7c0490582106d3b7d42801a6cef0e is not yet complete.

Source evidence (5)

Collection limit

  • The pr-walkthrough REST collector hit GitHub's authenticated core rate limit. The current PR identity and exact base/head SHAs were recollected through GitHub GraphQL, and the source ranges above were verified from the exact local Git objects.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 26, 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-08-27T03:31:15.484670Z 4983b48 New commits
🔒 Security Review ✅ Completed 2026-08-26T23:28:40.542065Z 1851875 PR opened

Security findings

Finding details are still loading. Check the individual review comments.

ℹ️ 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: 1851875a73

ℹ️ 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 sdk/typescript/src/cli.ts Outdated
Comment thread sdk/typescript/src/cli.ts Outdated
Comment thread sdk/typescript/src/cli.ts
@soyeon-oai
soyeon-oai force-pushed the codex/patch-risk-comment-654 branch from 1851875 to 7b3f03d Compare August 26, 2026 23:51

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

ℹ️ 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 sdk/typescript/src/cli.ts Outdated
Comment thread sdk/typescript/src/cli.ts
Comment thread sdk/typescript/src/cli.ts Outdated
@soyeon-oai
soyeon-oai force-pushed the codex/patch-risk-comment-654 branch from 7b3f03d to e862877 Compare August 27, 2026 00:00

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

ℹ️ 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 sdk/typescript/src/cli.ts
@soyeon-oai
soyeon-oai force-pushed the codex/patch-risk-comment-654 branch 2 times, most recently from 1061b62 to 203e169 Compare August 27, 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: 203e169630

ℹ️ 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 sdk/typescript/src/cli.ts
@soyeon-oai
soyeon-oai force-pushed the codex/patch-risk-comment-654 branch 2 times, most recently from 53916e5 to 8b72d46 Compare August 27, 2026 00:41
@soyeon-oai
soyeon-oai force-pushed the codex/patch-risk-comment-654 branch from 8b72d46 to 63e7de4 Compare August 27, 2026 00:42

@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: 63e7de42ad

ℹ️ 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 sdk/typescript/src/cli.ts
Comment thread sdk/typescript/src/cli.ts
Comment thread sdk/typescript/src/cli.ts
@soyeon-oai
soyeon-oai force-pushed the codex/patch-risk-comment-654 branch from 63e7de4 to 5ffbda5 Compare August 27, 2026 00:55

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

ℹ️ 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 sdk/typescript/src/cli.ts
@soyeon-oai
soyeon-oai force-pushed the mdangelo/codex/port-patch-risk-assessment branch from ef05f7d to 711c48c Compare August 27, 2026 02:50
Base automatically changed from mdangelo/codex/port-patch-risk-assessment to main August 27, 2026 03:20
@github-actions github-actions Bot added the enhancement New feature or request label Aug 27, 2026
@soyeon-oai
soyeon-oai force-pushed the codex/patch-risk-comment-654 branch from 5ffbda5 to 4983b48 Compare August 27, 2026 03: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: 4983b489d6

ℹ️ 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 sdk/typescript/src/cli.ts
@soyeon-oai
soyeon-oai merged commit 01bd062 into main Aug 27, 2026
36 checks passed
@soyeon-oai
soyeon-oai deleted the codex/patch-risk-comment-654 branch August 27, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants