-
Notifications
You must be signed in to change notification settings - Fork 36
feat(review agent): anchor severity across re-reviews #729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ben-alkov
merged 1 commit into
fullsend-ai:main
from
ben-alkov:worktree-feat+review-severity-anchoring
May 14, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
internal/scaffold/fullsend-repo/scripts/pre-fetch-prior-review.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| #!/usr/bin/env bash | ||
| # pre-fetch-prior-review.sh - Fetch any previous review before the review agent runs | ||
| # | ||
| # Required environment variables (set by the workflow) | ||
| # | ||
| # - GH_TOKEN | ||
| # - ORG_NAME | ||
| # - PR_NUM | ||
| # - REVIEW_APP_CLIENT_ID - review agent's GitHub ID | ||
| # - SOURCE_REPO | ||
| set -euo pipefail | ||
|
|
||
| PRIOR_FILE=${GITHUB_WORKSPACE}/prior-review.txt | ||
| REVIEW_BOT="${ORG_NAME}-review[bot]" | ||
| PROVENANCE="none" | ||
|
|
||
| # Fetch full comment object (not just body) for provenance validation | ||
| COMMENT_JSON=$(gh api "repos/${SOURCE_REPO}/issues/${PR_NUM}/comments" \ | ||
| --paginate --jq '.[]' \ | ||
| | jq --arg bot "${REVIEW_BOT}" -s \ | ||
| '[.[] | select(.user.login == $bot | ||
| and (.body | contains("<!-- fullsend:review-agent -->")))] | last // empty' \ | ||
| 2>/dev/null || echo "") | ||
|
|
||
| if [[ -z "${COMMENT_JSON}" || "${COMMENT_JSON}" == "null" ]]; then | ||
| echo "No prior review found (first review)" | ||
| : > "${PRIOR_FILE}" # truncate to 0 bytes | ||
| # shellcheck disable=SC2129 | ||
| echo "prior_review_file=${PRIOR_FILE}" >> "${GITHUB_OUTPUT}" | ||
| echo "prior_sha=" >> "${GITHUB_OUTPUT}" | ||
| echo "prior_review_provenance=${PROVENANCE}" >> "${GITHUB_OUTPUT}" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Previous review exists — extract ID | ||
| COMMENT_ID="$(echo "${COMMENT_JSON}" | jq -r '.id')" | ||
|
|
||
| # Validate that the comment was created by the expected GitHub App. | ||
| # The REST API does not expose comment edit history — we can verify | ||
| # original authorship but not post-creation edits. HMAC-based content | ||
| # integrity is tracked as a follow-up to close the edit-detection gap. | ||
| APP_CLIENT_ID="$(echo "${COMMENT_JSON}" | jq -r '.performed_via_github_app.client_id // ""')" | ||
|
|
||
| if [[ -z "${APP_CLIENT_ID}" ]]; then | ||
| echo "::warning::Prior review comment ${COMMENT_ID} has no GitHub App provenance — discarding (cannot verify authorship)" | ||
| PROVENANCE="unverifiable-no-app" | ||
| elif [[ "${APP_CLIENT_ID}" != "${REVIEW_APP_CLIENT_ID}" ]]; then | ||
| echo "::error::Prior review comment ${COMMENT_ID} created by app client_id=${APP_CLIENT_ID}, expected ${REVIEW_APP_CLIENT_ID} — discarding (wrong app)" | ||
| PROVENANCE="unverifiable-wrong-app" | ||
| else | ||
| PROVENANCE="app-verified" | ||
| fi | ||
|
|
||
| if [[ "${PROVENANCE}" != "app-verified" ]]; then | ||
| : > "${PRIOR_FILE}" # truncate to 0 bytes | ||
| # shellcheck disable=SC2129 | ||
| echo "prior_review_file=${PRIOR_FILE}" >> "${GITHUB_OUTPUT}" | ||
| echo "prior_sha=" >> "${GITHUB_OUTPUT}" | ||
| echo "prior_review_provenance=${PROVENANCE}" >> "${GITHUB_OUTPUT}" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Provenance passed — extract body | ||
| echo "${COMMENT_JSON}" | jq -r '.body // ""' > "${PRIOR_FILE}" | ||
|
|
||
| BYTE_COUNT="$(wc -c < "${PRIOR_FILE}")" | ||
| echo "Prior review body: ${BYTE_COUNT} bytes" | ||
|
|
||
| MAX_BYTES=1048576 # 1 MB | ||
| if [[ "${BYTE_COUNT}" -gt "${MAX_BYTES}" ]]; then | ||
| echo "::warning::Prior review body too large, skipping anchoring" | ||
| echo "" > "${PRIOR_FILE}" | ||
| BYTE_COUNT=0 | ||
| fi | ||
|
|
||
| echo "prior_review_file=${PRIOR_FILE}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| if [[ "${BYTE_COUNT}" -gt 1 ]]; then | ||
| # Extract SHA from current section only (before sticky history sentinels) | ||
| CURRENT_SECTION="$(awk '/<!-- sticky:history-start -->/{exit} {print}' "${PRIOR_FILE}")" | ||
| PRIOR_SHA="$(echo "${CURRENT_SECTION}" \ | ||
| | grep -oP '(?<=\*\*Head SHA:\*\* )[0-9a-f]{7,64}' | head -1)" | ||
| echo "prior_sha=${PRIOR_SHA}" >> "${GITHUB_OUTPUT}" | ||
| echo "Prior review SHA: ${PRIOR_SHA:-none}" | ||
| else | ||
| echo "No usable prior review content" | ||
| echo "prior_sha=" >> "${GITHUB_OUTPUT}" | ||
| fi | ||
|
|
||
| echo "prior_review_provenance=${PROVENANCE}" >> "${GITHUB_OUTPUT}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.