Skip to content

fix(github): avoid review webhook payload coalescing - #3220

Merged
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-webhook-coalescing-vulnerability
Jul 4, 2026
Merged

fix(github): avoid review webhook payload coalescing#3220
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-webhook-coalescing-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Prevent losing review-specific side effects (reviews-cache invalidation and changes-requested notifications) when a later review comment/thread event overwrites a pending pull_request_review payload via coalescing.

Description

  • Stop coalescing pull_request_review deliveries by removing them from the review-surface coalescing family so they do not produce a coalesce key and therefore cannot be overwritten by later events.
  • Keep coalescing for pull_request_review_comment and pull_request_review_thread, but namespace their coalesce keys by event family (github-webhook:<eventName>:...) so comment/thread deliveries only collide with the same family and cannot replace review deliveries. (See src/github/webhook-coalesce.ts.)
  • Update unit tests in test/unit/github-webhook-coalesce.test.ts to assert that pull_request_review events are not coalesced, that comment/thread events still coalesce within their own families, and that distinct review-surface families remain separate.

Testing

  • Ran npx vitest run test/unit/github-webhook-coalesce.test.ts; the unit test file passed (all tests green).
  • Ran targeted coverage npx vitest run --coverage --run test/unit/github-webhook-coalesce.test.ts; the test passed but the coverage run failed global coverage thresholds (tool-level error) because only a single test file was executed against a repo-wide threshold.
  • Ran full npm run test:coverage; the full test suite failed due to unrelated timeouts/failures in test/unit/backfill.test.ts (existing test-time issues), not because of the webhook coalescing unit. All coalescing-related unit assertions passed.

Codex Task

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 4, 2026
@loopover-orb

loopover-orb Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-04 20:39:31 UTC

2 files · 1 AI reviewer · no blockers · readiness 93/100 · CI pending · blocked

⏸️ Suggested Action - Manual Review

Review summary
This change fixes the webhook coalescing bug at the right layer: `pull_request_review` now returns `null`, so review payloads cannot be replaced by later comment/thread deliveries, while comment and thread events still coalesce by PR/head within their own event family. The key namespace change in `src/github/webhook-coalesce.ts` is coherent with the stated contract and the updated tests cover the important behavior shifts. I do not see a reachable correctness defect in the provided diff.

Nits — 4 non-blocking
  • nit: `test/unit/github-webhook-coalesce.test.ts:178` computes `threadKey` in the distinct-family test but only asserts `commentKey` differs from it; assert the exact thread key there too so this regression test fails loudly if thread events accidentally stop coalescing.
  • nit: `src/github/webhook-coalesce.ts:23` still says the map mirrors `shouldProcessPullRequestPublicSurface` even though `pull_request_review` is now intentionally excluded; tighten the wording so future maintainers do not re-add review events while trying to restore the mirror.
  • In `test/unit/github-webhook-coalesce.test.ts:178`, change the final assertion block to check all three outcomes explicitly: `expect(reviewKey).toBeNull(); expect(commentKey).toBe("github-webhook:pull_request_review_comment:fix(changelog): strip squash PR suffixes #12@​cafe123"); expect(threadKey).toBe("github-webhook:pull_request_review_thread:fix(changelog): strip squash PR suffixes #12@​cafe123");`.
  • In `src/github/webhook-coalesce.ts:23`, rephrase the comment to say this is the coalescable subset of the review surface, excluding `pull_request_review` because its payload drives side effects.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 60 registered-repo PR(s), 50 merged, 438 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 60 PR(s), 438 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 60 PR(s), 438 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.73%. Comparing base (0babcb1) to head (08b7423).
⚠️ Report is 24 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3220   +/-   ##
=======================================
  Coverage   94.73%   94.73%           
=======================================
  Files         270      270           
  Lines       29714    29714           
  Branches    10840    10840           
=======================================
  Hits        28151    28151           
  Misses        917      917           
  Partials      646      646           
Files with missing lines Coverage Δ
src/github/webhook-coalesce.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored self-assigned this Jul 4, 2026
@JSONbored
JSONbored merged commit 68eef16 into main Jul 4, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-webhook-coalescing-vulnerability branch July 4, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Development

Successfully merging this pull request may close these issues.

1 participant