Skip to content

fix(bulk-scan): repair retained checkouts and regenerate reports - #2332

Open
mldangelo-oai wants to merge 46 commits into
mdangelo/codex/authenticate-multiscan-recoveryfrom
dev/codex/repair-retained-campaign-checkouts
Open

mldangelo-oai wants to merge 46 commits into
mdangelo/codex/authenticate-multiscan-recoveryfrom
dev/codex/repair-retained-campaign-checkouts

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A verified bulk scan can regenerate a missing or edited report without repeating the scan. Recovery also restores missing tracked paths needed to read the saved scope or invoke the selected report interpreter. This PR is stacked on #466.

Changes

  • Restore missing files from the pinned Git revision while preserving unrelated worktree edits, staged entries, the retained checkout’s configuration and its effective HEAD. Reuse local Git objects when the remote is offline.
  • Regenerate unsealed Markdown reports from validated scan data. Preserve sealed reports and distinguish named report entries from hard-linked aliases.
  • Restore explicit interpreter aliases using the same spelling accepted at launch, including literal trailing spaces. Keep bare executable discovery under the existing campaign PATH rules.
  • Reject combinations of report-only generation with other projection actions before writing output.
  • Clean up the temporary Git directory with try/finally so the packaged CLI starts on the supported Node 22.13.0 runtime.
  • Reject a redirected recovery checkout parent before starting a retry or appending a receipt. Keep the last completed attempt and the checkout it was bound to.
  • Resolve configured recovery targets with the same physical path semantics as the original scan. Preserve literal CSV scopes such as ~/src. Recover a missing tracked directory link from the pinned revision and preserve unrelated deletions.
  • Retain the authenticated recovery billing and retry behavior from fix(bulk-scan): validate saved results before campaign resume #466. Skip retained-path repair for pending cleanup only while the existing marker still identifies that checkout; a replacement checkout follows the normal repair path.
  • Reuse authenticated completed results directly when regenerating a missing report, allowing the selected interpreter alias to be restored before rendering. Recovery callbacks continue to handle unfinished attempts.
  • Honor filesystem Unicode aliases during retained path repair while preserving distinct filenames and unrelated deletions. Keep existing case matching and raw Git path bytes.
  • Preserve legacy receipt scope verification after integrating the authenticated recovery parent, including receipts without a registered target or resolved scope.
  • Preserve effective Git settings during retained repair, including disabled symlinks and trusted conditional host credentials and filters. Keep command settings above copied local filesystem settings.
  • Refill missing Git objects without shortening retained full or shallow history. Preserve the original index, fetch metadata and failure cleanup when reconstructing a missing HEAD.
  • Published documentation: update the bulk-scan recovery workflow to describe unsealed report regeneration and pinned path restoration.

Testing

Current validation at 5ea35cdc: build, types, formatting, runtime preflight, three host controls and 95 runtime configuration controls passed on Linux. All 99 focused recovery tests passed (611 assertions). Both full SDK orders passed: seed 12345, followed by types and formatting, then the default coverage order. Each full order had 13,502 passes, 176 skips, one todo and zero failures across 346 files. JUnit and LCOV reports were produced; all 1,797 tracked inputs remained unchanged. Three fresh native reviews and independent verification completed cleanly. The new archive passed all five selected Linux installed-package checks.

Selected deterministic evaluation checks are qualified: the affected dependency CLI contracts and all 37 Standard time-budget cases passed on Node 24.15.0. Seven unchanged standalone owners retain their original hosted execution on the parent branch, with their consumed source inputs matched to this head.

The preceding draft passed 15 focused real Git controls, including disabled symlinks, explicit command-setting precedence, conditional host credentials and filters, full and shallow retained history, and missing-HEAD success, failure and cancellation. The final run of 99 tests also passed with the final cleanup simplification and adjacent recovery behavior. Credential controls use native credential lookup with synthetic helpers and local Git fetches; they do not claim authenticated HTTP coverage. Earlier exact-production controls demonstrated all three Git regressions, and their failures remain recorded at their execution heads.

