Skip to content

fix(workbench): bind finding excerpts to selected source paths - #636

Open
mldangelo-oai wants to merge 30 commits into
mdangelo/codex/fix-scan-budget-attributionfrom
mdangelo/codex/fix-finding-excerpt-scope-clean
Open

fix(workbench): bind finding excerpts to selected source paths#636
mldangelo-oai wants to merge 30 commits into
mdangelo/codex/fix-scan-budget-attributionfrom
mdangelo/codex/fix-finding-excerpt-scope-clean

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bind optional finding source excerpts to the source paths and exact Git tree selected when a scan starts. Reuse immutable tree traversal across findings, keep expensive target verification outside database writer transactions, and preserve fail-closed handling for actual aliases, linked ancestry, and replacement-object views.

Changes

  • Persist selected source paths and kinds for new scans with append-only migration 33, completing authority capture and full Deep Scan target verification before writer transactions while retaining a cheap in-transaction checkout identity check.
  • Resolve authorized paths through the captured target tree, preserve the actual checkout root for subdirectory targets, reuse successfully parsed immutable tree entries across matching and missing findings, distinguish genuinely separate case-sensitive filenames from aliases on every lookup, reject linked or reparse-point ancestry, and read validated blob object IDs directly.
  • Derive immutable committed-scan scope authority from the intersection of the selected Git tree and current checkout kinds, preserving historical files without broadening a selected file into an unrelated historical directory.
  • Stream valid Git tree entries without imposing checkout-specific filename limits, including oversized unrelated siblings and oversized normalized aliases.
  • Detect replacement refs under the active GIT_REPLACE_REF_BASE while omitting optional excerpts for malformed, mutable, changed, or legacy scan targets.
  • Write Git alternates fixtures with explicit LF bytes so cached-upgrade coverage works on native Windows.
  • Advance the bundled plugin identity from 0.1.46 to 0.1.47, preserving the parent stack's installed-plugin safety-forwarding coverage.

Testing

  • bun test --timeout 90000 tests-ts/workbench-source-excerpt.test.ts: 4 passed; 39 expectations.
  • bun test --timeout 90000 tests-ts/diff-rank-input.test.ts: 6 passed; 97 expectations, including concurrent parent replacement, transient Windows sharing and lock violations, and installed safety forwarding.
  • bun test --timeout 90000 tests-ts/cost.test.ts: 60 passed; 183 expectations.
  • ./node_modules/.bin/tsc --noEmit
  • node scripts/generate-models.cjs --check
  • node --run build
  • Repository-wide Prettier checks.
  • npm pack --ignore-scripts and node scripts/check-package.mjs <tarball> plugin-files.json: validated all 265 package entries.
  • Failing-first coverage reproduced missing excerpts with a real committed 2,048-byte sibling, distinct case-sensitive filenames in full-repository and subdirectory targets, repeated successful and missing-path tree traversals, historical file/directory changes, and blocked concurrent database writers; additional streamed fixtures cover names and normalized aliases larger than 64 KiB.
  • Three distinct excerpts and three missing findings each share one Git batch and two unique tree reads. Historical committed files remain available when the current checkout contains a directory, without granting directory authority when the checkout selected a file. Six concurrent SQLite writers acquire their own transactions during target hashing; post-capture content changes and a real checkout-directory replacement after the writer transaction begins both remain rejected.
  • git show --check HEAD

Risk and rollout

The migration only adds nullable metadata. Existing scans continue to work and omit optional excerpts when source authority is absent. Replacement-ref checks remain unchanged and fail closed, while actual filesystem aliases remain rejected even when immutable tree entries are reused or the target is a Git subdirectory. Committed-scan scope kinds use the narrower of the current checkout and selected tree. Full target verification occurs before obtaining a writer lock, and the existing checkout device/inode identity check remains inside the transaction. The bundled plugin version refreshes installed caches, while the parent stack retains its existing safety-forwarding and cross-platform confinement coverage.

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.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 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-08-25T06:00:00.048352Z 8baae67 Manual request
🔒 Security Review Completed 2026-08-25T06:00:45.077627Z 8baae67 Manual request
ℹ️ 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: 566f5c4de7

ℹ️ 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/_bundled_plugin/scripts/workbench_source_excerpt.py Outdated

@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: 8ff61b6145

ℹ️ 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/_bundled_plugin/scripts/workbench_source_excerpt.py Outdated
Comment on lines +295 to +298
if process.stdout.read(1):
if process.poll() is None:
process.kill()
return False

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 Ignore replacement refs when replacements are disabled

When a repository contains any active replacement ref—even one for an unrelated historical object—this branch suppresses every source excerpt. All subsequent object reads already pass --no-replace-objects, which Git documents as disabling replacement refs, so the refs cannot alter the tree or blob being displayed; probing for their mere presence introduces an unnecessary output regression for repositories that legitimately use git replace.

AGENTS.md reference: AGENTS.md:L19-L22

Useful? React with 👍 / 👎.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 8ff61b6145

ℹ️ 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: 8ff61b6145

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

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@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: 03af8b7137

ℹ️ 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/_bundled_plugin/scripts/workbench_source_excerpt.py Outdated
Comment thread sdk/typescript/_bundled_plugin/scripts/deep_scan_workbench.py Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 03af8b7137

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

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 6fd4128627

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

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fd4128627

ℹ️ 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/_bundled_plugin/scripts/workbench_source_excerpt.py
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_source_excerpt.py Outdated
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_source_excerpt.py
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 8baae67d58

ℹ️ 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: 8baae67d58

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant