Skip to content

fix(plugin): calculate diff digests at completion - #1040

Merged
mldangelo-oai merged 4 commits into
mainfrom
mdangelo/codex/scan-diff-digest
Sep 26, 2026
Merged

mldangelo-oai merged 4 commits into
mainfrom
mdangelo/codex/scan-diff-digest

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Commit and range diff scans can fail to finish when the draft omits snapshotDigest.

Changes

Calculate the digest from the scan’s saved base and head revisions during completion and recovery. Keep the original digest for scans that are already sealed.

Testing

  • 51 focused tests, all five portable checks, and SDK/plugin builds passed.
  • A live diff scan completed and produced a report. Its digest matched the saved revisions.

Risk and rollout

No CLI or schema changes. Can merge independently of #1036.

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.

@github-actions github-actions Bot added the bug Something isn't working label Sep 26, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 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-09-26T20:10:08.735667Z e897064 Manual request
🔒 Security Review ✅ Completed 2026-09-26T20:06:42.929802Z e897064 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.

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review correctness and opportunities to simplify the changed code. Focus on digest binding and sealed artifacts for #1040, and explicit IDs, worker ownership, interrupted writes, and recovery ordering for #1036. Identify concrete bugs or unnecessary complexity and explain the tradeoffs.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

A critical issue may replace the recorded digest of sealed artifacts during stopped-scan recovery.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Updates diff-scan finalization to derive snapshot digests during completion and stopped-scan recovery.

Changes:

  • Centralizes committed diff digest generation.
  • Adds regression coverage for digest binding and recovery.
  • Documents draft and sealed-artifact digest behavior.
File Reviewed changes
plugins/​codex-security/​tests/​test_workbench_db.py Updates finalized diff digest expectations.
plugins/​codex-security/​tests/​test_workbench_completion_binding.py Adds completion and recovery regression tests.
plugins/​codex-security/​scripts/​workbench_target.py Provides shared digest derivation and binding logic.
plugins/​codex-security/​scripts/​workbench_saved_results.py Reuses digest generation during recovery.
plugins/​codex-security/​scripts/​workbench_db.py Binds digests during completion finalization.
plugins/​codex-security/​references/​scan-contract.md Documents digest ownership and preservation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread plugins/codex-security/scripts/workbench_target.py

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

ℹ️ 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 +34 to +36
manifest_scan = manifest.get("scan") if manifest is not None else None
# A previously sealed draft may contain a legacy model-authored digest.
if not isinstance(manifest_scan, dict) or manifest_scan.get("sealedAt") is None:

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 Preserve the sealed digest during incremental recovery

When a legacy commit/range scan has already been recovered with a nonempty preservedSources map and a later checkpoint is explicitly recovered, _recovery_source_digests excludes the sealed parent while merge_saved_results constructs a new manifest. Returning None here means that new manifest falls back to the derived digest, replacing the previously sealed legacy snapshotDigest; I reproduced this by recovering once, adding a checkpoint, and recovering again. Bind the sealed target's recorded digest explicitly so recovery can add retained results without silently changing the target identity.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in e897064. The binding now carries the validated sealed target's recorded digest into later recovery. The regression covers commit and range scans, a first recovery, a late checkpoint, a second recovery, and byte-stable retries; it failed before the fix and now passes.

Copy link
Copy Markdown
Collaborator Author

@codex review

Please recheck e897064. It preserves the original sealed digest during incremental recovery; commit/range regressions now include a late checkpoint and repeated recovery.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: e8970642a7

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

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

Resolved since last review (1)

@mldangelo-oai mldangelo-oai changed the title fix(plugin): bind diff digests during finalization fix(plugin): calculate diff digests at completion Sep 26, 2026
@mldangelo-oai
mldangelo-oai merged commit 8c78e65 into main Sep 26, 2026
136 of 155 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/scan-diff-digest branch September 26, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants