Skip to content

Commit bd432fe

Browse files
Pigbibiclaudecodex
committed
fix(review): include current PR entry points
Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Codex <noreply@openai.com>
1 parent b046033 commit bd432fe

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

docs/ai_autonomy_architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ trusted review comment 只保存最近固定轮数、固定字节上限且脱敏
225225

226226
#### 3.3.2 Blocking finding 的可达性证据
227227

228-
repository Review 只有在 PR 上下文能够同时证明 exact changed path/line、merged current caller 或明确声明的 public untrusted boundary、当前配置和输入下可达,以及具体 correctness/security/data-integrity 影响时,才能给出 `critical``high`。证据不足的 finding 必须降为 `medium/low` 或省略,不能依靠 future consumer、伪造内部对象或通用 defense-in-depth 推测阻塞当前 PR。
228+
repository Review 只有在 PR 上下文能够同时证明 exact changed path/line、当前 caller/entry point(可为既有路径或本 PR 新增路径)或明确声明的 public untrusted boundary、当前配置和输入下可达,以及具体 correctness/security/data-integrity 影响时,才能给出 `critical``high`。证据不足的 finding 必须降为 `medium/low` 或省略,不能依靠 future consumer、伪造内部对象或通用 defense-in-depth 推测阻塞当前 PR。
229229

230230
Review 不得为了 hypothetical 风险要求新增 parser、store、registry 或 event-persistence 层。只有当前变更已经暴露对应真实边界,而且缺陷能从该边界到达时,才允许提出此类修改建议。
231231

prompts/pr_review.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You are reviewing a pull request for a **production quantitative trading and dat
2020

2121
## Review completeness
2222

23-
- Assign **critical** or **high** only when the supplied PR context proves an exact changed path/line, a merged current caller or explicitly declared public untrusted boundary, reachability under current configuration and inputs, and concrete correctness, security, or data-integrity impact. State the reachability and impact in the description. If any element is missing, downgrade it to medium or low or omit it.
23+
- Assign **critical** or **high** only when the supplied PR context proves an exact changed path/line, a current caller or entry point proven by the supplied PR context whether pre-existing or introduced by this PR or an explicitly declared public untrusted boundary, reachability under current configuration and inputs, and concrete correctness, security, or data-integrity impact. State the reachability and impact in the description. If any element is missing, downgrade it to medium or low or omit it.
2424
- Do not block on a hypothetical future consumer, forged internal object state, or generic defense-in-depth concern. Do not request a new parser, store, registry, or event-persistence layer unless the changed code already exposes that current boundary and the defect is reachable through it.
2525
- Review the entire diff holistically and report all independent actionable findings in one response. Do not stop after the first blocking issue.
2626
- Do not invent backward-compatibility requirements that are absent from the repository and PR contract. If both explicitly define a clean-slate namespace, check for accidental legacy fallback instead of requesting dual-read or migration. This never overrides security or data-integrity findings.

scripts/run_codex_pr_review.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def build_review_prompt(diff: str, pr_title: str, pr_body: str, repo: str) -> st
325325
1. Focus on **security vulnerabilities, logic errors, data corruption, crash bugs, race conditions, and API compatibility breaks**.
326326
2. Do NOT flag: code style, formatting, naming suggestions, minor refactoring preferences, or documentation issues.
327327
3. Do not emit a finding that concludes no code change is needed. For OIDC, `job_workflow_ref` is absent for explicit direct callers; flag a bypass only when a non-direct repository can reach the direct-caller path despite the allowlists.
328-
4. Assign **critical** or **high** only when the supplied PR context proves all of the following: an exact changed path and line; a merged current caller or an explicitly declared public untrusted boundary; reachability under the current configuration and inputs; and a concrete correctness, security, or data-integrity impact. State that reachability and impact in the finding description. If any element is missing, downgrade it to medium or low or omit it.
328+
4. Assign **critical** or **high** only when the supplied PR context proves all of the following: an exact changed path and line; a current caller or entry point proven by the supplied PR context, whether pre-existing or introduced by this PR, or an explicitly declared public untrusted boundary; reachability under the current configuration and inputs; and a concrete correctness, security, or data-integrity impact. State that reachability and impact in the finding description. If any element is missing, downgrade it to medium or low or omit it.
329329
5. Do not block on a hypothetical future consumer, forged internal object state, or generic defense-in-depth concern. Do not request a new parser, store, registry, or event-persistence layer unless the changed code already exposes that current boundary and the defect is reachable through it.
330330
6. Review the entire diff holistically and report all independent actionable findings in one response. Do not stop after the first blocking issue.
331331
7. Do not invent backward-compatibility requirements that are absent from the repository and PR contract. When the repository and PR explicitly define a clean-slate namespace with legacy compatibility out of scope, review that boundary for accidental fallback instead of requesting dual-read or migration. This never overrides security or data-integrity findings.

tests/test_run_codex_pr_review.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def test_review_prompt_requires_reachability_evidence_for_blockers(self) -> None
5858
"org/repo",
5959
)
6060

61-
self.assertIn("merged current caller", prompt)
61+
self.assertIn("current caller or entry point proven by the supplied PR context", prompt)
62+
self.assertIn("introduced by this PR", prompt)
6263
self.assertIn("explicitly declared public untrusted boundary", prompt)
6364
self.assertIn("current configuration and inputs", prompt)
6465
self.assertIn("downgrade it to medium or low", prompt)
@@ -68,7 +69,8 @@ def test_review_prompt_requires_reachability_evidence_for_blockers(self) -> None
6869
def test_repository_review_template_uses_the_same_reachability_gate(self) -> None:
6970
template = run_codex_pr_review.PROMPT_TEMPLATE_PATH.read_text(encoding="utf-8")
7071

71-
self.assertIn("merged current caller", template)
72+
self.assertIn("current caller or entry point proven by the supplied PR context", template)
73+
self.assertIn("introduced by this PR", template)
7274
self.assertIn("explicitly declared public untrusted boundary", template)
7375
self.assertIn("downgrade it to medium or low", template)
7476
self.assertIn("hypothetical future consumer", template)

0 commit comments

Comments
 (0)