Skip to content

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

Draft
mldangelo-oai wants to merge 24 commits into
mainfrom
mdangelo/codex/finding-excerpt-scope-v8-20260816
Draft

fix(workbench): bind finding excerpts to selected source paths#488
mldangelo-oai wants to merge 24 commits into
mainfrom
mdangelo/codex/finding-excerpt-scope-v8-20260816

Conversation

@mldangelo-oai

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

Copy link
Copy Markdown
Collaborator

Summary

Bind optional finding excerpts to the Git objects and paths selected when a scan starts. Omit excerpts when the scanned source cannot be established, without removing the finding.

Changes

  • Save nullable source-scope metadata with additive migration 42 and share it across scan-start and preview paths. Preserve published migrations 1-41 and upgrade earlier previews recorded as 34, 40, or 41.

  • Read selected immutable tree/blob objects without fetching missing data or substituting replacement refs. Preserve unambiguous historical scopes and omit working-tree diff excerpts.

  • Fix the reviewed descendant-alias ambiguity: colliding Git names now require the existing filesystem witness, even when the finding uses an exact Git spelling.

  • Replace three excerpt-selection passes and their result cache with one stable priority-ordered pass. Shorten the user documentation; retain root-control preference and safe fallback locations.

  • Integrate main 70d9ece and adopt its paired plugin markers at 0.1.79. Move the source-scope helper to canonical plugin source so it is included in generated bundles.

  • Give the new helper the standard plugin-script help entrypoint required by the existing source checks; source-scope selection is unchanged.

  • Use the existing asynchronous Bun subprocess pattern for the isolated-timeout regression after Windows repeatedly returned an immediate timeout from the synchronous call. Preserve the 30-second outer bound and the asserted 100-millisecond inner timeout.

Testing

Merge conflict resolution at 565639dfdb06506c0d3de77c2380ed8d330bcb5a against main at 6750642c94edce8d60112f816631de05dc10efd6:

  • Preserve main's published migrations 1-41 and append source scopes as migration 42, including upgrades from preview numbers 34, 40, and 41. Keep the existing helper-module split within the portable file-size limit.
  • Python setup and migration tests: 66 passed, including all three preview upgrades and existing comparison-index migration cases.
  • The focused finding-preview migration regression passed after rebuilding the plugin bundle; the earlier 24-test finding-preview run is recorded below.
  • All three portable plugin source checks with Ruff 0.16.1 and git diff --check passed.
  • The full test suite was left to CI.

Earlier validation recorded for prior heads:

Merge conflict resolution at 11e3b9323af6ed9372c413b86e755abb852d99ea against main at 3c44b607dc05639a0e307a50d6dad1f822aeac00:

  • Preserve main's published migration 40, append source scopes as migration 41, and cover upgrades from both preview numbers 34 and 40. Move recipe helpers into existing modules to satisfy the portable file-size check and adapt the preview fixture to main's related-findings parameter.
  • Python setup and migration tests: 65 passed, including both preview upgrades and the existing comparison-index migration cases.
  • Focused Bun finding-preview tests: 24 passed.
  • Plugin bundle generation, all three portable source checks with Ruff 0.16.1, and git diff --check passed.
  • The full test suite was left to CI.

Earlier validation recorded for prior heads:

Windows CI follow-up: 66a858fc858b3b4ce253d7139a37dfd701e39c20.

  • The preceding head passed Python source contracts, SDK tests on Unix, package checks, MCP tests, and all but one Windows test shard. The same isolated-timeout test failed again when only failed jobs were retried.
  • The updated TypeScript test parsed and formatted successfully with the installed Prettier. Local execution of this final patch remains blocked by disk exhaustion; native Windows validation is required in the new CI run.
  • Earlier migration validation passed all 62 Python setup/migration checks, including the old-preview upgrade regression. All three script-help and finalizer CLI checks passed after adding the standard helper entrypoint.
  • Published migrations 1-39 remain unchanged. Ruff lint/format, portable source compatibility, plugin build and source checks passed after the migration/help repair; this follow-up changes only the existing timeout test.

Risk and rollout

Migration 42 does not rewrite existing scans. Ambiguous excerpts are omitted; unambiguous sources, findings and public launch recipes remain available. The plugin version refreshes cached payloads without publishing a package. This PR remains a draft. The existing review finding is addressed in code; its thread has not been resolved or replaced with a new review.

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.

Existing commit contact metadata and account-specific automated review links prevent the second attestation. This update uses synthetic fixtures and a GitHub noreply commit identity; historical metadata and other authors' comments are unchanged.

@github-actions github-actions Bot added the bug Something isn't working label Aug 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: e2e177ba65

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

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 commit 90df0d476b7705a699256ef42078d5ec52073464.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 90df0d476b

ℹ️ 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: 90df0d476b

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 commit ed885606373b565c88a1b87b2649aa140ba1e758.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: ed88560637

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

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.

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head, d526d485ccde456e253a6ce60b5ba702121c8f73, after the additive main merge. Please check that the saved source-scope and migration 34 contracts remain intact.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: d526d485cc

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

Copy link
Copy Markdown
Collaborator Author

@codex security review

Please review the current head d526d485ccde456e253a6ce60b5ba702121c8f73.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: d526d485cc

ℹ️ 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 exact head cad99e064009a02ce28acb452fdc28bc021da31b, especially source-scope capture and loading, alias and replacement-ref handling, working-tree diff omission, migration 34, and the 0.1.25 to 0.1.36 cache refresh.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

Please review exact head cad99e064009a02ce28acb452fdc28bc021da31b, especially whether optional excerpts remain bound to selected immutable Git objects across aliases, historical rows, replacement refs, missing objects, and working-tree diffs.

