Skip to content

fix(scans): count changed files when registering diff scans - #1916

Merged
mldangelo-oai merged 15 commits into
mainfrom
mdangelo/codex/diff-scope-file-count
Nov 3, 2026
Merged

mldangelo-oai merged 15 commits into
mainfrom
mdangelo/codex/diff-scope-file-count

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A diff scan used to count every file in the checkout. Newly registered CLI, workspace, and prompt-driven scans now count the changed text files selected for review.

Refs #25.

Changes

  • Read committed additions and modifications from the selected head, and deletions from the base. Working-tree scans include staged, unstaged, and untracked text files.
  • Use the existing workbench Git reader to classify files. Registration streams each blob, records whether it is binary, and counts only objects already present in the checkout.
  • Preserve the base version of a modified file beneath a replaced directory link, including Windows junctions, as in fix(scans): retain modified base files below directory links #1927. Keep its ranking preview empty.
  • Stop reading a local file as soon as it is known to be binary. Keep batch Git reads framed and classify the Git object view selected for the scan.
  • Store an unknown progress total when the local objects needed to count the diff are absent. Recheck the working-tree identity after counting and before recording the scan.

Testing

On 11145b59c, 446 Python tests passed across registration, target selection, snapshot binding, and remediation, with 69 platform skips. The packaged inventory, ranking, source-preview, and build suites passed 171 cases on macOS, with 27 skips. Both Ruff checks, the SDK CI build, plugin source compatibility, and all nine checker tests passed.

A real --filter=blob:none clone registered a range with a missing deleted base blob, persisted a null total, and left the object missing. Independent entry-point checks confirmed that saved-workspace, prompt, and CLI diff configurations all require a repository-wide diff. The regression suite also covers edits during counting, directory symlinks and Windows junctions, early binary detection, and active Git replacement objects.

Earlier validation at e11742ddd3f

32 Python tests passed. A real partial clone confirmed missing objects stay unfetched during registration. Both Ruff checks, the SDK CI build and type check, plugin source compatibility, and all nine checker tests passed. The packaged inventory and ranking suites passed 142 cases on Linux and skipped 25 platform-specific cases. The prior feature patch reapplied to 6625739ef81 reproduced the complete refreshed tree.

Earlier validation at 4e57d18a98d

  • Passed 21 focused Python cases covering registration, Git object reads, and transaction behavior. A local partial-clone fixture confirmed that registration fails when a required blob is missing and leaves the blob missing.
  • Passed Ruff lint and formatting, the TypeScript CI build, the plugin source checker, and all nine checker tests.
  • Built the packaged plugin on Linux. In the inventory and ranking suites, 125 cases passed, 25 skipped, and 17 failed in the original temporary-directory setup. The focused registration and source tests above used isolated directories.

Risk and rollout

The count applies to new scans. Registration reads the selected files before model work. Missing local objects leave the estimated total unknown. A working-tree edit during counting requires another registration attempt so the scan binds to the selected snapshot.

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 Oct 24, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T16:26:18.131104Z 1151dcf New commits
🔒 Security Review ✅ Completed 2026-11-03T16:25:50.878494Z 1151dcf New commits

Security findings

Blocking findings (1)

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

@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 the diff scope counts and sharing the inventory selector across all three registration paths. This owner-level merge-safety review found one remaining Windows test mismatch: the new directory-link exclusion changes an existing SDK regression’s expected rows, and the current Windows CI job fails on that assertion. Please update the test as noted inline. No other substantive findings.

Validation: portable source checks, SDK/plugin builds, types, and 14 independent inventory/count parity scenarios passed. Locally, 142 Python inventory/ranking cases, two registration cases, and nine SDK cases passed. Three CLI registration cases and two MCP completion cases were blocked by existing output-ancestor checks; one no-tools fallback fixture was affected by its enclosing Git checkout. Representative failures reproduce on the unchanged base, so these are testing limitations, not regressions. Full local integration coverage was not achieved.

@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 diff scope counts and sharing the inventory selector across all three registration paths. This owner-level merge-safety pass found no additional issues in the count correction. The directory-link behavior and Windows regression covered by the existing thread remain in this head; please fold stacked #1927 into this branch before merging.

Validation: 170 Python cases, all three packaged SDK diff-rank tests, and 14 independent benign count/inventory/registration checks passed. Ruff, the TypeScript CI build, SDK types, plugin packaging, source compatibility, and all nine compatibility-checker tests passed. Three CLI registration tests were blocked by the environment's existing output-parent ownership guard, and one no-tools fixture encountered an enclosing Git checkout; representative failures reproduce on the unchanged base. Full CLI completion and native Windows execution were not verified locally.

@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 sharing the diff inventory across all three registration paths. Owner-level merge-safety review of 391fdaf: no additional count issues. The directory-link omission in the existing thread remains: the current Windows packaged test fails because the committed file below the junction is missing. Please fold the fix from #1927 into this branch before merging.

Validation: 12 focused Python cases and 14 benign count/inventory/registration scenarios passed locally, along with Ruff, CI compilation, SDK types, and all nine source-compatibility tests. Verified 330 relevant Python cases passed in exact-source CI, including all six changed cases. Three local CLI registration cases remain blocked by the environment's output-parent permissions guard; full CLI completion and Windows execution were not run locally.

@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 sharing the diff inventory across all three registration paths. This owner-level merge-safety pass found no additional count issues at c4279a6. The directory-link omission in the existing thread remains: a modified committed file below a directory link is dropped. The local comparison confirms #1927 retains that base file and its empty preview. Please fold #1927 into this branch before merging.

Validation: 129 Python cases, nine count/inventory scenarios, all three packaged diff-rank tests, builds, types, Ruff, and all nine source-compatibility tests passed. Exact-source Linux CI passed all six changed cases on Python 3.12 and 3.14. Four local Python failures reproduce on the unchanged base because of the test environment. Windows execution and full CLI completion were not verified locally; the current Windows packaged job is still running.

@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 sharing the diff inventory across all three registration paths. This owner-level merge-safety pass found no additional count issues at 9848a3f. The directory-link omission covered by the existing thread remains: a modified committed file below a directory link is dropped from the local diff inventory. Please fold #1927 into this branch before merging so the base file remains in scope with an empty preview.

Validation: 170 focused Python cases, 12 independent count/inventory scenarios, all three packaged SDK diff-rank tests on CI-pinned Bun 1.3.14, builds, types, Ruff, and all nine source-compatibility tests passed. Three CLI registration cases and one no-tools fixture failed because of environment conditions that also reproduce on the pinned base. Full CLI completion and Windows execution were not verified locally; the current broader CI run is still in progress.

@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 · Automatically triggered

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

Reviewed commit: fd4eed64f8

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

@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 sharing the diff inventory across all three registration paths. This review found no additional count issues at fd4eed6. The directory-link omission in the existing review thread remains; please fold #1927 into this branch before merging. The existing automated security thread also remains unresolved and needs maintainer triage.

Validation: 170 focused Python cases, 12 benign count/inventory/rank scenarios, two packaged diff-selection tests, builds, types, Ruff, and all nine source-compatibility tests passed. One unrelated no-tools fixture was excluded; known CLI registration environment limits were not bypassed. Full CLI completion, native Windows execution, and the automated security claim were not reproduced locally.

@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 consolidating the registration counts and making the new Git reads use local objects only. The directory-link gap discussed in the existing thread still affects this head: a modified committed text file contributes zero after its parent is replaced by a directory link. A local comparison gives one file with #1927 applied. Please fold that selection fix into this branch so the count retains the base file. No additional substantive findings.

Validation: 23 focused tests, ordinary count and missing-object fixtures, builds, types, Ruff and formatting passed. All 65 exact-tree CI jobs passed; Linux reports confirm the six changed registration cases. Those cases were not selected by Windows CI. Full runtime and SQLite registration suites were not run locally.

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

ℹ️ 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 sharing the selected diff count across the registration paths. Two existing issues still need attention:

  • The modified base-file omission in the existing directory-link thread remains. Please fold the selection fix from #1927 into this branch so the original text file stays counted.
  • The local binary-read concern is also supported: a 1 MiB in-memory input with a NUL at byte zero still consumes all 1,048,576 bytes. Stop early once a separately opened local file is known to be binary, while preserving the draining required for Git batch framing.

Validation: 23 focused tests and three ordinary count controls passed, along with builds, types, Ruff, formatting, and source checks. Exact-source CI passed all 65 jobs; Linux reports confirm six relevant registration cases. Full runtime and SQLite registration suites were not run locally, and those six cases were absent from the Windows selection.

@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 owner-level merge-safety review assessed 6e90d3e0dcad63b2d177a9522d091fa1253849a6 against 607038e13988b791886e1d68cc58174245eb9599. Counting the selected diff is necessary, and the shared registration helper and bounded Git batch reader are a reasonable approach. Two previously reported issues still need resolution before I can approve:

  • The directory-link omission remains at this head: a modified tracked file beneath a replaced directory disappears from the count instead of retaining the relevant base file. The focused control gives 0 here and 1 with the fix in #1927. That child remains open and has not been folded into this branch; #2101 is also an open alternative, so neither resolves this exact head.
  • The local binary-read issue also remains: a separately opened local binary is read to EOF after detection. Preserve full draining for Git batch framing, but stop early for local files so scan registration does not read entire large binaries unnecessarily.

Verification: Ruff checks, SDK CI/plugin builds and types, source compatibility plus its 9 tests, and packaged diff-rank tests passed (3 passed, 2 Windows skips). Focused Python validation recorded 172 passed, 73 platform skips and 5 Git-discovery fixture failures attributable to the local enclosing repository marker; the affected discovery functions are unchanged from base, and I did not rerun those fixtures on base. All new cases passed. Source CI passed all 65 jobs on a full Git tree identical to this head. New count tests run in Linux CI, not the native Windows/macOS subsets. No additional inline comments; the two existing threads cover the remaining findings.

@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 correcting registration to count the selected diff. This owner-level merge-safety review confirms three existing issues:

  • Missing local blobs abort registration: a real partial clone with a materialized HEAD but a missing deleted base blob cannot register because the optional count raises. Preserve the no-fetch boundary and leave the total unknown when classification is unavailable.
  • Local binaries are drained after classification: a 1 MiB input with a NUL at byte zero still consumes all 1,048,576 bytes. Stop early for separately opened local files while retaining the draining needed for Git batch framing.
  • The previously reported directory-link omission still occurs for a supported working-tree scan against an older base: a modified skip-worktree file counts as zero after its parent becomes a directory link. Retain the relevant base file as in the still-open #1927 fix. The ordinary deletion case correctly counts one.

I did not confirm the scoped-diff concern: public setup and CLI recipes reject those inputs. The post-count snapshot ordering also predates this patch. No duplicate inline comments.

Validation: the ordered portable checks, 31 focused Python tests and independent count controls passed; three other selected fixtures were blocked by existing ownership checks. Matching-tree CI passes all 20 changed regression cases on Linux Python 3.10/3.12/3.14; those cases were not selected on macOS/Windows. Local persistence remains constrained by existing ownership protections, and CI has an unrelated unchanged SDK signal-test failure. No full local integration or native Windows execution 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 addressing the count and inventory edge cases. Reviewed 1151dcf2e2aaeabd58cd29f08a88cc9051542800; no remaining findings.

Missing local Git objects now preserve an unknown total without fetching, local binary reads stop early while Git batch reads preserve framing, and directory-link replacements retain the selected base file. I also checked the post-count working-tree identity checks and nullable count persistence across registration paths.

Validation: 18 focused Python tests, 11 packaged inventory tests (46 assertions; one Windows-only skip), nine source-checker tests, and 11 temporary-Git control groups passed, together with the required lint/source checks, SDK/plugin builds, types and formatting. Inspected current CI reports for the exact base/head merge whose tree matches this head: the eight new regression cases pass on macOS and Windows, and 25 relevant cases pass on Linux 3.10 and 3.14.

Full persistent registration was not rerun locally because of the existing filesystem-owner restriction; its relevant regression coverage comes from those hosted reports. The Linux 3.12 report download was unavailable, so I am not claiming its individual results. No live scan was run.

@mldangelo-oai
mldangelo-oai merged commit 63afe50 into main Nov 3, 2026
137 of 139 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/diff-scope-file-count branch November 3, 2026 17:09
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
3 tasks
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.

2 participants