Skip to content

feat(findings): retain unresolved candidates in scan results - #1132

Open
mldangelo-oai wants to merge 257 commits into
mainfrom
mdangelo/codex/unconfirmed-candidates
Open

mldangelo-oai wants to merge 257 commits into
mainfrom
mdangelo/codex/unconfirmed-candidates

Conversation

@mldangelo-oai

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

Copy link
Copy Markdown
Collaborator

Summary

An interrupted review can retain a candidate in a checkpoint, but main's sealed result and CLI summary do not tell the reader which candidates still need evidence. Preserve those proof gaps through publication, recovery and reassessment, and expose them separately from confirmed findings.

Changes

  • Keep candidate and worker identities across Standard, Diff and Deep scan artifacts. The raw review can retain multiple proof gaps for a single candidate, including when loading a legacy sealed result. The SDK, JSON and CLI summary count each unresolved identity once. Finding severity totals, finding-based exit thresholds and SARIF result counts retain their existing meaning.
  • Preserve decisions and linked evidence through resumed worker and reducer results, cost-limit completion and custom reassessment. Keep accepted worker artifacts intact. Support existing worker IDs and opaque historical exclusion metadata.
  • Bind the saved detail count to the selected scan, including when an output directory is reused. Check pinned bytes before trusting a sealed artifact and use the existing seal and binding checks for older completed scans. Partial running drafts still support historical ID-less rows. The optional count no longer needs to project scope metadata. Repository listings hydrate the selected latest scan after filtering and pagination.
  • Main's completion ordering, CLI wording and package inventory are incorporated. The reference changes for CLI and SDK users describe the additive result fields. The existing shard diagnostic handling is retained.
  • When workers reuse a candidate ID, a confirmed finding or an explicit rejection only resolves work for its owner. Reopening a linked surface retains its earlier evidence. Budget recovery now reports an invalid legacy path and handles structured exclusion metadata in older checkpoints. The Python report and the SDK use the same whitespace rules for saved candidate identities.

Testing

  • Reproduced a Deep worker rejecting an independent closed task when a candidate with the same identifier reopened after losing its receipt. Worker admission and sealed tracking now compare closures with task IDs. At 510e56cab, 122 focused MCP tests and 136 sealed-contract SDK tests passed, including recovery, publication and tracking with colliding identifiers. The five portable plugin checks, type checks and plugin build also passed.
  • The five portable plugin checks passed in order, including nine compatibility tests. SDK and MCP type checks, formatting, plugin packaging using source-matched native inputs, and diff whitespace checks passed.
  • Five affected SDK modules passed 272 tests at f47615b1. An isolated regression on a legacy fixture verified two distinct proof gaps, one candidate and one count. At f0a35457, five focused SDK candidate tests, type checking and changed-source formatting passed again.
  • Twelve MCP candidate modules passed 434 tests during integration. At f0a35457, all 274 tests in the two modules that dynamically import the restored SDK helper passed.
  • 169 Python report-projection tests passed. Focused Python runs passed 27 candidate/history tests, ten publication and recovery tests, and seven history cases including both new seal regressions. A broader integration run was interrupted after 214 passes and one history rename failure. All four rename parameterizations passed on an isolated rerun.
  • Directory ownership prevented qualification of some publication fixtures in the read-only sandbox. The affected checks above used ordinary fixture filesystem ownership. Full cross-platform qualification remains with hosted CI.
  • Local Linux validation of the recovery changes passed all 901 tests across eight MCP modules, 636 tests across the two Python budget and recovery modules, and 78 saved-report projection tests. The five portable plugin checks, SDK and MCP type checks, and changed-file formatting also passed. The tests used synthetic checkpoints and the workbench command line.
  • At 618fea6b, all 26 exclusion and receipt regression cases passed. Nine of those cases failed at f0a35457. The three separate tests for a pending candidate surviving another worker’s finding also failed at f0a35457 and passed with the fix.
  • On Ubuntu 26.04, the two trusted ripgrep wrapper tests also failed on main. The fixture now preserves the env executable name so a multicall binary selects the intended utility. The patch comes from test(sdk): preserve the env utility name in inventory fixtures #2678 and keeps both wrapper assertions. On Debian, the inventory module passed 159 tests with 21 platform skips. Ubuntu failure

Risk and rollout

The API additions require no new command or flag. Most of the approximately 30,000 added lines are tests and fixtures. The maintenance cost lies in keeping TypeScript, Python and the persisted artifact formats in agreement about identity, ownership, sealed evidence and reopening. Changes to one reader need coverage of existing artifacts and cross-language consumers. The bounded tests above do not establish full Windows or macOS behavior.

Public disclosure review

Reviewed the updated branch, title, text, changes, commit messages and public discussion. Historical discussion contains preexisting task links. Archived raw logs and binary attachments have not been exhaustively reviewed; the full-artifact attestations remain open.

  • 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 enhancement New feature or request label Sep 30, 2026
@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-20T22:17:44.259839Z 181a476 New commits
🔒 Security Review ✅ Completed 2026-11-20T22:16:25.844932Z 181a476 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.

@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: 9df75abdbd

ℹ️ 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: 3d5aef666d

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

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head for correctness, candidate terminology, and concrete ways to simplify the implementation while preserving behavior. In particular, examine candidate identity, checkpoint/recovery behavior, and duplicated candidate-resolution logic. This is a review request only.

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

Reports omit the saved candidate evidence and locations promised for follow-up.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds tracking and recovery for saved unconfirmed scan candidates across the SDK, CLI, reports, history, and Deep/Diff workflows.

Changes:

  • Exposes unconfirmed candidate counts and details through SDK, JSON, CLI, reports, and history.
  • Preserves candidate identity and evidence across validation, aggregation, checkpoints, and recovery.
  • Adds schemas, documentation, and extensive regression coverage.
File Description
sdk/​typescript/​tests-ts/​result.test.ts Tests candidate counting and resolution.
sdk/​typescript/​tests-ts/​custom-validation.test.ts Tests deferred custom-validation candidates.
sdk/​typescript/​tests-ts/​cli.test.ts Updates CLI summary expectations.
sdk/​typescript/​tests-ts/​cli-workbench.test.ts Tests CLI and JSON candidate output.
sdk/​typescript/​tests-ts/​cli-fixtures.ts Adds finding provenance to fixtures.
sdk/​typescript/​src/​result.ts Exposes unresolved candidate data.
sdk/​typescript/​src/​models.ts Adds candidate coverage fields.
sdk/​typescript/​src/​custom-validation.ts Preserves deferred candidate identity and details.
sdk/​typescript/​src/​cli.ts Prints the unconfirmed count.
sdk/​typescript/​README.md Documents counting semantics.
plugins/​codex-security/​tests/​test_workbench_standard_deep_results.py Expands Deep recovery coverage.
plugins/​codex-security/​tests/​test_workbench_progress.py Tests progress candidate counts.
plugins/​codex-security/​tests/​test_workbench_owner_metadata.py Tests ownership metadata preservation.
plugins/​codex-security/​tests/​test_workbench_native_index_queries.py Tests history artifact reads.
plugins/​codex-security/​tests/​test_workbench_legacy_candidate_recovery.py Tests legacy candidate recovery.
plugins/​codex-security/​tests/​test_workbench_diff_saved_results.py Tests stopped Diff reconciliation.
plugins/​codex-security/​tests/​test_workbench_db.py Updates persisted progress expectations.
plugins/​codex-security/​tests/​test_report_projection.py Tests report candidate projection.
plugins/​codex-security/​scripts/​workbench_scan_history.py Derives history candidate counts.
plugins/​codex-security/​scripts/​workbench_saved_results.py Reconciles candidates during recovery.
plugins/​codex-security/​scripts/​workbench_db.py Adds candidate progress output.
plugins/​codex-security/​scripts/​report_projection.py Adds candidates to reports.
plugins/​codex-security/​schemas/​tools/​scan-draft.schema.json Extends draft candidate schema.
plugins/​codex-security/​schemas/​coverage.schema.json Extends canonical coverage schema.
plugins/​codex-security/​references/​final-report.md Documents candidate persistence rules.
plugins/​codex-security/​mcp-app/​tests/​test_deep_scan_coordinator.mjs Tests resumed Deep publication.
plugins/​codex-security/​mcp-app/​tests/​test_deep_scan_artifact_validation.mjs Tests Deep candidate reconciliation.
plugins/​codex-security/​mcp-app/​tests/​test_compact_artifact_server.mjs Tests deferred compact Diff candidates.
plugins/​codex-security/​mcp-app/​tests/​test_artifact_scan_draft.mjs Tests interrupted draft recovery.
plugins/​codex-security/​mcp-app/​tests/​test_artifact_diff_candidates.mjs Covers Diff candidate lifecycle behavior.
plugins/​codex-security/​mcp-app/​tests/​test_artifact_deep_reducer.mjs Tests reducer candidate retention.
plugins/​codex-security/​mcp-app/​tests/​test_artifact_deep_reducer_pages.mjs Tests reducer projection boundaries.
plugins/​codex-security/​mcp-app/​src/​deep-scan/​coordinator.ts Publishes reconciled Deep coverage.
plugins/​codex-security/​mcp-app/​src/​deep-scan/​artifact-validation.ts Reconciles Deep candidate state.
plugins/​codex-security/​mcp-app/​src/​artifact-scan-draft.ts Preserves candidate-linked follow-ups.
plugins/​codex-security/​mcp-app/​src/​artifact-diff-candidates.ts Implements Diff candidate retention.
plugins/​codex-security/​mcp-app/​src/​artifact-deep-reducer.ts Supplies candidate state to reducers.
plugins/​codex-security/​mcp-app/​src/​artifact-deep-reducer-pages.ts Excludes host-owned state from prompts.

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

@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: 3d5aef666d

ℹ️ 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 feat(scan): report saved unconfirmed candidates feat(scan): report unresolved candidates Oct 1, 2026
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the updated head for correctness, unresolved-candidate terminology, and concrete simplifications. Check candidate selection, saved evidence and locations, generated versus authored decisions, and checkpoint/recovery behavior. This is a fresh review request for the current head.

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

Cost-limited completion can retain stale deferred rows after their candidates become confirmed or terminal.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

@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: 4c75f599a0

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

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the updated PR at the current head, including the CLI summary change. The existing findings breakdown is preserved, with + N candidates appended only when nonzero and no separate candidates line. Check zero and single-candidate cases, tests, and documentation. This is a fresh review request for the updated head.

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

Owner-level merge-safety review of 543aa6a: one remaining owner-fallback caller omits another worker's candidate from saved draft/live review state; see inline.

The existing diagnostic relay setup failure also remains. The paired temporary-directory control reproduces it on byte-identical runner inputs; please fall back to inherited stderr when optional setup fails.

Fresh builds, type checks, formatting and required portable checks pass. Current-head controls reproduce the candidate omission. Full end-to-end verification remains limited by trusted-owner fixture admission; no full platform-suite pass is claimed.

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

Thanks for fixing both retained issues. Blank canonical ownership now falls back to the legacy worker identity, preserving distinct candidates; unavailable optional diagnostic storage no longer prevents a shard from running. No material unresolved findings remain in this owner-level merge-safety review.

Current checks passed: 211 candidate-publication cases, 39 shard-runner cases, and six actual draft-writer controls covering absent, blank and populated canonical owners in Standard and Diff. Builds, types, formatting and all five portable checks (nine checker tests) passed. Earlier 665 Python tests plus 175 subtests, 115 SDK tests and 38 MCP tests retain their preceding execution head over unchanged inputs. No full current repository suite, live-provider or native Windows/macOS pass is claimed.

@mldangelo-oai mldangelo-oai left a comment

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.

I’d hold this head for two recovery cases I reproduced.

  • After a final draft confirms worker A’s candidate shared, a later partial draft from worker B can lose its deferred row for shared. Changing only B’s candidate ID preserves the row. This happens in Standard, Diff, and Deep. The terminal-outcome filter in preserveScanDraft compares the raw candidate ID, even though IDs are local to each worker. The regression test should retain B’s row on replay and still suppress A’s stale row.
  • With a legacy budget-deferred row containing paths: [{}], complete-budget-exhausted-scan raises TypeError and leaves the saved scan running. On main, the same command identifies coverage.deferred[0].paths[0] and marks the scan failed. Letting the existing validator handle the malformed path preserves that failure state.

@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: 281b4bf933

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

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants