@@ -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>\n Title: { title } \n Body: { 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