revert GitHub comment workaround#2511
Conversation
Summary of ChangesHello @chmouel, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the GitHub comment handling mechanism by removing a previously implemented, complex deduplication workaround. The change simplifies the comment creation and update flow, replacing the old logic with targeted diagnostic enhancements. This improves the clarity of comment operations and provides better traceability for API calls without altering the intended behavior of ensuring a single, up-to-date marker comment. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🔍 PR Lint Feedback
|
There was a problem hiding this comment.
Pull request overview
This PR reverts the GitHub comment deduplication workaround and replaces it with targeted debug enhancements for better diagnostics. The change simplifies the comment creation flow by removing the jitter-based timing workaround, post-create reconciliation logic, and the ensureSingleMarkerComment function, while adding diagnostic helpers (githubRequestID, bodyHash) and improved logging to support troubleshooting duplicate comment issues.
Changes:
- Removed deduplication workaround including jitter delays, post-create reconciliation, and
ensureSingleMarkerCommentfunction - Added diagnostic helpers (
githubRequestID(),bodyHash()) for improved observability - Simplified
CreateCommentto edit first matching comment or create new without dedup logic
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/provider/github/profiler.go | Added github_request_id field to API call logs for server-side correlation |
| pkg/provider/github/github.go | Removed deduplication logic and added diagnostic helpers; simplified CreateComment flow |
| pkg/provider/github/github_test.go | Updated tests to reflect simplified flow and added test for no_marker phase logging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request reverts a workaround for GitHub comment deduplication, simplifying the logic to "update first or create new". It also enhances diagnostic logging by adding GitHub request IDs and comment body fingerprints to logs. The changes are well-reflected in the updated tests. I've found a critical issue that could lead to a panic in the logging code and a medium-severity issue regarding a hardcoded value that should be a configurable property.
|
the e2e issue: trying to fix it in pipelines-as-code/startpaac#11 |
Remove the dedup workaround (jitter, post-create reconciliation, ensureSingleMarkerComment) and replace it with targeted debug enhancements that improve diagnostics without changing behavior: - Add githubRequestID() helper to extract X-GitHub-Request-Id from API responses for server-side correlation with GitHub support - Add bodyHash() helper (8-char SHA-256) to fingerprint comment bodies at create/edit time for duplicate body detection - Log pagination warning when listCommentsByMarker fetches exactly 100 comments (PerPage limit), indicating potential missed matches - Log "no_marker" phase when updateMarker is empty so unprotected comment creates are visible in the trace system - Add github_request_id to profiler logAPICall for all API calls - Simplify CreateComment to edit first matching comment or create new, removing the jitter and post-create dedup logic Jira: https://issues.redhat.com/browse/SRVKP-10938 Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
a73850f to
0df2469
Compare
Remove the dedup workaround (jitter, post-create reconciliation, ensureSingleMarkerComment) and replace it with targeted debug enhancements that improve diagnostics without changing behavior:
Jira: https://issues.redhat.com/browse/SRVKP-10938
📝 Description of the Change
This PR removes the complex dedup workaround in the GitHub provider that used jitter and post-create reconciliation to avoid duplicate comments. It replaces this with cleaner, debug-focused enhancements that improve diagnostics without changing behavior. The changes include new helper functions for extracting GitHub request IDs and fingerprinting comment bodies, enhanced logging for pagination and unprotected comment creation, and simplified CreateComment logic that edits existing comments when possible.
👨🏻 Linked Jira
https://issues.redhat.com/browse/SRVKP-10938
🔗 Linked GitHub Issue
🚀 Type of Change
fix:)feat:)feat!:,fix!:)docs:)chore:)refactor:)enhance:)deps:)🧪 Testing Strategy
🤖 AI Assistance
If you have used AI assistance, please provide the following details:
Which LLM was used?
Extent of AI Assistance:
Important
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com
**💡You can use the script
./hack/add-llm-coauthor.shto automatically addthese co-author trailers to your commits.
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.