Skip to content

feat: persist scan lifecycle and model metadata - #264

Open
mldangelo-oai wants to merge 4 commits into
mainfrom
mdangelo/codex/sync-scan-lifecycle-metadata
Open

feat: persist scan lifecycle and model metadata#264
mldangelo-oai wants to merge 4 commits into
mainfrom
mdangelo/codex/sync-scan-lifecycle-metadata

Conversation

@mldangelo-oai

Copy link
Copy Markdown
Collaborator

Summary

  • Persist scan lifecycle and execution-model metadata consistently across Deep Scan ownership, progress, remediation, history, and native indexes.
  • Preserve the public ownership and continuation protections, and update the ownership regression fixture for the new optional model arguments.

Stack

Verification

  • Parsed every bundled workbench Python module.
  • Verified all 94 declared plugin payload files exist.
  • Initialized a fresh private workbench SQLite database successfully.
  • Passed Prettier for all 1 changed formatted files.
  • Passed the focused Deep Scan ownership/continuation regression suite.
  • The complete reconstructed sync passed 775 tests (5 platform/integration skips) and the installed-package smoke test.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the exact current head 52020d9a595870884a17752acd894d8fdc8d026d and only this atomic PR's declared base-to-head diff.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 4, 2026
@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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 52020d9a59

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

Copy link
Copy Markdown

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

Reviewed commit: 52020d9a59

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.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the exact updated head 6e9f17dc700f76f05a6fac398f8500967307cb38. This additive update ships the exact generated MCP runtime from the same original upstream commit and preserves the atomic base-to-head diff.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 6e9f17dc70

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

[�ox��c�3��J�!���ͥ��'�16.h�6���u���}O��c��C2��l���H

P2 Badge Require context before closing false positives

The updated app bundle enables the Close button for false_positive with an empty context and no longer labels that context as required, but require_close_reason still rejects the resulting request with Explain why this finding is a false positive. Selecting False positive and immediately confirming therefore always produces an error instead of closing the finding. Restore the required-state and false-positive-specific prompt in the bundled app.

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

warnings.append(warning)
manifest, findings, _ = _write_prepared_scan_finalization(prepared)
except ContractError as exc:
fail_scan(

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 Leave contract-validation failures resumable

When complete-scan or prepare-scan-completion encounters a repairable malformed draft artifact, this call permanently changes the scan from running to failed before returning the validation error. A failed scan cannot be completed later, so the agent cannot correct the manifest/findings/coverage and retry; this also contradicts the bundled MCP instructions that completion failure alone must not mark the durable scan failed. Preserve the running state on ContractError and reserve fail_scan for an explicit terminal failure.

Useful? React with 👍 / 👎.

Comment on lines +1159 to +1160
model=args.model,
reasoning_effort=args.reasoning_effort,

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 Populate model metadata for setup-UI scans

For the normal app-backed setup flow, the bundled MCP app invokes start_codex_security_scan with only sessionId, while the server handler ignores request metadata and forwards only its optional input fields. Consequently both values passed here are always None, and scans started through the setup UI still store null model and reasoning_effort even though the originating model turn provides them. Retain the metadata from the opening/waiting turn or read it in the start handler so this primary scan path is included.

Useful? React with 👍 / 👎.

"""
UPDATE scans
SET model = COALESCE(?, model), reasoning_effort = COALESCE(?, reasoning_effort)
WHERE id = ?

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 model metadata on terminal Deep Scan rejoins

When an idempotent start_codex_security_deep_scan call rejoins an already completed, failed, or canceled scan, require_owned_scan and the continuation check do not require the parent scan to be running, and this unrestricted update executes before the existing run is returned. A later retry from a turn using different model settings therefore rewrites the historical scan's model and reasoning_effort even though no scan work runs. Restrict this update to running scans so terminal execution metadata remains immutable.

Useful? React with 👍 / 👎.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the exact updated head 9dfdb63ee080f96908786561f4daae2691d641c9. Repairable complete-scan and prepare-scan-completion contract failures now preserve running state; regression tests repair each malformed draft and successfully retry finalization.

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

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

findings = (
row
for row in _active_findings(connection, read_coverage)
for row in _indexed_findings(connection)

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 Exclude findings resolved by later covered scans

When a later completed scan covers a finding's location but no longer reports that finding, _indexed_findings still yields the latest historical occurrence because it only ranks stored occurrences and never examines subsequent scan coverage. Consequently list-global-findings continues presenting the finding as open, and list-repositories also keeps it in openFindingsCount; the removed coverage-aware filtering previously handled this exact resolution case. Restore that filtering or persist an equivalent resolved state when scans complete.

Useful? React with 👍 / 👎.

"findingCount": row["finding_count"],
"handoffStatus": row["handoff_status"],
"mode": row["mode"],
"model": row["model"],

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 Persist model metadata for SDK-registered scans

For scans started through the public TypeScript SDK or CLI, api.ts invokes register-cli-scan, whose insert_running_scan call still supplies neither model nor reasoning_effort; this path also never uses the MCP progress endpoint that can backfill them. Although the saved recipe already contains the effective model and model_reasoning_effort, every such scan therefore exposes null in these newly added history fields. Pass the configured values during registration or extract them from the validated recipe.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 9dfdb63ee0

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.

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.

3 participants