Skip to content

t1041: Fix review thread resolution loop blocking queue flow#1401

Merged
marcusquinn merged 1 commit intomainfrom
hotfix/t1041-review-thread-resolution
Feb 13, 2026
Merged

t1041: Fix review thread resolution loop blocking queue flow#1401
marcusquinn merged 1 commit intomainfrom
hotfix/t1041-review-thread-resolution

Conversation

@marcusquinn
Copy link
Owner

Summary

  • Root cause: Fix workers address review feedback but can't resolve GitHub review threads (only author/admin can). Same threads get re-triaged every pulse → infinite fix-worker loop → 3-cycle cap blocks the task
  • Fix 1: Add resolve_bot_review_threads() — resolves bot threads via GraphQL resolveReviewThread mutation after a fix worker cycle completes, before re-triaging
  • Fix 2: Separate human vs bot severity in triage — bot-only medium/low threads no longer trigger fix workers (style nits, not merge-blockers)
  • Fix 3: Only human-sourced high/critical threads gate merging; bot criticals get one fix attempt then auto-resolve

Impact

Unblocks 5 stuck tasks (t1032.1, t1032.2, t1032.3, t1032.5, t1032.8) and prevents all future fix-worker exhaustion loops.

Testing

  • Verified GraphQL resolveReviewThread mutation works on PR t1032.5: Wire Phase 10b to unified audit orchestrator #1377 (resolved 1 bot thread, PR now has 0 unresolved)
  • ShellCheck clean (only pre-existing SC2016 infos for GraphQL queries)
  • Will resolve remaining bot threads on stuck PRs and reset tasks after merge

Files Changed

  • .agents/scripts/supervisor/deploy.sh — new resolve_bot_review_threads() function, updated triage_review_feedback() severity logic, added pre-triage resolution step in review_triage handler

Root cause: fix workers address review feedback but can't resolve GitHub
review threads (only author/admin can). The same threads get re-triaged
every pulse, dispatching another fix worker in an infinite loop until the
3-cycle cap blocks the task.

Three fixes:
1. Add resolve_bot_review_threads() — resolves bot threads via GraphQL
   mutation after a fix worker cycle, before re-triaging