@mldangelo-oai mldangelo-oai changed the title fix(workbench): keep finding source excerpts within requested paths fix(workbench): bind finding excerpts to selected source paths Aug 22, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 22, 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-09-03T23:52:50.212888Z 565639d 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: cad99e0640

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

if scope["kind"] == "file":
return scope["objectId"] if not suffix else None
relative = PurePosixPath(*suffix).as_posix()
entry = exact_tree_path(repository, scope["objectId"], relative)

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 Reject ambiguous descendant aliases before reading blobs

On a case-insensitive checkout, when a selected directory contains colliding Git entries such as foo.py and FOO.py, this exact lookup trusts whichever spelling the finding reports before attempting the filesystem-backed ambiguity check. Because the working tree can expose only one of those entries, the spelling does not establish which blob was scanned, so sourceExcerpt can display the sibling blob instead; route normalized collisions through the witness check or omit the excerpt.

AGENTS.md reference: sdk/typescript/AGENTS.md:L27-L27

Useful? React with 👍 / 👎.

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

Critical review

Reviewed head cad99e064009a02ce28acb452fdc28bc021da31b.

Recommendation: fix the remaining descendant-alias ambiguity before merging. Binding optional excerpts to scan-time Git objects and selected paths is necessary; showing a plausible excerpt from the wrong blob is worse than omitting the excerpt.

[P2] Exact descendant spelling bypasses the ambiguity check

The existing comment at source_object_for_path still applies. For a selected directory containing case-colliding Git entries, the first exact_tree_path call does not require unambiguous normalized aliases. If the finding supplies either exact Git spelling, it returns that blob immediately; the filesystem-backed witness is consulted only when the exact lookup fails.

On a case-insensitive checkout, two Git entries such as foo.py and FOO.py can refer to one materialized pathname, so spelling alone does not identify the bytes that were scanned. I created a real Git tree containing both blobs and injected an unresolved filesystem witness. The current function returned the uppercase blob and never invoked the witness. This is a control-path reproduction, not a native case-insensitive filesystem run.

Route normalized collisions through the witness check, or omit the excerpt when identity cannot be established. Do not blanket-reject these repositories or suppress otherwise unambiguous findings. Add a descendant-collision case; the selected-root alias tests do not exercise this shortcut.

Necessity and simplification

Recording scope kind and object identity at scan start is preferable to guessing from today's checkout. Keeping working-tree excerpts unavailable, disabling lazy fetch/replacement substitution for historical reads, and leaving the finding usable when optional excerpt binding fails are appropriate boundaries. The append-only migration and hiding legacy internal recipe fields also keep the public launch recipe clean.

Keep one scope/path authority implementation shared by preview consumers. Avoid widening this optional display feature into a new source-access policy framework, and coordinate its bundled version with the other open plugin changes when assembling a release.

Verification

Ran finding-preview, publication-store, and report-limit suites: 39 passed, 0 failed, plus the targeted Git-tree/witness probe. Linux with Bun 1.3.14 / Node 22.13.1 and cached dependencies; no native Windows/macOS or live model scan was run.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review current head 4d228cbe957988387c773366eeefb539643bf0bb after the additive merge from its updated base, including the conflict resolution and preserved behavior. Focused validation is recorded in the PR description.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review current head 62dd525e30d98bd1375638d46d19c6dbb8d5bdc7, including the base integration and verified CI follow-up. Current validation is recorded in the PR description.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 62dd525e30

ℹ️ 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 66a858fc858b3b4ce253d7139a37dfd701e39c20 after the CI and integration follow-up.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 66a858fc85

ℹ️ 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 head 11e3b9323af6ed9372c413b86e755abb852d99ea against main at 3c44b607dc05639a0e307a50d6dad1f822aeac00. Preserve main's published migration 40, append source scopes as migration 41, and cover upgrades from both preview numbers 34 and 40. Move recipe helpers into existing modules to satisfy the portable file-size check and adapt the preview fixture to main's related-findings parameter.

Python setup and migration tests: 65 passed, including both preview upgrades and the existing comparison-index migration cases. Focused Bun finding-preview tests: 24 passed. Plugin bundle generation, all three portable source checks with Ruff 0.16.1, and git diff --check passed. The full suite is left to CI.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 11e3b9323a

ℹ️ 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 head 565639dfdb06506c0d3de77c2380ed8d330bcb5a against main at 6750642c94edce8d60112f816631de05dc10efd6. Preserve main's published migrations 1-41 and append source scopes as migration 42, including upgrades from preview numbers 34, 40, and 41. Keep the existing helper-module split within the portable file-size limit.

Python setup and migration tests: 66 passed, including all three preview upgrades and existing comparison-index migration cases. The focused finding-preview migration regression passed after rebuilding the plugin bundle; the earlier 24-test finding-preview run is recorded below. All three portable plugin source checks with Ruff 0.16.1 and git diff --check passed. The full suite is left to CI.

@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: 565639dfdb

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

excerpt_locations.append(
{
"endLine": row["end_line"],
"path": row["relative_path"],

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 Omit excerpts when the displayed path is truncated

When a valid repository-relative path exceeds FINDING_LOCATION_PATH_BYTES, location.path is truncated for the response while excerpt_locations retains the full database value, so sourceExcerpt is read from a file that the reported relative location no longer identifies; two deep paths with the same first 2,048 bytes can even display identically while showing different source. Preserve the prior alignment by omitting the excerpt when bounding changes the path, or perform the lookup using the exact path returned to the caller.

AGENTS.md reference: AGENTS.md:L30-L33

Useful? React with 👍 / 👎.

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