Skip to content

t1386: Post-merge review feedback scanner#2786

Merged
alex-solovyev merged 4 commits intomainfrom
feature/post-merge-review-scanner
Mar 3, 2026
Merged

t1386: Post-merge review feedback scanner#2786
alex-solovyev merged 4 commits intomainfrom
feature/post-merge-review-scanner

Conversation

@alex-solovyev
Copy link
Copy Markdown
Collaborator

@alex-solovyev alex-solovyev commented Mar 3, 2026

Summary

  • Adds .agents/scripts/post-merge-review-scanner.sh — scans merged PRs for unaddressed AI review bot suggestions and creates GitHub issues for follow-up
  • Supports scan (creates issues) and dry-run (preview only) modes
  • Configurable via env vars: SCANNER_DAYS (lookback window, default 7), SCANNER_MAX_ISSUES (cap per run, default 10), SCANNER_LABEL (issue label, default review-followup)

Details

Detects actionable comments from CodeRabbit, Gemini Code Assist, claude-review, and gpt-review bots containing keywords: should, consider, fix, change, update, refactor, missing, add. Idempotent — skips PRs that already have a follow-up issue.

Verification:

  • ShellCheck: zero violations
  • help command: works
  • dry-run marcusquinn/aidevops: found 10 PRs with unaddressed bot feedback (correctly capped at SCANNER_MAX_ISSUES)
  • 142 lines (under 150 limit)

Closes #2785

Summary by CodeRabbit

  • New Features
    • Automated scan of merged PRs to detect actionable feedback from AI review tools.
    • Automatically creates labeled GitHub follow-up issues summarizing actionable items and linking the PR.
    • Configurable scan window, per-run issue and PR limits, label selection, and dry-run mode for safe testing.
    • Idempotent behavior: skips PRs with existing follow-up issues to avoid duplicates.

Scans merged PRs for unaddressed AI review bot suggestions (CodeRabbit,
Gemini Code Assist, claude-review, gpt-review) and creates GitHub issues
for follow-up. Supports dry-run mode, configurable lookback window via
SCANNER_DAYS env var, and idempotent issue creation.

Closes #2785
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new automation script designed to enhance code quality and ensure that valuable AI-generated review feedback is consistently addressed. By automatically scanning merged pull requests for unaddressed bot suggestions and creating corresponding GitHub issues, it streamlines the follow-up process and prevents important recommendations from being missed, thereby improving the overall maintainability and quality of the codebase.

Highlights

  • New Post-Merge Review Scanner: A new bash script, post-merge-review-scanner.sh, has been added to automate the process of identifying and tracking unaddressed AI review bot feedback on recently merged pull requests.
  • Automated Issue Creation: The script scans for actionable suggestions from AI review bots (CodeRabbit, Gemini Code Assist, claude-review, gpt-review) and automatically creates GitHub issues for follow-up, ensuring no feedback is overlooked.
  • Flexible Operation Modes: The scanner supports both scan mode, which creates issues, and dry-run mode, which provides a preview of issues that would be created without making actual changes.
  • Configurable Parameters: Key operational parameters such as the lookback window (SCANNER_DAYS), maximum issues to create per run (SCANNER_MAX_ISSUES), and the label for created issues (SCANNER_LABEL) are configurable via environment variables.
  • Idempotency and Keyword Detection: The script is idempotent, skipping PRs that already have a follow-up issue, and detects actionable comments using keywords like 'should', 'consider', 'fix', 'change', 'update', 'refactor', 'missing', and 'add'.
Changelog
  • .agents/scripts/post-merge-review-scanner.sh
    • Added a new script to scan merged pull requests for unaddressed AI review bot feedback and create GitHub issues for follow-up.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4692efc and 5974128.

📒 Files selected for processing (1)
  • .agents/scripts/post-merge-review-scanner.sh

Walkthrough

Adds a new Bash script .agents/scripts/post-merge-review-scanner.sh that scans merged PRs for unactioned AI/bot review comments, summarizes actionable items, checks for existing follow-up issues, and creates labeled GitHub issues (or logs actions in dry-run). Configurable via env vars; uses gh and jq.

Changes

Cohort / File(s) Summary
Post-Merge Review Scanner
.agents/scripts/post-merge-review-scanner.sh
New script implementing: get_lookback_date() for date calculation, fetch_actionable() to collect bot actionable comments, issue_exists() to detect existing follow-ups, create_issue() to open labeled issues (supports dry-run), do_scan() orchestrator, and main() CLI. Config via SCANNER_DAYS, SCANNER_MAX_ISSUES, SCANNER_LABEL, SCANNER_PR_LIMIT; relies on gh + jq.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Scanner as "post-merge-review-scanner.sh"
    participant GitHubAPI as "GitHub API"
    participant Issues as "GitHub Issues"

    User->>Scanner: run scan / dry-run
    Scanner->>GitHubAPI: list merged PRs since lookback
    GitHubAPI-->>Scanner: merged PR list

    loop For each PR (up to SCANNER_PR_LIMIT / SCANNER_MAX_ISSUES)
        Scanner->>GitHubAPI: fetch reviews & review_comments for PR
        GitHubAPI-->>Scanner: comments
        Scanner->>Scanner: filter by bot users & actionable keywords
        Scanner->>GitHubAPI: search for existing issue with SCANNER_LABEL referencing PR
        GitHubAPI-->>Scanner: issue exists? (yes/no)
        alt No existing issue & actionable items
            Scanner->>Issues: create labeled issue (or log if dry-run)
            Issues-->>Scanner: issue created
        else Skip PR
        end
    end

    Scanner-->>User: report summary / finished
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • t1386: Post-merge review feedback scanner #2786 — Adds the same .agents/scripts/post-merge-review-scanner.sh script and functions (fetch_actionable, issue_exists, create_issue, do_scan, main, get_lookback_date); highly related and likely duplicate or alternate implementation.

Suggested labels

enhancement

Poem

🕵️‍♂️ A quiet script combs merged PRs by night,
Finds bot-wise notes that need a human light,
Drafts an issue, tags it neat,
Dry-run first — no heartbeat,
Follow-ups queued to make code bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly identifies the main change: introducing a post-merge review feedback scanner script, which is the core purpose of this PR.
Linked Issues check ✅ Passed All primary coding objectives from #2785 are met: the script scans merged PRs, detects actionable bot comments from multiple AI review bots using keyword heuristics, ensures idempotency, supports dry-run mode, and implements configurable environment variables with issue labeling and rate limiting.
Out of Scope Changes check ✅ Passed The PR introduces only the new post-merge-review-scanner.sh script with associated functions; no modifications to existing codebase or unrelated files, keeping changes tightly scoped to the stated objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/post-merge-review-scanner

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 113 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Mar 3 16:14:23 UTC 2026: Code review monitoring started
Tue Mar 3 16:14:24 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 113

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 113
  • VULNERABILITIES: 0

Generated on: Tue Mar 3 16:14:26 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@alex-solovyev
Copy link
Copy Markdown
Collaborator Author

Pulse triage (2026-03-03T16:18:47Z):

  • Wait for AI Review Bots: CodeRabbit review is in progress (pending). Gate will auto-rerun when CodeRabbit posts. No action needed.
  • Monitor & Auto-Fix Code Quality: GitHub API returned a 500 Unicorn error (transient). Re-ran the check.

PR is blocked on CodeRabbit completing — expected within a few minutes. Will merge once all gates pass.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 113 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Mar 3 16:19:11 UTC 2026: Code review monitoring started
Tue Mar 3 16:19:12 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 113

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 113
  • VULNERABILITIES: 0

Generated on: Tue Mar 3 16:19:14 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
.agents/scripts/post-merge-review-scanner.sh (1)

104-112: Prefer printf over echo -e for summary rendering.

echo -e interprets escapes from comment text and can mutate output unexpectedly.

Suggested refactor
-		while IFS='|' read -r bot path snippet; do
+		while IFS='|' read -r bot path snippet; do
 			local ref=""
 			[[ -n "$path" ]] && ref=" (\`${path}\`)"
-			summary="${summary}- **${bot}**${ref}: ${snippet}...\n"
+			printf -v summary '%s- **%s**%s: %s...\n' "$summary" "$bot" "$ref" "$snippet"
 		done <<<"$hits"
 		[[ -z "$summary" ]] && continue
 		log "PR #${pr}: creating issue"
-		create_issue "$repo" "$pr" "$pr_title" "$(echo -e "$summary")" "$dry_run"
+		create_issue "$repo" "$pr" "$pr_title" "$summary" "$dry_run"

As per coding guidelines, .agents/scripts/*.sh: automation scripts should provide robust behavior and clear feedback.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/post-merge-review-scanner.sh around lines 104 - 112, Replace
the use of echo -e when passing the rendered summary into create_issue to avoid
unintended escape interpretation; update the invocation that currently uses
"$(echo -e "$summary")" to use printf with the "%b" format (e.g., pass the
expanded summary via printf "%b" "$summary") so escapes are handled safely,
keeping the same variables and call-site (summary and create_issue) otherwise
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/scripts/post-merge-review-scanner.sh:
- Around line 82-83: The gh pr list call that populates pr_numbers omits an
explicit pagination limit, so it only returns the default 30 results; update the
command used to populate pr_numbers (the gh pr list invocation) to add an
explicit --limit value (e.g., --limit 1000 or a shell variable like
PR_LIST_LIMIT) so the scan covers all merged PRs in the lookback window; ensure
the chosen limit is high enough for expected merge volume or make it
configurable via an environment variable used when constructing the gh pr list
command.
- Around line 49-51: The idempotency check in issue_exists() currently only
queries open issues and uses a generic search "PR #${pr}", so closed follow-ups
or unrelated matches will cause duplicates; change the gh query to include all
states (remove or replace --state open with --state all) and replace the generic
search with an exact title match built the same way as create_issue() does
(construct the TITLE the same way create_issue() forms the issue title and use
--search 'in:title "TITLE"' or the exact TITLE variable), keeping the same
output parsing (--json number --jq 'length') to determine existence; reference
issue_exists(), create_issue(), and SCANNER_LABEL to locate and update the call.
- Around line 35-44: The jq filters in variables jq_f and jq_r assume .body is
non-null which makes test() fail silently due to the trailing "|| true" and
redirected stderr; update both filters to coalesce nullable .body with // ""
before calling test() and gsub (e.g., use (.body // "") in place of .body) and
remove the broad error suppression (the 2>/dev/null || true on the gh api pipes)
so real jq errors surface; ensure you keep the existing selections on
.user.login and .path and preserve the truncation/gsub logic but applied to
(.body // "").

---

Nitpick comments:
In @.agents/scripts/post-merge-review-scanner.sh:
- Around line 104-112: Replace the use of echo -e when passing the rendered
summary into create_issue to avoid unintended escape interpretation; update the
invocation that currently uses "$(echo -e "$summary")" to use printf with the
"%b" format (e.g., pass the expanded summary via printf "%b" "$summary") so
escapes are handled safely, keeping the same variables and call-site (summary
and create_issue) otherwise unchanged.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50d9e2d and 6b0b7c2.

📒 Files selected for processing (1)
  • .agents/scripts/post-merge-review-scanner.sh

Comment thread .agents/scripts/post-merge-review-scanner.sh Outdated
Comment thread .agents/scripts/post-merge-review-scanner.sh
Comment thread .agents/scripts/post-merge-review-scanner.sh Outdated
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new script to scan for unaddressed review comments on merged pull requests. The script is well-structured and makes good use of shell features for robustness. My review focuses on improving error handling and overall script resilience. The primary concern is the consistent use of 2>/dev/null to suppress error streams, which can hide critical issues like authentication failures or syntax errors, making the script difficult to debug. I've provided several high-severity suggestions to address this pattern, aligning with repository best practices. Additionally, I've included a medium-severity suggestion to improve the way multiline strings are constructed, making the script more robust against unexpected input from PR comments.

Comment on lines +38 to +39
{ gh api "repos/${repo}/pulls/${pr}/comments" --paginate 2>/dev/null || echo '[]'; } |
jq -r "$jq_f" 2>/dev/null || true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Error suppression with 2>/dev/null for gh api and jq can hide important issues. For gh api, it can mask authentication or permission errors. For jq, it can hide syntax errors in the filter. This is against the repository's general rules, which advise against blanket error suppression to aid debugging. The || echo '[]' and || true constructs are sufficient to handle expected non-zero exit codes gracefully without hiding the underlying error messages.

Suggested change
{ gh api "repos/${repo}/pulls/${pr}/comments" --paginate 2>/dev/null || echo '[]'; } |
jq -r "$jq_f" 2>/dev/null || true
{ gh api "repos/${repo}/pulls/${pr}/comments" --paginate || echo '[]'; } |
jq -r "$jq_f" || true
References
  1. Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging. In shell scripts with 'set -e' enabled, use '|| true' to prevent the script from exiting when a command like 'jq' fails on an optional lookup. Do not suppress stderr with '2>/dev/null' so that actual syntax or system errors remain visible for debugging.

Comment on lines +43 to +44
{ gh api "repos/${repo}/pulls/${pr}/reviews" --paginate 2>/dev/null || echo '[]'; } |
jq -r "$jq_r" 2>/dev/null || true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

As with the comment fetching above, suppressing stderr with 2>/dev/null for gh api and jq should be avoided. This practice can hide critical errors like authentication failures or jq filter syntax errors, making the script harder to debug. Allowing stderr to be printed is aligned with the repository's general guidelines.

Suggested change
{ gh api "repos/${repo}/pulls/${pr}/reviews" --paginate 2>/dev/null || echo '[]'; } |
jq -r "$jq_r" 2>/dev/null || true
{ gh api "repos/${repo}/pulls/${pr}/reviews" --paginate || echo '[]'; } |
jq -r "$jq_r" || true
References
  1. Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging. In shell scripts with 'set -e' enabled, use '|| true' to prevent the script from exiting when a command like 'jq' fails on an optional lookup. Do not suppress stderr with '2>/dev/null' so that actual syntax or system errors remain visible for debugging.

Comment on lines +49 to +50
count=$(gh issue list --repo "$repo" --label "$SCANNER_LABEL" \
--search "PR #${pr}" --state open --json number --jq 'length' 2>/dev/null || echo "0")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Suppressing stderr with 2>/dev/null here is risky. If the gh issue list command fails due to an authentication error, the command will silently fail, count will be set to "0", and issue_exists will incorrectly return false. This could lead to duplicate issues being created. It's better to let potential errors be visible for debugging, in line with repository guidelines.

Suggested change
count=$(gh issue list --repo "$repo" --label "$SCANNER_LABEL" \
--search "PR #${pr}" --state open --json number --jq 'length' 2>/dev/null || echo "0")
count=$(gh issue list --repo "$repo" --label "$SCANNER_LABEL" \
--search "PR #${pr}" --state open --json number --jq 'length' || echo "0")
References
  1. Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging.

Comment on lines +82 to +83
pr_numbers=$(gh pr list --state merged --search "merged:>${since_date}" \
--repo "$repo" --json number --jq '.[].number' 2>/dev/null || echo "")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Suppressing stderr with 2>/dev/null can hide critical errors, such as authentication failures. If this gh pr list command fails, pr_numbers will be empty, and the script will incorrectly report "No merged PRs found" instead of surfacing the underlying problem. Please remove the error suppression to improve debuggability, as recommended by the repository's general rules.

Suggested change
pr_numbers=$(gh pr list --state merged --search "merged:>${since_date}" \
--repo "$repo" --json number --jq '.[].number' 2>/dev/null || echo "")
pr_numbers=$(gh pr list --state merged --search "merged:>${since_date}" \
--repo "$repo" --json number --jq '.[].number' || echo "")
References
  1. Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging.

done <<<"$hits"
[[ -z "$summary" ]] && continue
log "PR #${pr}: creating issue"
create_issue "$repo" "$pr" "$pr_title" "$(echo -e "$summary")" "$dry_run"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using echo -e can be risky as it interprets backslash escapes within the $summary variable. Since the summary contains content from PR comments (snippet), it could unintentionally alter the output if a comment contains sequences like \t or \c. A safer approach is to build the summary string with literal newlines and pass it directly to create_issue.

To do this, you can modify line 107 to append a true newline:

# In line 107
summary+="- **${bot}**${ref}: ${snippet}..."$'
'

And then change this line to pass $summary directly, without echo -e.

Suggested change
create_issue "$repo" "$pr" "$pr_title" "$(echo -e "$summary")" "$dry_run"
create_issue "$repo" "$pr" "$pr_title" "$summary" "$dry_run"

…(t1386)

- Add --limit flag to gh pr list (configurable via SCANNER_PR_LIMIT, default 1000)
- issue_exists() now uses --state all and exact title matching to catch closed issues
- Null-coalesce .body with // "" in jq filters to handle null bodies safely
- Remove broad 2>/dev/null || true on jq to surface real parse errors
- Replace echo -e with printf '%b' for portable escape interpretation
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 113 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Mar 3 16:24:01 UTC 2026: Code review monitoring started
Tue Mar 3 16:24:02 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 113

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 113
  • VULNERABILITIES: 0

Generated on: Tue Mar 3 16:24:04 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.agents/scripts/post-merge-review-scanner.sh (2)

37-37: Optional: Null-coalesce .user.login for complete defensive filtering.

The .body fields are now properly guarded with // "", but .user.login isn't. While null logins are extremely rare (deleted user edge case), adding the guard would make the filter fully robust.

♻️ Defensive hardening
-	local jq_f='[.[] | select(.user.login | test("'"$BOT_RE"'";"i"))
+	local jq_f='[.[] | select((.user.login // "") | test("'"$BOT_RE"'";"i"))

Same pattern applies to jq_r on line 42.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/post-merge-review-scanner.sh at line 37, The jq filters jq_f
and jq_r should defensively coalesce .user.login like the existing .body guards
so null/absent logins don't break matching; update the filter expressions that
currently use .user.login | test(...) to use (.user.login // "") | test(...,
"i") in both the jq_f and jq_r definitions (preserving the case-insensitive flag
and surrounding logic) so deleted/NULL user cases are safely ignored.

40-46: Silent API failures could mask missed feedback.

When gh api fails (rate limit, network error, auth issue), the 2>/dev/null || echo '[]' pattern silently proceeds with empty results. The scanner won't know it missed PRs, undermining reliability.

Consider logging API failures while still providing the fallback:

♻️ Proposed improvement for observability
-	{ gh api "repos/${repo}/pulls/${pr}/comments" --paginate 2>/dev/null || echo '[]'; } |
+	{ gh api "repos/${repo}/pulls/${pr}/comments" --paginate 2>/dev/null || { log "WARN: API failed for PR #${pr} comments"; echo '[]'; }; } |
 		jq -r "$jq_f"
 ...
-	{ gh api "repos/${repo}/pulls/${pr}/reviews" --paginate 2>/dev/null || echo '[]'; } |
+	{ gh api "repos/${repo}/pulls/${pr}/reviews" --paginate 2>/dev/null || { log "WARN: API failed for PR #${pr} reviews"; echo '[]'; }; } |
 		jq -r "$jq_r"

As per coding guidelines: .agents/scripts/*.sh automation scripts should prioritize clear logging and feedback.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/post-merge-review-scanner.sh around lines 40 - 46, The gh
api calls currently swallow errors via the "2>/dev/null || echo '[]'" pattern
(used around the gh api "repos/${repo}/pulls/${pr}/comments" and
"repos/${repo}/pulls/${pr}/reviews" invocations and the jq_f/jq_r pipelines);
change each call to capture stderr and the exit status, and when gh api fails
emit a clear error log to stderr (include repo, pr and the captured error text)
before falling back to "[]", e.g. run gh api into a temp variable or redirect
stderr to a variable, test $? and print a descriptive message to >&2 so failures
aren’t silent while preserving the empty-array fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.agents/scripts/post-merge-review-scanner.sh:
- Line 37: The jq filters jq_f and jq_r should defensively coalesce .user.login
like the existing .body guards so null/absent logins don't break matching;
update the filter expressions that currently use .user.login | test(...) to use
(.user.login // "") | test(..., "i") in both the jq_f and jq_r definitions
(preserving the case-insensitive flag and surrounding logic) so deleted/NULL
user cases are safely ignored.
- Around line 40-46: The gh api calls currently swallow errors via the
"2>/dev/null || echo '[]'" pattern (used around the gh api
"repos/${repo}/pulls/${pr}/comments" and "repos/${repo}/pulls/${pr}/reviews"
invocations and the jq_f/jq_r pipelines); change each call to capture stderr and
the exit status, and when gh api fails emit a clear error log to stderr (include
repo, pr and the captured error text) before falling back to "[]", e.g. run gh
api into a temp variable or redirect stderr to a variable, test $? and print a
descriptive message to >&2 so failures aren’t silent while preserving the
empty-array fallback.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b0b7c2 and 4692efc.

📒 Files selected for processing (1)
  • .agents/scripts/post-merge-review-scanner.sh

…ew-scanner (t1386)

- Remove all 2>/dev/null stderr suppression from gh api, jq, gh pr list,
  gh issue list, gh pr view, gh repo view, and gh label create calls.
  Keep || fallbacks (|| echo '[]', || true, || echo '') for graceful
  error recovery without hiding auth/syntax errors (Gemini high severity)
- Add --limit 100 to gh issue list in issue_exists() to prevent default
  30-item cap from missing existing follow-up issues (CodeRabbit major)
- Harden jq filters with (.user.login // "") null coalescing to prevent
  test() failures on nullable fields (CodeRabbit major)
- Replace echo -e with printf -v for summary rendering to avoid
  unintended escape interpretation from PR comment content (CodeRabbit nitpick)

Closes #2785
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 113 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Mar 3 16:29:25 UTC 2026: Code review monitoring started
Tue Mar 3 16:29:26 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 113

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 113
  • VULNERABILITIES: 0

Generated on: Tue Mar 3 16:29:28 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@alex-solovyev
Copy link
Copy Markdown
Collaborator Author

Worker killed after 4+ hours with 0 commits (struggle_ratio: 7323). PR is APPROVED with CI nearly complete — merging directly once Framework Validation check passes.

- Null-coalesce .user.login with // "" in both jq_f and jq_r filters
  to handle deleted-user edge case (CodeRabbit nitpick)
- Replace echo-style \n string concatenation with printf format string
  to avoid unintended escape interpretation in comment text
- ShellCheck: zero violations
@marcusquinn
Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 3, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 113 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Mar 3 16:32:07 UTC 2026: Code review monitoring started
Tue Mar 3 16:32:07 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 113

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 113
  • VULNERABILITIES: 0

Generated on: Tue Mar 3 16:32:10 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 3, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t1386: Post-merge review feedback scanner — scan merged PRs for unactioned code quality feedback and create issues

2 participants