The owning set also covers physical paths, literal CSV scopes, selected interpreter aliases, callback accounting, cancellation, raw filenames, staged deletions, filesystem spelling distinctions and legacy receipt reuse. Unicode controls ran on a normalization-sensitive Linux filesystem; no macOS execution is claimed. Real controls distinguish representable original filename spellings from an overlong lowercase probe and avoid a write to a read-only parent when existing directory identities resolve the names. The literal CSV scope and CLI interpreter regressions fail against their preceding production code and pass after correction.

The five ordered portable source checks passed on unchanged consumed inputs. Full Python (4,309 passed, 152 skipped, 434 passing subtests) and the canonical MCP build/test (2,004 passed, 38 skipped) ran at 0a2393df and apply to identical plugin, generated, tool and dependency inputs. The fresh 5ea35cdc archive passed the canonical installed-package check serially on Node 22.13.0, 24.0.0, 24.22.3, 26.0.0 and 26.13.1, including its nested installed smoke. Its content inspection also passed. The checker removed its temporary installed dependency trees, so those transient trees were not retained. Earlier package successes remain attributed to their original commits. Historical validation below retains its original execution references.

At 2ac52f63 on Linux, 18 focused SDK tests passed after integrating #466 and reusing the existing parent-path resolver. They covered physical paths, interpreter aliases with trailing spaces, staged deletions, report regeneration, receipt validation and configured exclusions. The plugin build and five portable source checks also passed during integration.

Verified that scoped restoration through a private pinned index preserves an unrelated staged deletion and staged edit with a missing HEAD. The tests also cover sparse entries and a non-executable name earlier on the interpreter search path. All nine interpreter alias cases passed at 5c3f1969e.

  • Twenty-two targeted alias, report, and runtime cases passed. All 29 retained checkout tests passed, including checks for preserved Git configuration, missing metadata, staged deletions and offline recovery.
  • Six Python finalizer and projection suites passed with 321 tests, two skips, and 232 passing subtests. Eight direct report-only probes verified regenerated output, sealed reports and rejection of altered input.
  • SDK and MCP types, the plugin bundle and the five ordered portable checks passed, including all nine source-checker tests.
  • All four affected SDK suites passed on both bcd3d029 and 1e267d64 with seed 12345 on Linux (335 passed, five platform skips). An earlier run exposed three obsolete fixtures. The corrected fixtures exercise the protected executable boundary and create the replacement scan in a separate checkout.
  • Built tarballs from bcd3d029 and 1e267d64 and installed each in a clean directory. On Node 22.13.0, both codex-security --help and --version exited 2 with Unexpected identifier 'repair' before the fix. Both exited 0 after the fix. The installed CLI printed its help and version 0.10.0. The repository’s full installed-package check passed on Node 22.13.0 with deep retry enabled, including the bundled plugin, SDK lifecycle and nested worker.
  • On 1e267d64, traced successful and failed Git restores. Both removed the private Git directory, and the failure still reached the caller. SDK and MCP type checks, formatting and all five portable checks passed.
  • A broader seeded SDK run was stopped after 515 passes, five Windows skips and seven workflow telemetry failures. The affected workflow module passed all 22 tests in isolation at the same seed. Their historical cause was not established; the current full SDK results are reported above.
  • On 805d0558, 22 focused Linux tests passed with one Windows-only skip. The incomplete-attempt regression recorded two failed retries on the previous head. With the fix, redirecting the recovery root or the task parent preserved the ledger, Git HEAD and local file. SDK and MCP types, formatting, and the five portable checks passed. The npm-installed CLI passed --help and --version on Node 22.13.0. The full installed-package check also passed with deep retry enabled.
  • On 7407733f, all 10 focused physical-path cases passed under Node on Linux. Two public bulk-scan --recover runs used a populated local Git repository and a previously sealed Standard scan. With the directory link present or deleted, both restored the selected file, preserved the unrelated deletion, Git index and receipt, and made zero new model requests. Both cases previously failed on 805d0558 after restoring the unrelated file.
  • Applied the existing test fixture correction from test(sdk): preserve the env utility name in inventory fixtures #2678 after the two inventory wrapper assertions failed on Ubuntu 26.04. On 288f02be, both inventory cases and all 10 physical-path cases passed on Linux. Both public recovery cases, SDK and MCP type checks, formatting, and the five portable source checks also passed.
  • A hosted macOS run exposed an unrelated file restoration when a regular file obstructed the requested traversal. On a0d949dc, recovery checks the directory before writing. All 12 focused cases and three public CLI cases passed on Linux. The obstructed CLI case returned ENOTDIR with the obstruction intact, both files still deleted, and the receipt unchanged.

