From 7d5d9f041b3c7817abf7874b386b1f68ec6872b4 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Fri, 27 Mar 2026 14:50:01 +0100 Subject: [PATCH] Use codex-utils-template for review prompts (#16001) --- codex-rs/core/src/review_prompts.rs | 118 +++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 13 deletions(-) diff --git a/codex-rs/core/src/review_prompts.rs b/codex-rs/core/src/review_prompts.rs index a5bf8e5f9..988ceff82 100644 --- a/codex-rs/core/src/review_prompts.rs +++ b/codex-rs/core/src/review_prompts.rs @@ -1,7 +1,9 @@ use codex_git_utils::merge_base_with_head; use codex_protocol::protocol::ReviewRequest; use codex_protocol::protocol::ReviewTarget; +use codex_utils_template::Template; use std::path::Path; +use std::sync::LazyLock; #[derive(Clone, Debug, PartialEq)] pub struct ResolvedReviewRequest { @@ -12,12 +14,27 @@ pub struct ResolvedReviewRequest { const UNCOMMITTED_PROMPT: &str = "Review the current code changes (staged, unstaged, and untracked files) and provide prioritized findings."; -const BASE_BRANCH_PROMPT_BACKUP: &str = "Review the code changes against the base branch '{branch}'. Start by finding the merge diff between the current branch and {branch}'s upstream e.g. (`git merge-base HEAD \"$(git rev-parse --abbrev-ref \"{branch}@{upstream}\")\"`), then run `git diff` against that SHA to see what changes we would merge into the {branch} branch. Provide prioritized, actionable findings."; -const BASE_BRANCH_PROMPT: &str = "Review the code changes against the base branch '{baseBranch}'. The merge base commit for this comparison is {mergeBaseSha}. Run `git diff {mergeBaseSha}` to inspect the changes relative to {baseBranch}. Provide prioritized, actionable findings."; +const BASE_BRANCH_PROMPT_BACKUP: &str = "Review the code changes against the base branch '{{branch}}'. Start by finding the merge diff between the current branch and {{branch}}'s upstream e.g. (`git merge-base HEAD \"$(git rev-parse --abbrev-ref \"{{branch}}@{upstream}\")\"`), then run `git diff` against that SHA to see what changes we would merge into the {{branch}} branch. Provide prioritized, actionable findings."; +const BASE_BRANCH_PROMPT: &str = "Review the code changes against the base branch '{{base_branch}}'. The merge base commit for this comparison is {{merge_base_sha}}. Run `git diff {{merge_base_sha}}` to inspect the changes relative to {{base_branch}}. Provide prioritized, actionable findings."; +static BASE_BRANCH_PROMPT_BACKUP_TEMPLATE: LazyLock