fix: use False as default for draft field in pull request event check#2273
Open
wishhyt wants to merge 1 commit intoqodo-ai:mainfrom
Open
fix: use False as default for draft field in pull request event check#2273wishhyt wants to merge 1 commit intoqodo-ai:mainfrom
wishhyt wants to merge 1 commit intoqodo-ai:mainfrom
Conversation
`pull_request.get("draft", True)` incorrectly defaults to True when
the draft field is absent from the webhook payload, causing non-draft
PRs to be silently skipped. Default to False so PRs without an
explicit draft field are processed normally.
Made-with: Cursor
Contributor
Review Summary by QodoFix draft field default value in GitHub pull request event validation
WalkthroughsDescription• Changed draft field default from True to False in pull request validation • Prevents legitimate PRs without explicit draft field from being silently skipped • Ensures PRs are processed normally when draft status is absent from webhook payload Diagramflowchart LR
A["Webhook payload without draft field"] -->|Previously defaulted to True| B["PR silently skipped"]
A -->|Now defaults to False| C["PR processed normally"]
D["Webhook with draft=true"] -->|Still skipped| E["Draft PR ignored"]
File Changes1. pr_agent/servers/github_app.py
|
Contributor
Code Review by Qodo
1. Missing test for draft-default
|
| return invalid_result | ||
| log_context["api_url"] = api_url | ||
| if pull_request.get("draft", True) or pull_request.get("state") != "open": | ||
| if pull_request.get("draft", False) or pull_request.get("state") != "open": |
Contributor
There was a problem hiding this comment.
1. Missing test for draft-default 📘 Rule violation ⛯ Reliability
The PR changes webhook behavior by treating missing draft as False, but no pytest coverage is added/updated to lock this behavior in. This risks regression where PRs without an explicit draft field could be silently skipped again.
Agent Prompt
## Issue description
The webhook validation now defaults missing `pull_request.draft` to `False`, but there is no pytest coverage ensuring PR events without a `draft` field are processed.
## Issue Context
GitHub webhook payloads may omit the `draft` field. Without a test, this behavior can regress and silently skip legitimate PRs.
## Fix Focus Areas
- tests/unittest/test_add_docs_trigger.py[11-75]
- pr_agent/servers/github_app.py[387-388]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
pr_agent/servers/github_app.py: Changed default value from True to False
Test plan