Risk and rollout

Fetching missing objects requires access to the pinned revision. Regenerating an unsealed report replaces edits to that report. The original sealed data and any already sealed report remain available. This change targets the #466 branch.

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 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-22T01:14:51.248437Z 5ea35cd New commits
🔒 Security Review ✅ Completed 2026-11-22T01:15:52.617601Z 5ea35cd 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: 94ba9b688b

ℹ️ 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/src/multiscan.ts Resolved

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

The existing interpreter recovery finding still applies. A Node control confirms that an accepted jump/../python path selects tools/python, but recovery normalizes it to python; restoring that wrong path leaves the interpreter unavailable. Preserving the physical spelling restores the correct tracked alias. No duplicate inline comment.

Builds, types, formatting and portable checks pass. Bounded Git/Python controls cover path repair, unrelated edits and sealed-report identity. Campaign tests stop at the environment’s existing output-owner check; full campaign, Windows and native enforcement runs are not 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.

The existing interpreter recovery finding remains; production code is unchanged. The test update correctly compares restored bytes with that same checkout before deletion. No duplicate inline comment.

Formatting passes. Both changed cases stop at the existing output-owner check before repair. Earlier build, type, portable and bounded Git/Python results transfer with verified identical production and dependencies; no fresh full campaign or Windows run 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.

The existing interpreter recovery finding remains. The feature and affected production code are unchanged by this base update; no duplicate inline comment.

Prior focused repair checks and their directory-ownership limitation retain their original scope. Reviewed the incoming advisory and mutation-toolchain changes using source-equivalent shared checks. No fresh full campaign or platform run 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.

The existing interpreter recovery finding remains. Current Node/Python and Git controls reproduce the wrong repair path after the configured interpreter is removed; preserving physical path traversal restores it. No duplicate inline comment.

The parent update preserves the feature edits. Current frozen installs, plugin/SDK builds, types, formatting, and portable checks passed. The direct repair controls passed; prior campaign tests remain limited by the directory-ownership guard. No fresh full campaign or Windows run 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.

The existing interpreter-recovery issue remains. This update also inherits the parent’s request-digest mismatch: telemetry correlation changes the saved identity, so unchanged scans fail reuse/recovery checks. Both findings are linked without duplicate inline comments.

Current builds and typechecks pass after the assertion fix. Portable and Node/Python/Git repair checks passed on identical production source; paired digest/consumer controls confirm the inherited issue. Full campaign and Windows execution remain unverified.

@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 the update. The parent’s request-digest mismatch is repaired. The existing interpreter-recovery issue remains: an accepted symlink/.. path is flattened before recovery, so it restores the wrong path. Current Node/Python/Git controls reproduce this; no duplicate inline comment.

Current builds, typechecks, formatting and portable checks pass. The parent’s eight digest scenarios and 32 workflow-binding comparisons also apply to identical code here. Full campaign and Windows execution remain unverified; maintained campaign tests encountered the directory-ownership guard.

@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 the fixture fix. The existing interpreter-recovery issue still needs attention: recovery flattens an accepted symlink/.. path and restores the wrong file. Fresh Node/Python/Git controls reproduce this for absolute and home-relative paths; preserving physical traversal restores the interpreter.

This owner-level merge-safety pass found no additional issue. Three CSV parsing/registration controls, typechecks, formatting and portable checks pass. Prior build evidence applies to identical production and dependency inputs. Full campaign and Windows execution remain unverified; the previously observed directory-ownership limitation was not bypassed.

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.

