Skip to content

fix: preserve accepted evidence during Deep scan reduction - #442

Open
mldangelo-oai wants to merge 11 commits into
mainfrom
mdangelo/codex/deep-reducer-integrity
Open

fix: preserve accepted evidence during Deep scan reduction#442
mldangelo-oai wants to merge 11 commits into
mainfrom
mdangelo/codex/deep-reducer-integrity

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Preserve accepted worker findings, coverage, scope, and threat-model evidence during Deep scan reduction and recovery without introducing a separate runtime helper.

Changes

  • Validate accepted findings and scan evidence directly in the existing bundled reducer.
  • Reject missing, altered, fabricated, or duplicate findings and metadata; preserve accurate coverage completeness; and revalidate original worker results during recovery.
  • Add focused cases to the existing reducer recovery tests.
  • Remove the previously added helper, package-manifest entry, and standalone integrity test suite. The final change touches only the existing runtime chunks and one existing test file.

Testing

  • bun test --timeout 30000 --randomize --seed 12345 ./tests-ts: 1,132 passed, 11 skipped, and 0 failed.
  • pnpm run types: passed.
  • pnpm run format: passed.
  • pnpm pack --pack-destination <temporary-directory> and node scripts/check-package.mjs <packed-archive>: passed; validated 202 package entries, 106 bundled plugin files, the installed CLI and SDK, and a nested worker.
  • Full two-worker Deep scan with --mode deep --workers 2 --subagents 0 --stop-after-no-new 2 --max-discovery-runs 2 --max-time-hours 1: completed with complete coverage, 19 reviewed surfaces, and no deferred work.

Risk and rollout

The existing compressed runtime chunks change, but no packaged files or dependencies are added. Reducers now reject altered or incomplete accepted evidence, including saved reductions that do not match their original worker artifacts.

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 Aug 15, 2026
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 5f90b68330

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: 5f90b68330

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator 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

Here are some automated review suggestions for this pull request.

Reviewed commit: 54aff1afa6

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: a792d90968

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: a792d90968

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 4b1ed1f46b

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: 4b1ed1f46b

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator 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

Here are some automated review suggestions for this pull request.

Reviewed commit: d4a54c5401

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs 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 Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: d4a54c5401

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.

Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator 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

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ffd6d3f7f

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator 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

Here are some automated review suggestions for this pull request.

Reviewed commit: 20b485b953

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs 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 Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: 20b485b953

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.

Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator 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

Here are some automated review suggestions for this pull request.

Reviewed commit: be0a338634

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: eb00fcec82

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: eb00fcec82

ℹ️ 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/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
Comment thread sdk/typescript/_bundled_plugin/mcp/deep-reducer-integrity.cjs Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator 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

Here are some automated review suggestions for this pull request.

Reviewed commit: d10222f09e

ℹ️ 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 +151 to +152
result: { ...draft([first]), scope: { summary: "Invented review." } },
sources: [{ ...draft([first]), scope: { summary: "Accepted review." } }],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject reducer-only scope metadata

When every accepted draft omits scope, a reducer can add an arbitrary scope such as runtimeStatus: "dynamically validated" or fabricated artifactsReviewed, because the validator derives the fields to check only from input sections and has no counterpart to the unsupported-threat-model guard. The added scope is then persisted as canonical evidence even though the reducer is prohibited from inspecting or validating the repository; reject a result scope when none was supplied, and reject result-only scope fields otherwise.

AGENTS.md reference: sdk/typescript/AGENTS.md:L20-L20

Useful? React with 👍 / 👎.

Comment on lines +156 to +159
result: draft([first, second], "complete", {
summary: "Administrator boundary.\n\nWorker boundary.\n\nInvented.",
assets: ["accounts", "workers"],
}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject unsupported fields in differing threat models

When at least two accepted threat models differ, the reducer can add a field that every input omitted—for example, attackerCapabilities: ["unauthenticated remote attacker"]—because the array and string field sets are derived only from the inputs, while whole-object equality runs only when all accepted models are identical. The fabricated attacker assumptions are then persisted as canonical scan context; validate every result threat-model field against the accepted models in the differing-model branch as well.

AGENTS.md reference: sdk/typescript/AGENTS.md:L20-L20

Useful? React with 👍 / 👎.

@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 Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: d10222f09e

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.

Comment on lines +144 to +147
result: { ...draft([first]), scope: { limitations: [] } },
sources: [
{ ...draft([first]), scope: { limitations: ["No runtime access."] } },
],

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 Security: Reject semantic metadata not supplied by workers

Required conditions: Deep mode is used and the reducer adds a scope field absent from every matching worker/previous result (or adds a new threat-model field while accepted models differ). The new validator builds its field set only from input entries, so those result-only keys are never checked. Against the target bundle I reproduced acceptance of fabricated runtimeStatus, validationMode, artifactsReviewed, and attackerCapabilities; parent finalization persists the scope and report projection presents it as canonical scan evidence. Reject every result metadata key not traceable to an accepted input. Unlike the earlier retained-scope report, this case has no accepted source for the added keys.

Useful? React with 👍 / 👎.

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.

1 participant