Skip to content

fix(deep-scan): verify saved model inputs before resuming host scans - #1103

Open
mldangelo-oai wants to merge 261 commits into
mdangelo/codex/simplify-deep-scanfrom
mdangelo/codex/pr939-stack-02-severity-history
Open

mldangelo-oai wants to merge 261 commits into
mdangelo/codex/simplify-deep-scanfrom
mdangelo/codex/pr939-stack-02-severity-history

Conversation

@mldangelo-oai

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

Copy link
Copy Markdown
Collaborator

Summary

Land #939 first. This PR extends its host Deep Scan receipts to the configured compact prompt and model catalog. Each receipt records the selected path and content digest, or the absence of a selection. If either input changes while a scan is paused, restoring the original input allows model work to resume.

Changes

  • Reuse the model file settings in the SDK and MCP coordinator. Check the compact prompt and catalog at the same points as the model instructions.
  • Read the earlier flat digest fields in the SDK and Python workbench. Historical receipts verify the inputs they recorded.
  • Identify all three file settings in the CLI recovery guide.

Testing

  • Parameterized SDK and Python recovery tests exercise all three model files and their historical digest keys.
  • The coordinator regression starts with the compact prompt omitted, sets it during a pause, verifies that the changed selection is rejected, and resumes after removing it. The file profile replay fixture supplies its caller-selected catalog.
  • The original branch reproduced a compact prompt resolving to the wrong file through a directory symlink followed by ... Fresh and resumed worker tests exercise the intended path.

Public disclosure review

The update uses synthetic fixtures. Prior contributor context and attestation states are retained. Historical linked reports and attachments have incomplete coverage.

  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T15:47:34.311454Z 6818581 New commits
🔒 Security Review ✅ Completed 2026-11-20T15:48:11.143762Z 6818581 New commits

Security findings

Blocking findings (6)

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

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-01-verification branch from 7804913 to e29a658 Compare September 30, 2026 14:26
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-02-severity-history branch from 593fdbb to 31e0f2c Compare September 30, 2026 14:33
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-01-verification branch from e29a658 to f2c3eed Compare September 30, 2026 15:21
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-02-severity-history branch from 31e0f2c to 42bd243 Compare September 30, 2026 15:21
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

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

The scan-scoped persistence and guarded migration are consistent and adequately tested.

Review effort: Balanced
Findings: None

What changed in this PR

Scopes severity assessments per scan to prevent cross-scan overwrites.

Changes:

  • Adds migration 42 and scan-keyed assessment storage.
  • Passes scan IDs through save/read paths.
  • Adds concurrency and migration coverage.
File Description
sdk/​typescript/​tests-ts/​classify-scan-severity.test.ts Tests scan isolation and migration behavior.
sdk/​typescript/​src/​severity-store.ts Includes scan ID when saving assessments.
plugins/​codex-security/​tests/​test_workbench_setup_and_migrations.py Tests migration 42 and guarded backfill.
plugins/​codex-security/​tests/​test_workbench_deep_scan.py Updates expected schema version.
plugins/​codex-security/​tests/​test_workbench_db.py Updates expected schema tables and version.
plugins/​codex-security/​scripts/​workbench_severity.py Reads and writes scan-scoped assessments.
plugins/​codex-security/​scripts/​workbench_schema.py Defines and backfills the new table.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 42bd243a38

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

@mldangelo-oai mldangelo-oai changed the title fix: preserve severity assessments for each scan fix: preserve each scan's severity assessments Sep 30, 2026

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 42bd243a38d3d3a79c0784eebdf1be870312645a against mdangelo/codex/pr939-stack-01-verification at f2c3eed65b1482497c1997bb53b463160b18fb52, scoped to this PR's diff and touched files.

Reviewed the per-scan schema migration, checkpoint writes/reads, and regression tests. No new actionable findings. Direct SQLite probes using the changed schema and checkpoint code preserved separate assessments for two scans of one finding.

Review included simplification/deletion opportunities. Full repository and platform test suites were not run.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-02-severity-history branch from 42bd243 to f27e123 Compare September 30, 2026 16:55
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-01-verification branch from 183b88d to 75d6f5c Compare September 30, 2026 18:17
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-02-severity-history branch from f27e123 to 144ac4f Compare September 30, 2026 18:17

@faizan-oai faizan-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.

Reviewed the per-scan assessment key, save/read paths, and migration matching. Keeping assessments keyed by both scan and finding addresses the cross-scan overwrite. No issue found in this layer. Local migration checks were run at the integrated stack tip, rather than independently at this commit.

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This moves severity assessments to per-scan storage and isolates concurrent classifications. Approval is withheld for the existing P2 in discussion_r4146527174: migration 42 still drops valid unindexed classifications from the newly selected table. I reproduced one readable legacy assessment becoming zero per-scan assessments using the exact migration SQL, with the original row retained and no foreign-key errors. The same migration remains at the current stack tip.

Completed three independent high-reasoning reviews and source verification against 75d6f5cb78812d7967ae03d641c4f32922274049 → 144ac4fe6f87ed20376f9069627c44fcb79516fd. No additional finding to duplicate here.

Base automatically changed from mdangelo/codex/pr939-stack-01-verification to main October 1, 2026 22:30
@github-actions github-actions Bot added the bug Something isn't working label Oct 1, 2026

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed after the base PR was merged and this PR was retargeted to main at 688e2aee6290e80b3e71ad132adf3e8071a2afa8. Three fresh independent passes found no additional issues. GitHub test merge 69272724c5a7f3f23da54de5b48b1b70f3b531cc has the expected base/head parents; its seven-file change matches the original severity patch despite the expanded three-dot diff.

Approval remains withheld for the existing P2 migration finding. On that test merge, the real migration still leaves one valid saved assessment with a deterministic occurrence identity as zero entries in the new per-scan table. The original row remains, but the new reader cannot use it. The SDK migration test explicitly expects the saved classification to become incomplete. The later recovery in #1150 fixes this at the final stack tip; that fix is not part of this PR.

Validation on the test merge: 296 Python tests and 14 classification tests passed; plugin build, Ruff lint/format, CI TypeScript build, portable source compatibility and its nine tests, and diff whitespace checks passed. No live model calls.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-02-severity-history branch from 144ac4f to fd5b5ba Compare October 1, 2026 23:44
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

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

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

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed fd5b5ba147484f20d64bf0680702ef6c7385631b against be8470aa77f21a8bdad614e994b3982066a21073, with three fresh independent passes and root verification.

Migration 46 fixes the earlier loss during migration: a valid unindexed legacy assessment now survives the upgrade, and repeating the migration preserves the recovered row.

One P2 remains for databases already at migration 42, as described in discussion_r4161619542. I reproduced it through the actual SDK publication-preparation API: one saved legacy assessment plus an empty per-scan table produces the incomplete-classification error on read-only publication. Running classification once applies migration 46; the same assessment and publication then succeed. A read-only caller needs a validated fallback for this recoverable row, or recovery before selecting the new table. No duplicate inline comment added; approval remains withheld for this specific upgrade path.

Validation: 14 SDK classification tests; the three touched Python test files; plugin build; Ruff lint/format; SDK TypeScript check; portable source compatibility and its tests. The synthetic migration and publication probes used no model calls or external publication. Current CI still has queued jobs.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-stack-02-severity-history branch from fd5b5ba to a2ca4d5 Compare October 2, 2026 00:36

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed the real PR diff at a2ca4d5dd7c68158753f039b574c0822ba0ca6b8. Three independent high-reasoning passes covered the complete changed patch and tests; root source checks and focused reproductions informed this decision.

The read-only classification fallback now recovers legacy assessments before any migration write, preserves existing per-scan rows and does not borrow another scan's assessment. Exact-head regression tests and actual SDK publication preparation pass.

Validation across touched paths at branch tip 06e75cfe: 1,356 SDK tests, 867 Python tests plus 100 subtests, and 108 MCP tests passed; builds, types, portable checks and installed-package checks passed. These are integration checks at the branch tip, not a claim that every intermediate PR or its CI is clean. The branch still descends from be8470aa, while the base ref is 2fd78804. GitHub test merge f1c97e81 has the expected parents and identical contents for all eight touched files; the broad local tip tests do not include the newer main changes.

mldangelo-oai and others added 16 commits November 19, 2026 16:04
# Conflicts:
#	plugins/codex-security/mcp-app/tests/deep_scan_profile_file_cases.ts
#	plugins/codex-security/scripts/workbench_source_scopes.py
#	sdk/typescript/src/project-config.ts
Read the effective model-file paths persisted by older SDKs before choosing a recovery interpreter. Use the selected scan's input roots for CLI history lookups and bulk receipt collection, including when publication fails.

Exercise legacy sealed recovery through the SDK and both CLI paths with a harmless interpreter marker, and cover case-only Windows output directory changes.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@mldangelo-oai
mldangelo-oai changed the base branch from main to mdangelo/codex/simplify-deep-scan November 20, 2026 11:08
@mldangelo-oai
mldangelo-oai marked this pull request as draft November 20, 2026 15:18
@mldangelo-oai
mldangelo-oai marked this pull request as ready for review November 20, 2026 15:18

This branch has not been deployed

No deployments
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.

10 participants