2. Separate human vs bot severity in triage — bot-only medium/low threads
   no longer trigger fix workers (they're style nits, not merge-blockers)
3. Only human-sourced high/critical threads gate merging; bot criticals
   get one fix attempt then resolve

This unblocks t1032.3, t1032.5, t1032.8 and prevents future fix-worker
exhaustion loops.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/t1041-review-thread-resolution

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, 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 addresses a critical issue where automated review processes could get stuck in an infinite loop due to unresolved bot-generated review threads. By introducing a mechanism to automatically resolve these bot threads and refining the review triage logic to prioritize human feedback, the changes ensure a smoother and more efficient PR workflow. This significantly improves the system's ability to process pull requests without manual intervention for bot-related feedback, thereby unblocking several pending tasks and enhancing overall system reliability.

Highlights

  • Bot Review Thread Resolution: Implemented a new function, resolve_bot_review_threads(), which automatically resolves bot-generated review threads on GitHub Pull Requests using the GraphQL API. This prevents an infinite loop where fix workers address feedback but threads remain unresolved because only the author/admin can resolve them.
  • Refined Triage Logic: Modified the triage_review_feedback() function to differentiate between human-sourced and bot-sourced review severities (high, medium). This ensures that only human feedback gates merging, while bot-only medium/low threads no longer trigger fix workers, streamlining the review process.
  • Prevented Fix-Worker Exhaustion: Introduced a pre-triage resolution step in the review_triage handler within cmd_pr_lifecycle(). After a fix worker cycle, bot threads are resolved before re-triaging, effectively unblocking stuck tasks and preventing future fix-worker exhaustion loops.
Changelog
  • .agents/scripts/supervisor/deploy.sh
    • Added a new function resolve_bot_review_threads to programmatically resolve bot-generated GitHub review threads.
    • Integrated the resolve_bot_review_threads function into the cmd_pr_lifecycle handler to run after a fix worker cycle, preventing re-triage of already addressed bot feedback.
    • Updated the triage_review_feedback function to distinguish between human and bot-sourced high and medium severity threads, adjusting the PR action logic accordingly.
    • Extended the JSON output of triage_review_feedback to include detailed counts for human and bot-sourced high/medium severities.
Activity
  • No specific activity (comments, reviews, progress updates) was provided in the context for this pull request.
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.

@github-actions
Copy link

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Fri Feb 13 17:32:08 UTC 2026: Code review monitoring started
Fri Feb 13 17:32:09 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 22

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 22
  • VULNERABILITIES: 0

Generated on: Fri Feb 13 17:32:11 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@marcusquinn marcusquinn merged commit fabe9a4 into main Feb 13, 2026
11 checks passed
Copy link

@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 solid fix for the review thread resolution loop. The new resolve_bot_review_threads function and the updated triage logic are well-designed to address the problem. The existing comments, which align with the repository's shell scripting style guide concerning error logging and function argument handling, remain valid and are included as-is. Addressing these points will enhance the script's robustness and maintainability.

Comment on lines +544 to +549
prior_fix_cycles=$(db "$SUPERVISOR_DB" "
SELECT COUNT(*) FROM state_log
WHERE task_id = '$escaped_id'
AND from_state = 'review_triage'
AND to_state = 'dispatched';
" 2>/dev/null || echo "0")

Choose a reason for hiding this comment

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

medium

The use of 2>/dev/null here violates the repository style guide (Rule #50), which disallows blanket error suppression. Errors from the db command should be logged to aid in debugging, even if a default value is provided on failure. Please redirect stderr to $SUPERVISOR_LOG.

Suggested change
prior_fix_cycles=$(db "$SUPERVISOR_DB" "
SELECT COUNT(*) FROM state_log
WHERE task_id = '$escaped_id'
AND from_state = 'review_triage'
AND to_state = 'dispatched';
" 2>/dev/null || echo "0")
prior_fix_cycles=$(db "$SUPERVISOR_DB" "
SELECT COUNT(*) FROM state_log
WHERE task_id = '$escaped_id'
AND from_state = 'review_triage'
AND to_state = 'dispatched';
" 2>>"$SUPERVISOR_LOG" || echo "0")
References
  1. Rule 50: 2>/dev/null is acceptable only when redirecting to log files, not for blanket error suppression. Errors should be logged for better diagnostics. (link)

Comment on lines +965 to +966
local repo_slug="$1"
local pr_number="$2"

Choose a reason for hiding this comment

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

medium

According to the repository style guide (Rule #11), function parameters should be declared and assigned separately for safety when set -e is active. Please refactor this to:

local repo_slug
repo_slug="$1"
local pr_number
pr_number="$2"
References
  1. Rule 11: Use local var and var="$1" on separate lines for function arguments to avoid unexpected exits under set -e. (link)

Comment on lines +1014 to +1019
bot_thread_ids=$(echo "$result" | jq -r '
[.data.repository.pullRequest.reviewThreads.nodes[]
| select(.isResolved == false)
| select((.comments.nodes[0].author.login // "") | test("bot$|\\[bot\\]$|gemini|coderabbit|copilot|codacy|sonar"; "i"))
| .id
] | .[]' 2>/dev/null || echo "")

Choose a reason for hiding this comment

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

medium

The use of 2>/dev/null here violates the repository style guide (Rule #50), which states that stderr should not be suppressed this way. Suppressing jq errors can hide problems with the GraphQL response format or the jq filter itself. Please redirect stderr to the supervisor log for better diagnostics.

Suggested change
bot_thread_ids=$(echo "$result" | jq -r '
[.data.repository.pullRequest.reviewThreads.nodes[]
| select(.isResolved == false)
| select((.comments.nodes[0].author.login // "") | test("bot$|\\[bot\\]$|gemini|coderabbit|copilot|codacy|sonar"; "i"))
| .id
] | .[]' 2>/dev/null || echo "")
bot_thread_ids=$(echo "$result" | jq -r '
[.data.repository.pullRequest.reviewThreads.nodes[]
| select(.isResolved == false)
| select((.comments.nodes[0].author.login // "") | test("bot$|\\[bot\\]$|gemini|coderabbit|copilot|codacy|sonar"; "i"))
| .id
] | .[]' 2>>"$SUPERVISOR_LOG" || echo "")
References
  1. Rule 50: 2>/dev/null is acceptable only when redirecting to log files, not for blanket error suppression. Errors should be logged for better diagnostics. (link)

@marcusquinn marcusquinn deleted the hotfix/t1041-review-thread-resolution branch February 21, 2026 01:59
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.

1 participant