-
Notifications
You must be signed in to change notification settings - Fork 11
fix: Phase 3 AI lifecycle completely broken — gather_task_state references non-existent worker_pid column #2275
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 |
|---|---|---|
|
|
@@ -52,19 +52,22 @@ gather_task_state() { | |
| escaped_id=$(sql_escape "$task_id") | ||
|
|
||
| # DB state | ||
| # Note: worker_pid column was removed in schema migration; use session_id instead. | ||
| # The query previously referenced worker_pid which caused silent SQLite errors, | ||
| # making gather_task_state return empty for ALL tasks and breaking Phase 3 entirely. | ||
| local task_row | ||
| task_row=$(db -separator '|' "$SUPERVISOR_DB" " | ||
| SELECT id, status, pr_url, repo, branch, worktree, error, | ||
| rebase_attempts, retries, max_retries, model, worker_pid | ||
| rebase_attempts, retries, max_retries, model, session_id | ||
| FROM tasks WHERE id = '$escaped_id'; | ||
| " 2>/dev/null || echo "") | ||
|
|
||
| if [[ -z "$task_row" ]]; then | ||
| return 1 | ||
| fi | ||
|
|
||
| local tid tstatus tpr trepo tbranch tworktree terror trebase tretries tmax_retries tmodel tpid | ||
| IFS='|' read -r tid tstatus tpr trepo tbranch tworktree terror trebase tretries tmax_retries tmodel tpid <<<"$task_row" | ||
| local tid tstatus tpr trepo tbranch tworktree terror trebase tretries tmax_retries tmodel tsession | ||
| IFS='|' read -r tid tstatus tpr trepo tbranch tworktree terror trebase tretries tmax_retries tmodel tsession <<<"$task_row" | ||
|
|
||
| # GitHub PR state (if PR exists) | ||
| local pr_state="none" pr_merge_state="none" pr_ci_summary="none" | ||
|
|
@@ -119,13 +122,16 @@ gather_task_state() { | |
| fi | ||
| fi | ||
|
|
||
| # Worker process state | ||
| # Worker process state — session_id replaces worker_pid after schema migration. | ||
| # We can check if a worker session is active by looking for the session's | ||
| # log file or checking if the status implies an active worker. | ||
| local worker_alive="unknown" | ||
| if [[ -n "$tpid" && "$tpid" != "0" ]]; then | ||
| if kill -0 "$tpid" 2>/dev/null; then | ||
| worker_alive="yes" | ||
| if [[ -n "$tsession" && "$tsession" != "0" && "$tsession" != "" ]]; then | ||
| # Session exists — check if the task is in an active-worker state | ||
| if [[ "$tstatus" == "running" || "$tstatus" == "dispatched" ]]; then | ||
|
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. The new Severity: medium 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| worker_alive="yes (session: ${tsession:0:12}...)" | ||
| else | ||
| worker_alive="no (PID $tpid dead)" | ||
| worker_alive="no (session ended)" | ||
| fi | ||
| else | ||
| worker_alive="no worker" | ||
|
|
||
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.
This fixes the
SELECT, but_dispatch_ai_workerlater still doesUPDATE tasks ... worker_pid = ...(with errors suppressed), which likely keeps worker state updates silently failing on the migrated schema. Consider aligning that path to writesession_id(and/or rely oncmd_transition --session) so lifecycle decisions don’t diverge from actual worker state.Severity: high
Other Locations
.agents/scripts/supervisor/ai-lifecycle.sh:684🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.