fix: add debug logging to AI lifecycle loop#2110
Conversation
Summary of ChangesHello @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 enhances the AI lifecycle management by integrating comprehensive debug logging to pinpoint an issue where only a single task is processed per cycle. Concurrently, it refines the system's robustness by preventing older, non-AI-aware recovery processes from interfering with active AI lifecycle operations, thereby ensuring consistent and predictable task handling. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
|
Caution Review failedThe pull request is closed. WalkthroughEnhanced observability and lifecycle control in supervisor scripts: added task eligibility tallies and status-change logging to ai-lifecycle.sh, while introducing conditional gating in pulse.sh to skip legacy pr_review recovery when AI lifecycle is enabled, with adjusted failure logging. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Feb 21 15:59:11 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
There was a problem hiding this comment.
Code Review
This pull request adds debug logging to the AI lifecycle loop to diagnose why only one task is processed per pulse cycle. It also introduces a guard in the pulse scheduler to skip legacy stale PR recovery when the AI lifecycle is active, preventing potential state clobbering. The logging enhancements are well-placed and follow the project's established patterns, though some minor style guide adherence and a likely underlying bug regarding stdin consumption were identified.
| total_eligible=$(printf '%s\n' "$eligible_tasks" | grep -c '.' || echo "0") | ||
| log_info "ai-lifecycle: $total_eligible eligible tasks" | ||
|
|
||
| while IFS='|' read -r tid tstatus tpr trepo; do |
There was a problem hiding this comment.
Regarding the issue where only one task is processed per cycle: if process_task_lifecycle (called inside this loop) executes commands that read from stdin (like gh, opencode, or ssh), it will consume the remaining lines of $eligible_tasks, causing the loop to terminate early. To prevent this, ensure all commands inside the loop have their stdin redirected from /dev/null.
| local repos_with_changes="" | ||
|
|
||
| local total_eligible=0 | ||
| total_eligible=$(printf '%s\n' "$eligible_tasks" | grep -c '.' || echo "0") |
There was a problem hiding this comment.
The use of || echo "0" as a guard for grep -c is functionally correct, but for commands that may fail under set -e, the recommended practice is to use || true to prevent premature script termination. While grep -c already outputs 0 to stdout even when no matches are found (though it exits with code 1), || true ensures adherence to the set -e safety pattern.
| total_eligible=$(printf '%s\n' "$eligible_tasks" | grep -c '.' || echo "0") | |
| total_eligible=$(printf '%s\n' "$eligible_tasks" | grep -c '.' || true) |
References
- Use || true guards for commands that may fail under set -e (grep, arithmetic) (link)
- 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.
Flagged for Human ReviewReason: t1311 has malformed blocked-by dependency (blocked-by:` with backtick instead of task ID). This prevents dispatch and auto-unblock detection. The blocker field needs manual correction in TODO.md to either remove the dependency or specify the correct blocking task ID. This issue has been flagged by the AI supervisor for human review. Please assess and take appropriate action. Flagged by AI Supervisor (automated reasoning cycle) |



Adds logging to diagnose why only 1 task is processed per pulse cycle.
Summary by CodeRabbit