🟡 Changes recommended

Recovery can restore replacement content while still reporting the pinned SHA, and switching a retained checkout can fail on or overwrite unrelated local changes.

2 open issues
What changed in this PR

Extends the saved-result validation in #466 with retained-checkout repair and report regeneration, allowing bulk scans to reuse validated results without repeating analysis.

Changes:

  • Adds recovery of missing tracked paths from the pinned revision, using local objects before fetching.
  • Regenerates unsealed reports with the selected schemas and Python interpreter while preserving sealed reports.
  • Expands recovery regression coverage and documents resume behavior.
File Description
sdk/​typescript/​tests-ts/​runtime.test.ts Tests Python selection and environment preservation.
sdk/​typescript/​tests-ts/​plugin-report-limits.test.ts Tests report-only generation and sealed-report preservation.
sdk/​typescript/​tests-ts/​multiscan.test.ts Adds checkout, scope, interpreter, and recovery regression cases.
sdk/​typescript/​tests-ts/​multiscan-recovery.test.ts Tests report regeneration, cancellation, and cleanup failures.
sdk/​typescript/​tests-ts/​multiscan-checkout.test.ts Updates expectations for reuse after missing-report recovery.
sdk/​typescript/​tests-ts/​multiscan-authority.test.ts Tests sealed-report reuse and retained Git configuration isolation.
sdk/​typescript/​tests-ts/​contract.test.ts Tests sealed-report identification and file aliases.
sdk/​typescript/​src/​runtime.ts Returns the selected Python command with its environment.
sdk/​typescript/​src/​multiscan.ts Integrates retained-checkout repair and report regeneration.
sdk/​typescript/​src/​contract.ts Adds sealed-report detection.
sdk/​typescript/​docs/​cli.md Documents report replacement and checkout recovery.
plugins/​codex-security/​scripts/​report_projection.py Adds sealed-report alias detection and shared CSV helpers.
plugins/​codex-security/​scripts/​finalize_scan_contract.py Adds report-only generation and permits additional fingerprint fields.

Review effort: Balanced

Comment thread sdk/typescript/src/multiscan.ts Resolved
Comment thread sdk/typescript/src/multiscan.ts Resolved
@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".

@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 the update. This owner-level merge-safety pass confirms three existing findings remain: interpreter recovery restores the wrong file after flattening a symlink/parent path; Git replacement objects can supply different bytes under the pinned commit; and switching the retained checkout can conflict with or rewrite unrelated work. Current Node/Python/Git controls reproduce all three. Please address the existing inline threads before merging.

Builds, types, formatting, and portable checks passed. Three focused Bun cases passed; two stopped at local ownership or enclosing-checkout protections. Full campaign and Windows execution remain unverified.

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

The existing interpreter recovery, Git replacement-object, and retained checkout switching findings remain on dc79eea. Six fresh current-source controls reproduce them and verify healthy scoped restoration. This update changes only the inherited Windows campaign fixture; all 13 PR feature files remain byte-identical. Existing inline comments are not duplicated.

Fresh builds, types, formatting and portable checks pass, including nine source-checker and three focused report/Python cases. The two documented local ownership/protected-root failures were excluded rather than repeated. The changed Windows cases remain unverified: exact-head Source CI run 42339895890 was queued at inspection. No full campaign, native-policy or Windows execution is claimed.

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

Resolve configured paths with the same platform rules used by scan target normalization. Follow any missing tracked links from the pinned Git tree before applying a parent component or selecting files for restoration.

Exercise the public SDK under Node with a surviving, missing, repeated, or obstructed link and verify that unrelated deletions and the completed receipt are preserved.

@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: 7407733f87

ℹ️ 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/src/multiscan.ts Resolved

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

ℹ️ 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/src/multiscan.ts Resolved
Comment thread sdk/typescript/src/multiscan.ts Resolved

@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: 223f84063f

ℹ️ 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/src/multiscan.ts Resolved
…ations

Use median suite durations from the two previous successful macOS reports. The shard containing both campaign suites exceeded its 20-minute job limit after integration with main.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants