Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/gh-aw-estc-docs-pr-review.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions .github/workflows/gh-aw-fragments/pr-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@ steps:
gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" --paginate \
| jq -s 'add // []' > /tmp/pr-context/files.json

# Per-file diffs
# Per-file diffs with line numbers
# Lines with a number prefix are commentable (RIGHT side: added or context).
# Deleted lines get no number (LEFT side only).
jq -c '.[]' /tmp/pr-context/files.json | while IFS= read -r entry; do
filename=$(echo "$entry" | jq -r '.filename')
mkdir -p "/tmp/pr-context/diffs/$(dirname "$filename")"
echo "$entry" | jq -r '.patch // empty' > "/tmp/pr-context/diffs/${filename}.diff"
echo "$entry" | jq -r '.patch // empty' | awk '
/^@@/ { s=$3; gsub(/\+/,"",s); split(s,a,","); line=a[1]+0; print; next }
/^\+/ { printf "%d\t%s\n", line++, $0; next }
/^-/ { printf " \t%s\n", $0; next }
/^ / { printf "%d\t%s\n", line++, $0; next }
{ print }
' > "/tmp/pr-context/diffs/${filename}.diff"
done

# File orderings for sub-agent review (3 strategies)
Expand Down Expand Up @@ -126,7 +134,7 @@ steps:
| `pr.json` | PR metadata — title, body, author, base/head branches, head commit SHA (`headRefOid`), URL |
| `pr.diff` | Full unified diff of all changes |
| `files.json` | Changed files array — each entry has `filename`, `status`, `additions`, `deletions`, `patch` |
| `diffs/<path>.diff` | Per-file diffs — one file per changed file, mirroring the repo path under `diffs/` |
| `diffs/<path>.diff` | Per-file diffs with line numbers — numbered lines (e.g. `405\t+ code`) are commentable; lines without numbers are deleted (LEFT side only) |
| `file_order_az.txt` | Changed files sorted alphabetically (A→Z), one filename per line |
| `file_order_za.txt` | Changed files sorted reverse-alphabetically (Z→A), one filename per line |
| `file_order_largest.txt` | Changed files sorted by diff size descending (largest first), one filename per line |
Expand All @@ -143,9 +151,7 @@ steps:
| `review-instructions.md` | Review instructions, criteria, and calibration examples for sub-agents |
| `agent-review.md` | Main agent instructions — review approach resolved from PR size (written when `ready_to_code_review` is called) |
| `parent-review.md` | Comment format and inline severity threshold for the parent agent (written when `ready_to_code_review` is called) |
| `subagent-az.md` | Sub-agent instructions: review files A → Z (written when `ready_to_code_review` is called) |
| `subagent-za.md` | Sub-agent instructions: review files Z → A (written when `ready_to_code_review` is called) |
| `subagent-largest.md` | Sub-agent instructions: review files largest diff first (written when `ready_to_code_review` is called) |
| `subagent-*.md` | Sub-agent instructions (only written for medium/large PRs when `ready_to_code_review` is called — check `agent-review.md` for which exist) |
MANIFEST

echo "PR context written to /tmp/pr-context/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-aw-fragments/review-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:

Review the PR diff file by file in your assigned order. For each changed file:

1. **Read the diff** for this file from `/tmp/pr-context/diffs/<filename>.diff` to understand what changed. If the diff is empty or truncated (e.g., binary files or very large changes), fall back to reading the full file from the workspace and comparing against context.
1. **Read the diff** for this file from `/tmp/pr-context/diffs/<filename>.diff` to understand what changed. Each line is prefixed with its line number (e.g., `405\t+ code`). Lines with numbers are commentable; lines without numbers are deleted lines (LEFT side only). If the diff is empty or truncated (e.g., binary files or very large changes), fall back to reading the full file from the workspace and comparing against context.
2. **Read the full file from the workspace.** The PR branch is checked out locally — open the file directly to get complete contents with line numbers.
3. **Check existing threads** for this file from `/tmp/pr-context/threads/<filename>.json` (if it exists). Skip issues that are already under discussion — each thread has `isResolved` and `isOutdated` fields.
4. **Identify potential issues** matching the review criteria below.
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/gh-aw-fragments/safe-output-code-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ safe-inputs:
pr_size = 'unknown size'
diff_lines = 0

# Write one instruction file per sub-agent file ordering strategy
for key, desc in [('az', 'A \u2192 Z (alphabetical)'), ('za', 'Z \u2192 A (reverse alphabetical)'), ('largest', 'largest diff first')]:
lines = [
# Determine review approach based on PR size
def write_subagent(key, desc):
sa_lines = [
'# PR Review Sub-Agent',
'',
'Review the PR as a code review sub-agent. Return findings only \u2014 do NOT leave inline comments.',
Expand All @@ -40,16 +40,17 @@ safe-inputs:
'',
f'Review files in this order: `/tmp/pr-context/file_order_{key}.txt` ({desc})',
]
with open(f'/tmp/pr-context/subagent-{key}.md', 'w') as f:
f.write('\n'.join(lines) + '\n')
with open(f'/tmp/pr-context/subagent-{key}.md', 'w') as sa_f:
sa_f.write('\n'.join(sa_lines) + '\n')

# Determine review approach based on PR size
if diff_lines < 200:
approach_lines = [
f'**Small PR ({pr_size}):** Review directly \u2014 no sub-agents. Review files in order from `/tmp/pr-context/file_order_az.txt`, reading each diff from `/tmp/pr-context/diffs/<filename>.diff` and the full file from the workspace.',
]
size_key = 'small'
elif diff_lines < 800:
write_subagent('az', 'A \u2192 Z (alphabetical)')
write_subagent('za', 'Z \u2192 A (reverse alphabetical)')
approach_lines = [
f'**Medium PR ({pr_size}):** Use the **Pick Three, Keep Many** process \u2014 spawn 2 `code-review` sub-agents in parallel:',
'',
Expand All @@ -60,6 +61,9 @@ safe-inputs:
]
size_key = 'medium'
else:
write_subagent('az', 'A \u2192 Z (alphabetical)')
write_subagent('za', 'Z \u2192 A (reverse alphabetical)')
write_subagent('largest', 'largest diff first')
approach_lines = [
f'**Large PR ({pr_size}):** Use the **Pick Three, Keep Many** process \u2014 spawn 3 `code-review` sub-agents in parallel:',
'',
Expand All @@ -84,8 +88,7 @@ safe-inputs:
'## Comment Format',
'',
'Call **`create_pull_request_review_comment`** with:',
'- The file path and the **exact line number from reading the file** (not estimated from the diff)',
'- The line must be within the diff (an added or context line in the patch)',
'- The file path and a **line number that appears in the numbered diff** (`/tmp/pr-context/diffs/<filename>.diff`). Only lines with a number prefix are commentable. If your target line has no number in the diff, include the finding in the review body instead.',
'',
t5,
'**[SEVERITY] Brief title**',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ safe-outputs:
## create-pull-request-review-comment

- **Required fields**: `path` (file path), `line` (line number), and `body` (comment text).
- **Line**: Must be within the diff — an added or context line in the patch. Must be the **exact line number from reading the file** (not estimated from the patch). Lines outside the diff will fail.
- **Line**: Must be a numbered line in the per-file diff (`/tmp/pr-context/diffs/<filename>.diff`). Only lines with a number prefix are commentable. Lines outside the diff will fail with a GitHub API error.
- **Body**: Sanitized with the standard pipeline (mentions neutralized, HTML filtered, URLs restricted). GitHub API limit is ~65,536 characters.
- **Side**: Defaults to `RIGHT` (the new code). Use `LEFT` only when commenting on deleted lines.
- **Side**: Always `RIGHT` (the new code). Deleted lines have no number prefix in the diff and cannot be targeted for inline comments — include findings about deleted code in the review body instead.
- **Suggestion blocks**: Use ` ```suggestion ` fences for concrete code fixes. The suggestion must actually change the code — don't suggest identical code. Only include a `suggestion` block when you can provide a concrete code fix that **actually changes** the code.

Only flag issues you are confident are real problems — false positives erode trust. Once you have flagged an issue, you cannot unflag it.
29 changes: 16 additions & 13 deletions .github/workflows/gh-aw-mention-in-pr-by-id.lock.yml

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions .github/workflows/gh-aw-mention-in-pr-no-sandbox.lock.yml

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions .github/workflows/gh-aw-mention-in-pr.lock.yml

Large diffs are not rendered by default.

Loading
Loading