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
37 changes: 26 additions & 11 deletions .github/workflows/codex-feedback-loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ jobs:
exit 1
fi

if [ -z "$REVIEW_ID" ]; then
REVIEW_ID=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/reviews" --paginate --jq '

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use --slurp when paginating review lookup

When a PR has enough reviews to span multiple API pages, gh api --paginate --jq ... can emit one selected review ID per page, so REVIEW_ID=$(...) may contain multiple newline-separated IDs instead of one. That multi-line value is then written via echo "review_id=$REVIEW_ID" >> "$GITHUB_OUTPUT", which can corrupt step outputs (or later produce an invalid pulls/<pr>/reviews/<id>/comments path), causing /codex-fix runs to fail on long-lived PRs. Collapse paginated data into a single JSON stream (e.g., --slurp) or explicitly pick one ID after pagination.

Useful? React with 👍 / 👎.

[
.[]
| select(
.user.login == "chatgpt-codex-connector[bot]"
and .state == "COMMENTED"
)
]
| sort_by(.submitted_at // .id)
| last
| .id // empty
')
fi

STATE=$(gh pr view "$PR" --repo "$GITHUB_REPOSITORY" --json state --jq .state)
echo "pr_number=$PR" >> "$GITHUB_OUTPUT"
echo "review_id=$REVIEW_ID" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -107,7 +122,7 @@ jobs:
PR_NUMBER: ${{ steps.ctx.outputs.pr_number }}
REVIEW_ID: ${{ steps.ctx.outputs.review_id }}
run: |
MARKER="<!-- codex-autofix:pr-${PR_NUMBER}:review-${REVIEW_ID:-latest} -->"
MARKER="<!-- codex-autofix:pr-${PR_NUMBER}:review-${REVIEW_ID:-none} -->"
FOUND=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" --paginate --jq ".[] | select(.body | contains(\"$MARKER\")) | .id" | head -n 1 || true)
echo "marker=$MARKER" >> "$GITHUB_OUTPUT"
if [ -n "$FOUND" ]; then
Expand All @@ -125,16 +140,16 @@ jobs:
SUMMARY: ${{ steps.findings.outputs.summary }}
COUNT: ${{ steps.findings.outputs.count }}
run: |
gh pr comment "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --body "$(cat <<EOF
$MARKER
Codex review findings detected ($COUNT item(s)).

@codex address that feedback

Top findings:
$SUMMARY
EOF
)"
{
echo "$MARKER"
echo "Codex review findings detected ($COUNT item(s))."
echo
echo "@codex address that feedback"
echo
echo "Top findings:"
echo "$SUMMARY"
} > /tmp/codex-feedback-comment.txt
gh pr comment "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --body-file /tmp/codex-feedback-comment.txt

- name: No-op summary
if: steps.ctx.outputs.pr_state == 'OPEN' && (steps.findings.outputs.count == '0' || steps.dedupe.outputs.already == 'true')
Expand Down
3 changes: 3 additions & 0 deletions docs/breadcrumbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,3 +379,6 @@
- Added reusable review playbook command `.cursor/commands/pr-review.md` (OpenUsage-style process adapted for StepCast).
- Added codex follow-up automation workflow `.github/workflows/codex-feedback-loop.yml` (auto on codex review, manual `/codex-fix`, workflow_dispatch) with dedupe marker comments.
- Updated `CONTRIBUTING.md` with review automation usage and added spec `docs/specs/2026-02-16-codex-feedback-loop.md`.
2026-02-16
- Applied codex follow-up fix for workflow dedupe edge case: `.github/workflows/codex-feedback-loop.yml` now resolves latest concrete codex `review_id` when manual triggers (`/codex-fix` or `workflow_dispatch`) omit it.
- Result: dedupe marker keys by real review id instead of static `review-latest`, so later manual runs are no longer blocked after earlier autofix comments.
1 change: 1 addition & 0 deletions docs/choices.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,4 @@
- Default: codex feedback automation is follow-up-by-comment (`@codex address that feedback`) with dedupe markers, not direct auto-commit from workflow; reason: keeps human oversight and avoids unsafe write automation in CI context.
- Default: codex follow-up workflow supports three entry points (codex review submit, `/codex-fix` comment, manual dispatch); reason: reliable trigger paths for both automatic and operator-driven remediation.
- Default: Apple Intelligence eligibility uses selected app language (resolved `en|de`) instead of backend `system_locale`; reason: prevents mixed-language eligibility reasons in localized Settings UI.
- Default: when manual `/codex-fix` or `workflow_dispatch` omits `review_id`, resolve the latest concrete codex review id before dedupe; reason: avoid static `review-latest` marker collisions and allow later manual reruns for new findings.
Loading