t1085.3: AI supervisor action executor with validated action types#1612
t1085.3: AI supervisor action executor with validated action types#1612marcusquinn merged 4 commits intomainfrom
Conversation
Implements supervisor/ai-actions.sh with 7 validated action types: - comment_on_issue: post comments on GitHub issues - create_task: add new tasks to TODO.md via claim-task-id.sh - create_subtasks: break down existing tasks into subtasks - flag_for_review: label issues for human review - adjust_priority: recommend priority changes (non-destructive) - close_verified: close issues only with verified merged PR proof - request_info: post structured info requests on issues Each action is validated before execution (type check + field validation). Includes dry-run and validate-only modes, safety limits, and audit logging.
- Source ai-actions.sh in module loading section - Add ai-actions CLI command for direct action plan execution - Add ai-pipeline CLI command for full reasoning+execution pipeline - Enhance ai-status to show action execution count and max actions config
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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)
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: Wed Feb 18 01:39:03 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
12 tests covering: - Syntax check and module sourcing - Action type validation (7 valid, 4 invalid) - Field validation (20 cases across all action types) - Empty plan handling, invalid JSON rejection - Validate-only and dry-run modes - Safety limit enforcement (max actions per cycle) - Invalid action type skipping with correct reason - CLI help flag - Integration with supervisor-helper.sh sourcing
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 significantly extends the AI supervisor's capabilities by introducing a robust and validated action execution framework. It allows the AI to perform a variety of structured operations based on its reasoning, such as interacting with GitHub issues and managing tasks, all while incorporating critical safety checks to prevent unintended changes. This enhancement moves the AI supervisor closer to autonomous operation by enabling it to act on its insights in a controlled manner. 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
|
🔍 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: Wed Feb 18 01:44:05 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
There was a problem hiding this comment.
Code Review
This pull request introduces a robust AI action executor, ai-actions.sh, and integrates it into the supervisor workflow. The implementation is well-structured with clear separation of concerns for validation and execution of different action types. The accompanying test suite is comprehensive and covers various scenarios, which is excellent.
My review focuses on adherence to the repository's shell scripting style guide and improving the robustness of a few areas. I've identified a couple of style guide violations, such as the local variable assignment pattern and missing trap for a temporary file. I've also suggested improvements to argument parsing and a fix for how new tasks are appended to TODO.md to prevent issues with file parsing. Additionally, I've noted an opportunity to extract duplicated validation logic into a helper function, aligning with repository guidelines for maintainability. I've referenced the repository style guide for feedback on variable assignments (line 11), temporary file cleanup (line 33), and stderr redirection (line 50). Overall, this is a solid contribution that significantly enhances the supervisor's capabilities.
|
|
||
| # Append to TODO.md (before the first blank line after the last task) | ||
| # Find the "Backlog" or last task section and append there | ||
| printf '\n%s\n' "$task_line" >>"$todo_file" |
There was a problem hiding this comment.
The _exec_create_task function appends new tasks to the end of TODO.md. However, the TODO.md file has structured TOON blocks at the end. Appending tasks after these blocks is incorrect and will likely break tools that parse the file. The new task should be inserted into the 'Backlog' section, before the TOON blocks.
| printf '\n%s\n' "$task_line" >>"$todo_file" | |
| # Find the line number of the first TOON block to insert before it. | |
| local toon_line | |
| toon_line=$(grep -n "<!--TOON:" "$todo_file" | head -1 | cut -d: -f1) | |
| if [[ -n "$toon_line" ]]; then | |
| local temp_file; temp_file=$(mktemp) | |
| # shellcheck disable=SC2064 | |
| trap "rm -f '$temp_file'" RETURN | |
| head -n "$((toon_line - 1))" "$todo_file" > "$temp_file" | |
| printf '%s\n' "$task_line" >> "$temp_file" | |
| tail -n "+$toon_line" "$todo_file" >> "$temp_file" | |
| mv "$temp_file" "$todo_file" | |
| else | |
| # Fallback to appending | |
| printf '\n%s\n' "$task_line" >>"$todo_file" | |
| fi |
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --mode) | ||
| _aa_mode="$2" | ||
| shift 2 | ||
| ;; | ||
| --plan) | ||
| _aa_plan="$2" | ||
| shift 2 | ||
| ;; | ||
| --dry-run) | ||
| _aa_mode="dry-run" | ||
| shift | ||
| ;; | ||
| --repo) | ||
| _aa_repo="$2" | ||
| shift 2 | ||
| ;; | ||
| *) shift ;; | ||
| esac | ||
| done |
There was a problem hiding this comment.
The argument parsing loop for the ai-actions command uses shift 2 for options that take a value. This is fragile and will fail with an error if an option is passed without its value or as the last argument (e.g., ... --mode). It's safer to check for the presence of $2 before shifting and to handle the missing argument case gracefully.
while [[ $# -gt 0 ]]; do
case "$1" in
--mode)
if [[ -z "$2" || "$2" == --* ]]; then
log_error "ai-actions: --mode requires an argument"
return 1
fi
_aa_mode="$2"
shift 2
;;
--plan)
if [[ -z "$2" || "$2" == --* ]]; then
log_error "ai-actions: --plan requires an argument"
return 1
fi
_aa_plan="$2"
shift 2
;;
--dry-run)
_aa_mode="dry-run"
shift
;;
--repo)
if [[ -z "$2" || "$2" == --* ]]; then
log_error "ai-actions: --repo requires an argument"
return 1
fi
_aa_repo="$2"
shift 2
;;
*) shift ;;
esac
done| local action_plan="$1" | ||
| local repo_path="${2:-$REPO_PATH}" | ||
| local mode="${3:-execute}" |
There was a problem hiding this comment.
The repository style guide requires declaring local variables and assigning them on separate lines to ensure exit code safety. This pattern is not followed here and in most other functions in this file.
| local action_plan="$1" | |
| local repo_path="${2:-$REPO_PATH}" | |
| local mode="${3:-execute}" | |
| local action_plan; action_plan="$1" | |
| local repo_path; repo_path="${2:-$REPO_PATH}" | |
| local mode; mode="${3:-execute}" |
References
- Use
local var; var="$1"pattern in functions (declare and assign separately for exit code safety). (link)
| if ! [[ "$issue_number" =~ ^[0-9]+$ ]] || [[ "$issue_number" -eq 0 ]]; then | ||
| echo "issue_number must be a positive integer, got: $issue_number" | ||
| return 0 | ||
| fi |
There was a problem hiding this comment.
The validation logic for issue_number is duplicated in comment_on_issue, flag_for_review, close_verified, and request_info. This duplicated code could be extracted into a helper function to improve maintainability and reduce redundancy.
References
- In shell scripts, extract repeated logic into an internal helper function to improve maintainability.
|
|
||
| # Insert subtask lines after the insertion point | ||
| local temp_file | ||
| temp_file=$(mktemp) |
There was a problem hiding this comment.
This temporary file should have a trap for cleanup to prevent leaving orphaned files in /tmp on script exit or error. This is required by the repository style guide.
| temp_file=$(mktemp) | |
| temp_file=$(mktemp) | |
| trap 'rm -f "$temp_file"' RETURN |
References
- Temp files must have
trapcleanup (RETURN or EXIT). (link)
|
|
||
| # Step 1: Run reasoning to get action plan | ||
| local action_plan | ||
| action_plan=$(run_ai_reasoning "$repo_path" "$mode" 2>/dev/null) |
There was a problem hiding this comment.
Suppressing stderr with 2>/dev/null can hide important errors from the run_ai_reasoning function, making debugging difficult. The style guide only permits this when redirecting to a log file. It would be better to redirect stderr to the supervisor's log file.
| action_plan=$(run_ai_reasoning "$repo_path" "$mode" 2>/dev/null) | |
| action_plan=$(run_ai_reasoning "$repo_path" "$mode" 2>>"$SUPERVISOR_LOG") |
References
2>/dev/nullis acceptable ONLY when redirecting to log files, not blanket suppression. (link)



Summary
supervisor/ai-actions.sh— the action executor for the AI supervisor reasoning engine (t1085.2 output → t1085.3 execution)comment_on_issue,create_task,create_subtasks,flag_for_review,adjust_priority,close_verified,request_infosupervisor-helper.shwithai-actionsandai-pipelineCLI commandsAction Types
comment_on_issuecreate_taskcreate_subtasksflag_for_reviewadjust_priorityclose_verifiedrequest_infoSafety Features
close_verifiedrequires proof of merged PR with actual file changes~/.aidevops/logs/ai-supervisor/Ref #1602