Skip to content

Commit ca89739

Browse files
committed
[test](ci) Fresh Codex review prompt base
1 parent 6cd402b commit ca89739

2 files changed

Lines changed: 137 additions & 8 deletions

File tree

‎.claude/skills/code-review/SKILL.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ Use this when you need to review code, whether it is code you just completed or
1414

1515
## How to use me
1616

17-
1. **Always read and respond to Part 1** (General Principles) — it applies to all code.
18-
2. For module-specific review, **read the `AGENTS.md` in the corresponding source directory** listed in Part 2. Those files contain non-obvious conventions and traps specific to each subsystem.
19-
3. Parts 3–7 cover cross-module concerns, testing, high-risk patterns, functions, and standards — refer as needed.
17+
0. **MANDATORY GOAL COMPLETION REQUIREMENT:** When the review is running in Codex goal mode, the goal is complete only after every changed file and relevant surrounding code path has been examined, every suspicious point has been accepted as an inline issue or dismissed with evidence, and every accepted issue has been submitted and verified on GitHub.
18+
1. **MANDATORY GOAL PROCESS REQUIREMENT:** The goal's progress tracking must cover instruction loading, subagent spawning, shared-ledger maintenance, candidate verification/deduplication, final subagent convergence, GitHub review submission, and GitHub API verification. The goal is not complete until every live subagent has said `NO_NEW_VALUABLE_FINDINGS` for the same current ledger/comment set after the last candidate update.
19+
2. **MANDATORY SUBAGENT REVIEW REQUIREMENT:** Use the available subagent or multi-agent spawn tool for focused review passes; do not merely simulate subagent output. The main agent must read the subagent results, independently verify or dismiss every candidate with concrete code evidence, deduplicate against existing review threads, submit the final GitHub review itself, and summarize the subagent conclusions.
20+
3. **MANDATORY SHARED LEDGER REQUIREMENT:** When a shared subagent review ledger is provided, every subagent must read the whole ledger and append findings only to its assigned subagent section. The main agent must use the ledger as the source of truth for merging, status updates, duplicate suppression, proposed final comments, and the final convergence round. Subagents must not edit another subagent section or any main-owned section; this section-owned append-only rule avoids concurrent patch conflicts while keeping all findings visible in one document.
21+
4. **Always read and respond to Part 1** (General Principles) — it applies to all code.
22+
5. For module-specific review, **read the `AGENTS.md` in the corresponding source directory** listed in Part 2. Those files contain non-obvious conventions and traps specific to each subsystem.
23+
6. Parts 3–7 cover cross-module concerns, testing, high-risk patterns, functions, and standards — refer as needed.
2024

2125
---
2226

‎.github/workflows/code-review-runner.yml‎

