Skip to content

Commit 21a0872

Browse files
committed
fix: reduce PR review false positives, increase context budget
1 parent e669a68 commit 21a0872

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

scripts/issue_bot/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def __init__(self):
3333

3434
self.upstream_repo = os.getenv("UPSTREAM_REPO", "awslabs/python-deequ")
3535

36-
self.bedrock_timeout = 120
37-
self.max_context_chars = 200000
36+
self.bedrock_timeout = 240
37+
self.max_context_chars = 800000
3838
self.max_github_search_results = 8
3939
self.github_api_timeout = 10
4040
self.allowed_labels = {

scripts/issue_bot/github_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def post_pr_review(self, number, summary, inline_comments):
150150
if resp.status_code in (200, 201):
151151
return True
152152
logger.error(f"PR review API failed: {resp.status_code}, falling back to comment")
153+
logger.error(f"Response: {resp.text[:500]}")
153154
except Exception as e:
154155
logger.error(f"PR review API failed: {e}, falling back to comment")
155156

scripts/issue_bot/main.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,30 @@ def analyze():
149149
diff = gh.get_pr_diff(number)
150150
review_comments = gh.get_pr_review_comments(number)
151151
existing_feedback = _format_pr_feedback(comments_data, review_comments)
152+
# Fetch full source files modified in the PR for complete context
153+
pr_files = gh.get_pr_files(number)
154+
full_sources = ""
155+
for pf in pr_files:
156+
fname = pf.get("filename", "")
157+
content = gh.get_file_content(fname)
158+
if content:
159+
entry = f"\n### `{fname}`\n```\n{content}\n```\n"
160+
if len(full_sources) + len(entry) > 3_000_000:
161+
full_sources += f"\n### `{fname}` — SKIPPED (context budget)\n"
162+
break
163+
full_sources += entry
152164
# System prompt: instructions + all trusted context (not scanned by guardrail)
153165
system_prompt = _render(tmpl, current_date=datetime.date.today().isoformat()) + (
154166
f"\n\n<knowledge_base>\n{context}\n</knowledge_base>\n"
155167
f"<codebase_map>\n{codebase_map}\n</codebase_map>\n"
168+
f"<full_source_files>\n{full_sources}\n</full_source_files>\n"
156169
f"<diff>\n{diff}\n</diff>\n"
157170
f"<existing_feedback>\n{existing_feedback}\n</existing_feedback>"
158171
)
159172
# User prompt: only user-authored content (scanned by guardrail)
160173
user_prompt = f"<pr>\nTitle: {title}\nBody: {body}\n</pr>"
161174
raw = bedrock.invoke(system_prompt, user_prompt,
162-
max_tokens=4000, json_schema=PR_REVIEW_SCHEMA)
175+
max_tokens=8000, json_schema=PR_REVIEW_SCHEMA)
163176
if raw is None:
164177
_write_artifact({
165178
"action": "ESCALATE", "reason": "bedrock_unavailable", "title": title,

0 commit comments

Comments
 (0)