Skip to content

fix(supervisor): triage PR #392 review feedback - stderr, sort, deploy errors (t147.2)#451

Merged
marcusquinn merged 3 commits intomainfrom
feature/t147.2
Feb 7, 2026
Merged

fix(supervisor): triage PR #392 review feedback - stderr, sort, deploy errors (t147.2)#451
marcusquinn merged 3 commits intomainfrom
feature/t147.2

Conversation

@marcusquinn
Copy link
Copy Markdown
Owner

Summary

Triages 6 review threads from PR #392 (Supervisor post-PR lifecycle). Verified each claim against current code, fixed 3 real bugs, dismissed 3 as already fixed or invalid.

Changes

Fixed (3 threads)

  • ORDER BY CASE missing post-PR states (CodeRabbit, minor): cmd_status and cmd_list SQL queries now include pr_review, merging, deploying, merged, deployed in sort order
  • Deploy failures silently ignored (CodeRabbit, major): run_deploy_for_task failure now transitions task to failed state instead of unconditionally marking deployed
  • Lifecycle stderr suppressed in pulse (CodeRabbit, nitpick): cmd_pr_lifecycle output redirected to $SUPERVISOR_DIR/post-pr.log instead of /dev/null

Additional fixes found during triage

  • Missing $SUPERVISOR_DB in db() calls (lines 3168, 3186): no_pr retry counter never persisted because db() received SQL as first arg instead of DB path (overlaps with t146)
  • Unused no_pr_key variable removed
  • Deploy timeout: Added 300s portable timeout to setup.sh execution with timeout/gtimeout support and background-process fallback

Dismissed (3 threads)

  • gh pr merge stderr suppressed (Gemini, high): Already fixed - line 2873 uses 2>&1
  • Fallback PR lookup without worktree context (CodeRabbit, minor): Already fixed - uses git -C "$task_repo_check" and gh pr list --repo
  • Missing pr_review:deployed transition (CodeRabbit, critical): Invalid - code handles no-PR tasks via complete:deployed transition at line 3102; tasks only reach pr_review when a PR exists

Task

Closes t147.2

…y errors (t147.2)

- Add post-PR states to ORDER BY CASE in cmd_status and cmd_list
- Add 300s timeout to deploy setup.sh with portable fallback
- Deploy failures now transition to 'failed' instead of silently marking 'deployed'
- Redirect cmd_pr_lifecycle output to post-pr.log instead of /dev/null
- Fix missing $SUPERVISOR_DB arg in db() calls for no_pr retry counter
- Remove unused no_pr_key variable

Dismissed 3 of 6 review threads as already fixed or invalid:
- gh pr merge stderr: already uses 2>&1
- Fallback PR lookup: already uses git -C and gh pr list --repo
- Missing pr_review:deployed transition: not needed, complete:deployed handles it
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 7, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 50 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 feature/t147.2

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
Copy Markdown

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 and resolves critical feedback from a previous pull request (#392) concerning the Supervisor's post-PR lifecycle. The changes ensure that task states are correctly sorted, deployment failures are properly handled and reported, and the lifecycle process provides better logging and error tracking. It also includes general code improvements and updates to task tracking.

Highlights

  • SQL Query Sorting: The cmd_status and cmd_list SQL queries have been updated to include new post-PR lifecycle states (pr_review, merging, deploying, merged, deployed) in their ORDER BY CASE statements, ensuring correct sorting and visibility of these states.
  • Robust Deploy Failure Handling: The run_deploy_for_task function now correctly transitions a task to a failed state if the setup.sh deployment script returns a non-zero exit code, preventing silent failures and providing clearer task status.
  • Improved Deploy Timeout Mechanism: A portable 300-second timeout has been added to setup.sh execution within run_deploy_for_task, utilizing timeout/gtimeout where available, or falling back to a manual background process and kill mechanism. Deploy output is now logged to a dedicated file.
  • Corrected Database Path for db() Calls: Fixed an issue where db() calls related to no_pr retry logic were not correctly persisting retry counts due to $SUPERVISOR_DB not being passed as the first argument, ensuring proper tracking of consecutive 'no PR' failures.
  • Lifecycle stderr Logging: The output (including standard error) of cmd_pr_lifecycle is now redirected to $SUPERVISOR_DIR/post-pr.log instead of /dev/null, providing better visibility into the lifecycle process.
  • Unused Variable Removal: The no_pr_key variable, which was no longer used, has been removed for code cleanliness.
  • Review Feedback Triage: Several review threads from a previous PR (feat: Supervisor post-PR lifecycle (t128.8) #392) were triaged, with 3 bugs fixed and 3 pieces of feedback dismissed as already resolved or invalid, ensuring the supervisor's post-PR lifecycle is robust and accurate.
Changelog
  • .agents/scripts/supervisor-helper.sh
    • Updated cmd_status and cmd_list SQL queries to include pr_review, merging, deploying, merged, deployed in the ORDER BY CASE clause for task state sorting.
    • Implemented a portable 300-second timeout for setup.sh execution within run_deploy_for_task, logging output to a dedicated file and transitioning tasks to 'failed' on deploy errors.
    • Corrected db() calls for no_pr retry logic to properly pass $SUPERVISOR_DB as the first argument, ensuring retry counts are persisted.
    • Removed the unused no_pr_key variable.
    • Redirected cmd_pr_lifecycle output to $SUPERVISOR_DIR/post-pr.log for improved logging.
  • TODO.md
    • Marked task t142 (bug: schema-validator-helper.sh set -e causes premature exit) as completed.
    • Marked task t135.9 (P2-C: Add trap cleanup for temp files in setup.sh and mktemp scripts) as completed.
Activity
  • Triaged 6 review threads from PR feat: Supervisor post-PR lifecycle (t128.8) #392 (Supervisor post-PR lifecycle).
  • Verified each claim against current code.
  • Fixed 3 identified bugs based on review feedback.
  • Dismissed 3 review threads as already fixed or invalid.
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
Copy Markdown
Contributor

github-actions bot commented Feb 7, 2026

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Feb 7 18:11:56 UTC 2026: Code review monitoring started
Sat Feb 7 18:11:56 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 26
Sat Feb 7 18:11:56 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Sat Feb 7 18:11:58 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 26
  • VULNERABILITIES: 0

Generated on: Sat Feb 7 18:11:59 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 7, 2026

@marcusquinn marcusquinn merged commit 4600691 into main Feb 7, 2026
11 checks passed
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 effectively addresses several pieces of feedback from a previous review, fixing some important bugs. The changes to handle deployment failures correctly, fix database calls, and improve logging are all excellent. I've suggested one refactoring in run_deploy_for_task to improve memory efficiency and code clarity by removing an unnecessary variable and redirecting command output directly to the log file.

Comment on lines +2982 to 3023
log_info "Running setup.sh for $task_id (timeout: 300s)..."
local deploy_output deploy_log
deploy_log="$SUPERVISOR_DIR/logs/${task_id}-deploy-$(date +%Y%m%d%H%M%S).log"
mkdir -p "$SUPERVISOR_DIR/logs"

# Portable timeout: prefer timeout/gtimeout, fall back to background+kill
local timeout_cmd=""
if command -v timeout &>/dev/null; then
timeout_cmd="timeout 300"
elif command -v gtimeout &>/dev/null; then
timeout_cmd="gtimeout 300"
fi

if [[ -n "$timeout_cmd" ]]; then
if ! deploy_output=$(cd "$repo" && $timeout_cmd ./setup.sh 2>&1); then
log_warn "Deploy (setup.sh) returned non-zero for $task_id (see $deploy_log)"
echo "$deploy_output" > "$deploy_log" 2>/dev/null || true
return 1
fi
else
# Fallback: background process with manual timeout
(cd "$repo" && ./setup.sh > "$deploy_log" 2>&1) &
local deploy_pid=$!
local waited=0
while kill -0 "$deploy_pid" 2>/dev/null && [[ "$waited" -lt 300 ]]; do
sleep 5
waited=$((waited + 5))
done
if kill -0 "$deploy_pid" 2>/dev/null; then
kill "$deploy_pid" 2>/dev/null || true
log_warn "Deploy (setup.sh) timed out after 300s for $task_id (see $deploy_log)"
return 1
fi
if ! wait "$deploy_pid"; then
deploy_output=$(cat "$deploy_log" 2>/dev/null || echo "")
log_warn "Deploy (setup.sh) returned non-zero for $task_id (see $deploy_log)"
return 1
fi
deploy_output=$(cat "$deploy_log" 2>/dev/null || echo "")
fi
log_success "Deploy complete for $task_id"
return 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.

medium

The deploy_output variable can be removed to improve memory efficiency and simplify the code. Instead of capturing the command's output in a variable and then writing it to a file, we can redirect the output directly to the log file. This avoids holding potentially large amounts of data in memory, which is especially important for a long-running deployment script.

The variable is also assigned in the fallback path but never used, so it can be safely removed from there as well.

    log_info "Running setup.sh for $task_id (timeout: 300s)..."
    local deploy_log
    deploy_log="$SUPERVISOR_DIR/logs/${task_id}-deploy-$(date +%Y%m%d%H%M%S).log"
    mkdir -p "$SUPERVISOR_DIR/logs"

    # Portable timeout: prefer timeout/gtimeout, fall back to background+kill
    local timeout_cmd=""
    if command -v timeout &>/dev/null; then
        timeout_cmd="timeout 300"
    elif command -v gtimeout &>/dev/null; then
        timeout_cmd="gtimeout 300"
    fi

    if [[ -n "$timeout_cmd" ]]; then
        if ! (cd "$repo" && $timeout_cmd ./setup.sh > "$deploy_log" 2>&1); then
            log_warn "Deploy (setup.sh) returned non-zero or timed out for $task_id (see $deploy_log)"
            return 1
        fi
    else
        # Fallback: background process with manual timeout
        (cd "$repo" && ./setup.sh > "$deploy_log" 2>&1) &
        local deploy_pid=$!
        local waited=0
        while kill -0 "$deploy_pid" 2>/dev/null && [[ "$waited" -lt 300 ]]; do
            sleep 5
            waited=$((waited + 5))
        done

        if kill -0 "$deploy_pid" 2>/dev/null; then
            kill "$deploy_pid" 2>/dev/null || true
            log_warn "Deploy (setup.sh) timed out after 300s for $task_id (see $deploy_log)"
            return 1
        fi

        if ! wait "$deploy_pid"; then
            log_warn "Deploy (setup.sh) returned non-zero for $task_id (see $deploy_log)"
            return 1
        fi
    fi
    log_success "Deploy complete for $task_id"
    return 0

@marcusquinn marcusquinn deleted the feature/t147.2 branch February 21, 2026 01:59
@marcusquinn marcusquinn added the code-reviews-actioned All review feedback has been actioned label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-reviews-actioned All review feedback has been actioned

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant