Skip to content

fix(workbench): accept clean git worktree targets - #812

Open
Hughhhhcoder wants to merge 2 commits into
openai:mainfrom
Hughhhhcoder:codex/codex-security-clean-worktree-target
Open

fix(workbench): accept clean git worktree targets#812
Hughhhhcoder wants to merge 2 commits into
openai:mainfrom
Hughhhhcoder:codex/codex-security-clean-worktree-target

Conversation

@Hughhhhcoder

Copy link
Copy Markdown
Contributor

Summary

Fixes #62. Bulk scans can legitimately register a clean checkout as a git_worktree, but the completion contract currently allows only git_revision when the worktree content is clean. The scan can finish with valid artifacts and then fail at sealing with scan.target.kind: must match the workbench target.

Changes

  • Allow both git_revision and git_worktree for a clean worktree content digest.
  • Add a completion regression that seals a clean git_worktree manifest successfully.
  • Update the existing contract expectations for clean Git targets.

Testing

  • python -m pytest plugins/codex-security/tests/test_workbench_completion_binding.py plugins/codex-security/tests/test_workbench_db.py -q — 134 passed
  • python -m pytest plugins/codex-security/tests/test_finalize_scan_contract.py plugins/codex-security/tests/test_workbench_db_exports.py -q — 185 passed
  • uvx --from ruff==0.16.1 ruff check --config plugins/codex-security/pyproject.toml .github/scripts/check_plugin_source_compatibility.py .github/scripts/test_check_plugin_source_compatibility.py plugins/codex-security — passed
  • uvx --from ruff==0.16.1 ruff format --check --config plugins/codex-security/pyproject.toml .github/scripts/check_plugin_source_compatibility.py .github/scripts/test_check_plugin_source_compatibility.py plugins/codex-security — passed
  • python .github/scripts/check_plugin_source_compatibility.py — passed
  • git diff --check — passed

Risk and rollout

This is a compatibility fix for an existing target representation. It does not change the public CLI, target selection, snapshot validation, or the stricter rules for dirty worktrees, diffs, and directory snapshots.

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 Sep 4, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 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-04T16:16:32.542231Z ad53315 Manual request
🔒 Security Review Completed 2026-09-04T17:02:27.888114Z 0c30229 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.

@Hughhhhcoder

Copy link
Copy Markdown
Contributor Author

@codex 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: ad533157f1

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

return ["git_worktree", "git_revision"]
if scan["target_snapshot_digest"] == clean_worktree_content_digest():
return ["git_revision"]
return ["git_revision", "git_worktree"]

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 Bind clean worktree manifests to the recorded digest

When a clean Git checkout uses the newly permitted git_worktree kind, scan_contract still omits requiredSnapshotDigest, so the initial completion binding does not compare the manifest digest with the recorded clean-worktree digest. A clean CLI scan can therefore seal successfully with any syntactically valid snapshotDigest (for example, 64 b characters), leaving the manifest unbound to the reviewed snapshot and causing later revalidation to reject it. Require the recorded clean digest whenever the selected kind is git_worktree, while continuing to let git_revision omit it.

AGENTS.md reference: AGENTS.md:L32-L33

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in commit 0c302296. Clean worktree contracts now carry the recorded requiredSnapshotDigest, and the completion binding applies it when git_worktree is selected. git_revision bindings still omit the snapshot digest, while a supplied worktree digest is normalized to the recorded value before sealing. Added regression coverage for registration, completion, and the clean Git scan path. Validation: 26 completion-binding tests, 108 workbench DB tests, 185 finalization/export tests, Ruff check/format, and plugin source compatibility all pass.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The follow-up closes the important binding gap. Carrying the recorded digest in the contract, then applying it only when the selected manifest kind is git_worktree, preserves revision semantics while making clean-worktree sealing deterministic and snapshot-bound.

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.

Bulk-scan save fails with "scan.target.kind: must match the workbench target" on clean worktree checkouts

2 participants