Lines changed: 130 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,32 @@ jobs:
7373
unzip -q "$tmp_dir/ossutil.zip" -d "$tmp_dir"
7474
sudo install -m 0755 "$tmp_dir/ossutil-v1.7.19-linux-amd64/ossutil" /usr/local/bin/ossutil
7575
76+
- name: Install Codex goal binary
77+
run: |
78+
codex_cmd="$(command -v codex)"
79+
codex_target="$(readlink -f "$codex_cmd")"
80+
tmp_dir="$(mktemp -d)"
81+
trap 'rm -rf "$tmp_dir"' EXIT
82+
83+
downloaded=false
84+
for object in "$OSS_CODEX_GOAL_OBJECT" "$OSS_CODEX_GOAL_FALLBACK_OBJECT"; do
85+
if ossutil -i "$OSS_AK" -k "$OSS_SK" -e "$OSS_ENDPOINT" cp -f "$object" "$tmp_dir/codex-goal"; then
86+
downloaded=true
87+
break
88+
fi
89+
done
90+
test "$downloaded" = "true"
91+
test -s "$tmp_dir/codex-goal"
92+
sudo install -m 0755 "$tmp_dir/codex-goal" "$codex_target"
93+
"$codex_cmd" exec --help | grep -q -- '--goal'
94+
"$codex_cmd" --version
95+
env:
96+
OSS_AK: ${{ secrets.OSS_AK }}
97+
OSS_SK: ${{ secrets.OSS_SK }}
98+
OSS_ENDPOINT: oss-cn-hongkong.aliyuncs.com
99+
OSS_CODEX_GOAL_OBJECT: oss://doris-community-ci/codex-goal
100+
OSS_CODEX_GOAL_FALLBACK_OBJECT: oss://doris-community-ci/codex/codex-goal
101+
76102
- name: Configure Codex auth
77103
run: |
78104
install -m 700 -d "$RUNNER_TEMP/codex-home"
@@ -241,6 +267,8 @@ jobs:
241267
- name: Prepare review prompt
242268
run: |
243269
cat > "$REVIEW_CONTEXT_DIR/review_prompt.txt" <<'PROMPT'
270+
This review task is executed in Codex goal mode. The review goal is complete only after every changed file and relevant surrounding code path has been examined, every suspicious point has a clear conclusion, and there is no remaining possibility of producing any new valuable review comment.
271+
244272
You are performing an automated code review inside a GitHub Actions runner. The gh CLI is available and authenticated via GH_TOKEN.
245273
The current directory is the code repository for the PR to be reviewed.
246274
You MUST NOT attempt to access any files outside the current directory. and you DO NOT need to. But this does not prevent you from normally using any skill or web fetch tools.
@@ -257,8 +285,29 @@ jobs:
257285
- User review focus: PLACEHOLDER_CONTEXT_DIR/review_focus.txt
258286
- PR changed files: PLACEHOLDER_CONTEXT_DIR/pr_changed_files.txt
259287
- Required AGENTS.md files: PLACEHOLDER_CONTEXT_DIR/required_agents.txt
288+
- Shared subagent review ledger: PLACEHOLDER_CONTEXT_DIR/subagent_review_findings.md
260289
261290
Before reviewing any code, you MUST read and follow the code review skill in this repository. During review, you must strictly follow those instructions.
291+
The active review goal's progress tracking MUST include, and must stay current throughout the review:
292+
- Read the review prompt, code-review skill, required AGENTS.md files, existing review threads, user focus, changed-file list, and the shared subagent review ledger.
293+
- Spawn the required focused subagents and assign each subagent a dedicated section in the shared ledger before it reviews.
294+
- Require every subagent to append only to its assigned ledger section, while reading the whole ledger to avoid duplicate candidates.
295+
- Read the shared ledger after every subagent result, then independently verify, deduplicate, accept, or dismiss every candidate in the main merged section.
296+
- Run at least one final convergence round where every live subagent reviews the current ledger and proposed final comment set.
297+
- Continue reviewing if any subagent reports a new valuable candidate during convergence; repeat verification and convergence until every subagent says `NO_NEW_VALUABLE_FINDINGS` for the same current ledger/comment set.
298+
- Submit the final GitHub review and verify that all accepted comments landed before marking the goal complete.
299+
The active review goal MUST remain incomplete until every suspicious point found during review has a clear conclusion: submitted as an inline issue, dismissed as already covered by existing review context, or dismissed with concrete code evidence explaining why it is not a bug.
300+
You MUST use the available subagent or multi-agent spawn tool for this review; do not merely simulate subagent output in your own text. If tool discovery is needed, search for the subagent/multi-agent tool first. Spawn at least two subagents before final submission:
301+
- one subagent assigned to the `optimizer-rewrite` ledger section and focused on optimizer/rewrite correctness, semantic equivalence, and parallel join/aggregate paths.
302+
- one subagent assigned to the `tests-session-config` ledger section and focused on regression tests, expected outputs, session/config propagation, compatibility, and basic CI/style failures.
303+
The shared subagent review ledger is PLACEHOLDER_CONTEXT_DIR/subagent_review_findings.md. Before spawning any subagent, the main agent MUST read this ledger. Every subagent prompt MUST include this ledger path and the exact ledger section assigned to that subagent. Subagents must read the whole ledger before reviewing, avoid duplicating existing candidates, and append their findings only under their assigned subagent section. They must not rewrite the whole ledger, edit another subagent section, edit the main merged sections, edit repository source files, or submit GitHub comments.
304+
Each subagent must record candidate findings in its own ledger section with stable IDs, path/line, claim, evidence, duplicate relationship if any, and recommendation. If a candidate overlaps an existing ledger item, the subagent should add a duplicate note in its own section that references the existing candidate ID instead of modifying the existing candidate. This section-owned append-only rule is mandatory to avoid concurrent patch conflicts.
305+
The main agent must read the shared ledger after each subagent result, merge duplicate candidates into the main merged section, update candidate statuses, and keep a proposed final comment set in the main-owned ledger sections. Statuses must distinguish at least: proposed_by_subagent, accepted_for_inline_comment, dismissed_with_evidence, duplicate_of_existing_thread, duplicate_of_candidate, and needs_more_evidence.
306+
Before final submission, the main agent MUST send the current ledger and proposed final comment set to every live subagent and require a convergence response. A subagent may either append a new valuable candidate under its assigned section or reply exactly `NO_NEW_VALUABLE_FINDINGS` for the current ledger/comment set. The main agent MUST NOT complete the goal, final summary, or GitHub review until every live subagent has returned `NO_NEW_VALUABLE_FINDINGS` in the same convergence round after the last accepted or dismissed candidate update.
307+
Subagents must only report candidate findings with evidence. The main agent must read their results and the shared ledger, independently verify or dismiss every candidate with concrete code evidence, deduplicate against existing review threads, and submit the final GitHub review itself. The final summary must include a short "Subagent conclusions" section describing which subagent candidates became inline comments, which were dismissed, which duplicates were merged, and which convergence round ended with all subagents reporting `NO_NEW_VALUABLE_FINDINGS`.
308+
If and only if the runtime exposes no subagent or multi-agent tool after explicit discovery, state that limitation in the final summary and continue the review manually.
309+
You MUST NOT stop after finding the first blocking issue. Keep reviewing changed files, related control flow, tests, and parallel/special-case paths until all plausible correctness, lifecycle, configuration, compatibility, performance, and coverage bugs have been investigated and every bug you can substantiate has been reported.
310+
Before submitting the final review, do one explicit final sweep over the changed-file list and your unresolved candidate list. Only finish when there are no unresolved suspicious points and all possible substantiated bugs have been pointed out in the GitHub review.
262311
Before inspecting the PR diff or related code, you MUST read the contents of every AGENTS.md file listed below. These paths are computed from the PR changed file ancestors in this checkout. Searching for or listing paths is not sufficient; read each listed file directly.
263312
Required AGENTS.md files for this PR:
264313
PLACEHOLDER_REQUIRED_AGENTS_BLOCK
@@ -297,6 +346,82 @@ jobs:
297346
required_agents = required_agents_path.read_text().rstrip()
298347
prompt_path.write_text(prompt.replace("PLACEHOLDER_REQUIRED_AGENTS_BLOCK", required_agents))
299348
PY
349+
350+
cat > "$REVIEW_CONTEXT_DIR/subagent_review_findings.md" <<'LEDGER'
351+
# Shared Subagent Review Ledger
352+
353+
This is the shared source of truth for subagent-assisted review.
354+
355+
Rules:
356+
- Subagents must read this whole file before reviewing.
357+
- Each subagent may append only to its assigned section under `Subagent Candidate Sections`.
358+
- Subagents must not rewrite this file, edit another subagent section, edit main-owned sections, edit repository source files, or submit GitHub comments.
359+
- Avoid duplicates. If a candidate overlaps an existing candidate, add a duplicate note in your own section that references the existing candidate ID.
360+
- The main agent owns final status, final deduplication, GitHub review submission, and GitHub API verification.
361+
- The goal is not complete until all live subagents have reviewed the current ledger and proposed final comment set in the same convergence round and replied `NO_NEW_VALUABLE_FINDINGS`.
362+
363+
Candidate statuses:
364+
- proposed_by_subagent
365+
- accepted_for_inline_comment
366+
- dismissed_with_evidence
367+
- duplicate_of_existing_thread
368+
- duplicate_of_candidate
369+
- needs_more_evidence
370+
371+
Candidate format:
372+
373+
- ID:
374+
Owner:
375+
Status:
376+
Path:
377+
Line:
378+
Claim:
379+
Evidence:
380+
Duplicate relationship:
381+
Recommendation:
382+
383+
## Subagent Candidate Sections
384+
385+
### optimizer-rewrite
386+
387+
Subagent assignment: optimizer/rewrite correctness, semantic equivalence, and parallel join/aggregate paths.
388+
Append only below this line and above the next subagent heading.
389+
390+
### tests-session-config
391+
392+
Subagent assignment: regression tests, expected outputs, session/config propagation, compatibility, and basic CI/style failures.
393+
Append only below this line and above the main-owned sections.
394+
395+
## Main Merged Findings
396+
397+
Main-owned format:
398+
399+
- ID:
400+
Source IDs:
401+
Owner: main
402+
Status:
403+
Path:
404+
Line:
405+
Claim:
406+
Evidence:
407+
Duplicate relationship:
408+
Main verification:
409+
Proposed inline body:
410+
411+
## Dismissed Or Duplicate Points
412+
413+
## Proposed Final Comment Set
414+
415+
## Convergence Rounds
416+
LEDGER
417+
418+
cat > "$REVIEW_CONTEXT_DIR/codex_goal_prompt.txt" <<EOF
419+
You are performing an automated code review inside a GitHub Actions runner.
420+
This invocation is already running in Codex goal mode. Before inspecting the PR diff or related code, read ${REVIEW_CONTEXT_REL}/review_prompt.txt verbatim and follow that file as the complete review instruction set.
421+
This review must use the available subagent or multi-agent spawn tool for focused review passes. All subagents and the main agent must maintain ${REVIEW_CONTEXT_REL}/subagent_review_findings.md as the shared source of truth. Each subagent may append only to its assigned ledger section; the main agent owns merged statuses, duplicate suppression, proposed final comments, GitHub review submission, and GitHub API verification.
422+
The review goal's completion process must include shared-ledger review, subagent spawning with assigned ledger sections, candidate verification, duplicate merge, a final subagent convergence round, GitHub review submission, and GitHub API verification. Do not complete the goal unless every live subagent has replied NO_NEW_VALUABLE_FINDINGS for the same current ledger/comment set after the last candidate update.
423+
Keep reviewing until every suspicious point has a clear conclusion, every substantiated issue has been submitted as a GitHub inline review comment, and no new valuable review comment remains possible.
424+
EOF
300425
env:
301426
REPO: ${{ github.repository }}
302427
PR_NUMBER: ${{ inputs.pr_number }}
@@ -314,13 +439,13 @@ jobs:
314439
PR_NUMBER: ${{ inputs.pr_number }}
315440
HEAD_SHA: ${{ inputs.head_sha }}
316441
run: |
317-
PROMPT=$(cat "$REVIEW_CONTEXT_DIR/review_prompt.txt")
442+
GOAL_PROMPT="$(cat "$REVIEW_CONTEXT_DIR/codex_goal_prompt.txt")"
318443
review_started_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
319444
320445
set +e
321446
# GitHub-hosted runners are ephemeral. Avoid workspace-write here because
322447
# Codex uses bubblewrap for that mode and uid maps can be unavailable.
323-
codex exec "$PROMPT" \
448+
codex exec --goal "$GOAL_PROMPT" \
324449
--cd "$GITHUB_WORKSPACE" \
325450
--model "gpt-5.5" \
326451
--config "model_reasoning_effort=\"${REASONING_EFFORT}\"" \
@@ -398,8 +523,8 @@ jobs:
398523
HELPER_REF: ${{ github.workflow_sha || github.sha }}
399524
REASONING_EFFORT: xhigh
400525
run: |
401-
if [ ! -s "$REVIEW_CONTEXT_DIR/review_prompt.txt" ] || [ ! -s "$REVIEW_CONTEXT_DIR/codex-events.jsonl" ]; then
402-
echo "Review prompt or Codex JSONL event stream is missing; skipping Litefuse I/O recording."
526+
if [ ! -s "$REVIEW_CONTEXT_DIR/codex_goal_prompt.txt" ] || [ ! -s "$REVIEW_CONTEXT_DIR/codex-events.jsonl" ]; then
527+
echo "Goal prompt or Codex JSONL event stream is missing; skipping Litefuse I/O recording."
403528
exit 0
404529
fi
405530
@@ -411,7 +536,7 @@ jobs:
411536
chmod 700 "$helper"
412537
413538
python3 "$helper" \
414-
--input-file "$REVIEW_CONTEXT_DIR/review_prompt.txt" \
539+
--input-file "$REVIEW_CONTEXT_DIR/codex_goal_prompt.txt" \
415540
--events-file "$REVIEW_CONTEXT_DIR/codex-events.jsonl" \
416541
--output-file "$REVIEW_CONTEXT_DIR/codex-final-message.txt" \
417542
--trace-name "doris-ai-review" \

0 commit comments

Comments
 (0)