-
Notifications
You must be signed in to change notification settings - Fork 11
t299: Add Phase 10b to auto-create TODO tasks from quality findings #1171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10212,6 +10212,105 @@ cmd_pulse() { | |||||||||||||||||||||||||||||||||||||
| bash "$coderabbit_pulse_script" run --repo "$pulse_repo" --quiet 2>>"$SUPERVISOR_LOG" || true | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Phase 10b: Auto-create TODO tasks from quality findings (t299) | ||||||||||||||||||||||||||||||||||||||
| # Converts CodeRabbit and quality-sweep findings into actionable TODO tasks with #auto-dispatch. | ||||||||||||||||||||||||||||||||||||||
| # Self-throttles with 24h cooldown to avoid task spam. | ||||||||||||||||||||||||||||||||||||||
| local task_creation_cooldown=86400 # 24 hours in seconds | ||||||||||||||||||||||||||||||||||||||
| local task_creation_state_file="${SUPERVISOR_DIR}/last-task-creation.json" | ||||||||||||||||||||||||||||||||||||||
| local should_create_tasks=false | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Check cooldown | ||||||||||||||||||||||||||||||||||||||
| if [[ -f "$task_creation_state_file" ]]; then | ||||||||||||||||||||||||||||||||||||||
| local last_run | ||||||||||||||||||||||||||||||||||||||
| last_run=$(jq -r '.timestamp // 0' "$task_creation_state_file" 2>/dev/null || echo "0") | ||||||||||||||||||||||||||||||||||||||
| local now | ||||||||||||||||||||||||||||||||||||||
| now=$(date +%s) | ||||||||||||||||||||||||||||||||||||||
| local age=$((now - last_run)) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if [[ "$age" -ge "$task_creation_cooldown" ]]; then | ||||||||||||||||||||||||||||||||||||||
| should_create_tasks=true | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Phase 10b: Task creation cooldown expired (${age}s >= ${task_creation_cooldown}s)" | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| local remaining=$((task_creation_cooldown - age)) | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Phase 10b: Task creation cooldown active (${remaining}s remaining)" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||
| should_create_tasks=true | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Phase 10b: First task creation run" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if [[ "$should_create_tasks" == "true" ]]; then | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Phase 10b: Creating tasks from quality findings" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Get repo path for TODO.md | ||||||||||||||||||||||||||||||||||||||
| local pulse_repo="" | ||||||||||||||||||||||||||||||||||||||
| pulse_repo=$(db "$SUPERVISOR_DB" "SELECT DISTINCT repo FROM tasks LIMIT 1;" 2>/dev/null || echo "") | ||||||||||||||||||||||||||||||||||||||
| if [[ -z "$pulse_repo" ]]; then | ||||||||||||||||||||||||||||||||||||||
| pulse_repo="$(pwd)" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| local todo_file="${pulse_repo}/TODO.md" | ||||||||||||||||||||||||||||||||||||||
| local tasks_created=false | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Create tasks from CodeRabbit findings | ||||||||||||||||||||||||||||||||||||||
| local coderabbit_creator="${SCRIPT_DIR}/coderabbit-task-creator-helper.sh" | ||||||||||||||||||||||||||||||||||||||
| if [[ -x "$coderabbit_creator" ]]; then | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Converting CodeRabbit findings to tasks..." | ||||||||||||||||||||||||||||||||||||||
| local coderabbit_output | ||||||||||||||||||||||||||||||||||||||
| coderabbit_output=$("$coderabbit_creator" create 2>>"$SUPERVISOR_LOG" || true) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if [[ -n "$coderabbit_output" ]] && echo "$coderabbit_output" | grep -q "^- \[ \]"; then | ||||||||||||||||||||||||||||||||||||||
| # Append tasks to TODO.md | ||||||||||||||||||||||||||||||||||||||
| echo "" >> "$todo_file" | ||||||||||||||||||||||||||||||||||||||
| echo "$coderabbit_output" >> "$todo_file" | ||||||||||||||||||||||||||||||||||||||
| tasks_created=true | ||||||||||||||||||||||||||||||||||||||
| local task_count | ||||||||||||||||||||||||||||||||||||||
| task_count=$(echo "$coderabbit_output" | grep -c "^- \[ \]" || echo "0") | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Created $task_count tasks from CodeRabbit findings" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Create tasks from quality-sweep findings (SonarCloud, Codacy) | ||||||||||||||||||||||||||||||||||||||
| local finding_to_task="${SCRIPT_DIR}/finding-to-task-helper.sh" | ||||||||||||||||||||||||||||||||||||||
| if [[ -x "$finding_to_task" ]]; then | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Converting quality-sweep findings to tasks..." | ||||||||||||||||||||||||||||||||||||||
| local sweep_output | ||||||||||||||||||||||||||||||||||||||
| sweep_output=$("$finding_to_task" create --min-severity medium --limit 10 2>>"$SUPERVISOR_LOG" || true) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if [[ -n "$sweep_output" ]] && echo "$sweep_output" | grep -q "^- \[ \]"; then | ||||||||||||||||||||||||||||||||||||||
| # Append tasks to TODO.md | ||||||||||||||||||||||||||||||||||||||
| echo "" >> "$todo_file" | ||||||||||||||||||||||||||||||||||||||
| echo "$sweep_output" >> "$todo_file" | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10265
to
+10283
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section appends findings from external tools (like |
||||||||||||||||||||||||||||||||||||||
| tasks_created=true | ||||||||||||||||||||||||||||||||||||||
| local task_count | ||||||||||||||||||||||||||||||||||||||
| task_count=$(echo "$sweep_output" | grep -c "^- \[ \]" || echo "0") | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Created $task_count tasks from quality-sweep findings" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10280
to
+10288
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the CodeRabbit findings block, this block calls
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Commit and push TODO.md if tasks were created | ||||||||||||||||||||||||||||||||||||||
| if [[ "$tasks_created" == "true" ]]; then | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Committing and pushing TODO.md updates..." | ||||||||||||||||||||||||||||||||||||||
| ( | ||||||||||||||||||||||||||||||||||||||
| cd "$pulse_repo" || exit 1 | ||||||||||||||||||||||||||||||||||||||
| git add TODO.md 2>>"$SUPERVISOR_LOG" || true | ||||||||||||||||||||||||||||||||||||||
| git commit -m "chore: auto-create tasks from quality findings (t299)" 2>>"$SUPERVISOR_LOG" || true | ||||||||||||||||||||||||||||||||||||||
| git push 2>>"$SUPERVISOR_LOG" || true | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10294
to
+10299
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Update cooldown state | ||||||||||||||||||||||||||||||||||||||
| mkdir -p "$SUPERVISOR_DIR" | ||||||||||||||||||||||||||||||||||||||
| cat > "$task_creation_state_file" << EOF | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| "timestamp": $(date +%s), | ||||||||||||||||||||||||||||||||||||||
| "date": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", | ||||||||||||||||||||||||||||||||||||||
| "tasks_created": $tasks_created | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||
| log_verbose " Phase 10b: Task creation complete" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Phase 11: Supervisor session memory monitoring + respawn (t264, t264.1) | ||||||||||||||||||||||||||||||||||||||
| # OpenCode/Bun processes accumulate WebKit malloc dirty pages that are never | ||||||||||||||||||||||||||||||||||||||
| # returned to the OS. Over long sessions, a single process can grow to 25GB+. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
pulse_repovariable is retrieved directly from the database and used to construct thetodo_filepath without any validation or sanitization. An attacker who can influence thetaskstable in the database could potentially setrepoto an arbitrary path (e.g., using path traversal or pointing to sensitive directories), leading to an arbitrary file write (append) when findings are written toTODO.md. Since this framework usesTODO.mdfor autonomous task execution, this could be used to inject malicious tasks into other repositories or locations.