Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .agents/scripts/supervisor/pulse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,27 @@ cmd_pulse() {
fi

if [[ "$should_reconcile" == "true" ]] && command -v gh &>/dev/null; then
# Two queries: (1) cancelled/failed are always safe to close,
# (2) deployed/verified only if they have a real PR (not no_pr/task_only/empty).
# This prevents closing issues for false completions from the no_pr cascade.
local terminal_tasks
terminal_tasks=$(db "$SUPERVISOR_DB" "
SELECT id, status, repo FROM tasks
WHERE status IN ('cancelled', 'failed', 'verified', 'deployed')
AND id IN (
WHERE (
status IN ('cancelled', 'failed')
OR (
status IN ('verified', 'deployed')
AND pr_url IS NOT NULL
AND pr_url != ''
AND pr_url != 'no_pr'
AND pr_url != 'task_only'
AND pr_url != 'verified_complete'
Comment on lines +541 to +545

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and conciseness, you can combine the multiple pr_url checks into a single NOT IN clause. The explicit IS NOT NULL check is also redundant, as NOT IN will not match NULL values, achieving the same result more compactly.

Suggested change
AND pr_url IS NOT NULL
AND pr_url != ''
AND pr_url != 'no_pr'
AND pr_url != 'task_only'
AND pr_url != 'verified_complete'
AND pr_url NOT IN ('', 'no_pr', 'task_only', 'verified_complete')

)
)
AND id IN (
SELECT DISTINCT task_id FROM state_log
WHERE timestamp > datetime('now', '-7 days')
)
)
;" 2>/dev/null || echo "")

if [[ -n "$terminal_tasks" ]]; then
Expand Down
Loading