Skip to content

fix(pstack): reuse a verdict only when the exact whole-PR diff matches - #10

Merged
leegmoore merged 6 commits into
limfrom
fix/verdict-exact-diff
Oct 17, 2026
Merged

leegmoore merged 6 commits into
limfrom
fix/verdict-exact-diff

Conversation

@leegmoore

@leegmoore leegmoore commented Oct 17, 2026 •

Copy link
Copy Markdown

Why

Codex's review bot found that git patch-id ignores line numbers, so a conflict resolution that moves a change between identical blocks keeps the same id while different code runs. Shipping would then carry an old verdict to untested behavior.

What changed

  • Shipping step 3 compares sha256sum of the raw whole-PR diff (saved merge base to verdict head) with the current one.
  • Autopilot-full, autopilot-stack and multi-phase-plan point at the diff rule.

Tradeoffs

  • A rebase that shifts the PR's own lines now needs a fresh check. The playbooks already give a rebase a single verifier, so the cost is small.

Verification

  • Scratch repo: a rebase over an unrelated trunk change kept the diff hash (8e8e271ff0 before and after).
  • node scripts/check-t3-port.mjs clean. bun test 73 of 73.

🤖 Generated with Claude Code


Note

Medium Risk
Tightens merge-gating logic for when verification verdicts carry across new heads; incorrect hashing would block merges or (if too loose) allow stale verdicts.

Overview
Fixes verdict reuse so an old swarm result cannot carry when the whole-PR change is not actually the same code, after review found git patch-id could match when a fix only moves edits between identical blocks.

Shipping step 3 now compares hashes from verdict-hash.sh (saved merge-base/head vs current) instead of piping git diff through patch-id. The script hashes git diff-tree blob-level output with hardening against replace refs, grafts, and diff config. Autopilot-full, autopilot-stack, and multi-phase-plan rename the rule to the diff rule and point at the same step.

Adds verdict-hash.test.ts (including the patch-id failure case and rebase stability) and wires it into package.json bun test. Rebases that only shift line positions may need a fresh verifier; playbooks already treat rebases as a single-verifier event.

Reviewed by Cursor Bugbot for commit 4128055. Configure here.

A git patch id ignores line numbers, so moving a change between two identical blocks keeps the same id while different code runs. Shipping step 3 now hashes the raw diff from the saved merge base to the verdict head and compares it with the current one. A rebase over unrelated trunk changes keeps the hash; one that shifts the PR's lines gets a fresh check, which the playbooks already give a rebase. The other playbooks now point at the diff rule.

Fixes #9 (comment)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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-10-17T18:41:22.198457Z 4128055 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: 5f16f2a6a3

ℹ️ 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 pstack/skills/poteto-mode/playbooks/shipping.md Outdated
A .gitattributes textconv driver can map different blobs to the same diff text, so the verdict hash could match a different artifact. The hash now uses --no-textconv --no-ext-diff --binary --full-index --no-renames --no-color. Checked in a scratch repo with a head -c 1 textconv: plain git diff hashed two different changes the same, the flagged diff did not.

Fixes #10 (comment)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leegmoore

Copy link
Copy Markdown
Author

@codex review

Flags on git diff kept missing config: diff.ignoreSubmodules=all and diff.relative=true still made different changes hash the same (found by the GPT verifier). git diff-tree is plumbing and ignores that config, and its full blob ids cover line positions, binaries and submodule commits. A scratch repo with textconv, ignoreSubmodules=all and relative=true set, run from a subdirectory, gave distinct hashes for all four collision cases, and a rebase over unrelated trunk kept the hash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leegmoore

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 3148c7cbb2

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

The GPT verifier broke the diff-tree one-liner twice more: a git replace ref made two heads hash the same, and a git failure produced an empty diff that sha256sum hashed with exit 0. scripts/verdict-hash.sh turns off replace refs and grafts, verifies both commits, refuses an empty change, and fails closed under set -euo pipefail. Its bun tests cover the moved-block, textconv plus diff.relative, replace-ref, git-failure and unrelated-rebase cases, and each guard's removal fails a test. Shipping step 3 now calls the script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leegmoore

Copy link
Copy Markdown
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: 4484e2e472

ℹ️ 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 pstack/skills/poteto-mode/playbooks/shipping.md Outdated
leegmoore and others added 2 commits October 17, 2026 14:38
Fixes #10 (comment)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GPT verifier showed GIT_OBJECT_DIRECTORY and GIT_ALTERNATE_OBJECT_DIRECTORIES pointing at a corrupt overlay could serve one tree's contents under another's id. The script now unsets both, and the verifier's reproduction gives the pristine, distinct hashes again. A corrupt object store inside the repo itself is out of scope: the rule guards against reusing a stale verdict by accident, and git fsck reports such a store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leegmoore

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 4128055d15

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

@leegmoore
leegmoore merged commit d46bc58 into lim Oct 17, 2026
1 check passed
@leegmoore
leegmoore deleted the fix/verdict-exact-diff branch October 17, 2026 18:46
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