From 5c7c29fd5c12b5067c072722a2270c3fd801ff54 Mon Sep 17 00:00:00 2001 From: wishhyt <24300810017@m.fudan.edu.cn> Date: Wed, 18 Mar 2026 10:35:20 +0800 Subject: [PATCH] fix: use instance prompt variable for user prompt in code suggestions The system prompt correctly uses `self.pr_code_suggestions_prompt_system` (which respects the `decouple_hunks` configuration), but the user prompt was hardcoded to `get_settings().pr_code_suggestions_prompt.user`, always using the decoupled variant. When `decouple_hunks` is False, this creates a mismatch between system and user prompts. Use the instance variable `self.pr_code_suggestions_prompt_user` instead. Made-with: Cursor --- pr_agent/tools/pr_code_suggestions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index bbdf58e46d..d59bd76398 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -389,7 +389,7 @@ async def _get_prediction(self, model: str, patches_diff: str, patches_diff_no_l variables["diff_no_line_numbers"] = patches_diff_no_line_number # update diff environment = Environment(undefined=StrictUndefined) system_prompt = environment.from_string(self.pr_code_suggestions_prompt_system).render(variables) - user_prompt = environment.from_string(get_settings().pr_code_suggestions_prompt.user).render(variables) + user_prompt = environment.from_string(self.pr_code_suggestions_prompt_user).render(variables) response, finish_reason = await self.ai_handler.chat_completion( model=model, temperature=get_settings().config.temperature, system=system_prompt, user=user_prompt) if not get_settings().config.publish_output: