Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .agents/scripts/supervisor/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ dismiss_bot_reviews() {

# Find bot reviews with CHANGES_REQUESTED state
local bot_reviews
bot_reviews=$(echo "$reviews_json" | jq -r '.[] | select(.state == "CHANGES_REQUESTED" and (.user.login == "coderabbitai" or .user.login == "gemini-code-assist[bot]")) | .id' 2>/dev/null || echo "")
bot_reviews=$(echo "$reviews_json" | jq -r '.[] | select(.state == "CHANGES_REQUESTED" and (.user.login | test("^(coderabbitai|gemini-code-assist|copilot)"))) | .id' 2>/dev/null || echo "")

if [[ -z "$bot_reviews" ]]; then
log_debug "dismiss_bot_reviews: no blocking bot reviews found for PR #${pr_number}"
Expand Down
47 changes: 35 additions & 12 deletions .agents/scripts/supervisor/pulse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -598,18 +598,41 @@ cmd_pulse() {
# verify_failed: PR was already merged and deployed, but
# post-merge verification failed. Put back to 'deployed'
# so Phase 3b (verify queue) can re-run verification.
# Do NOT mark complete — the quality check still needs to pass.
log_info " Phase 3b2: $stale_id (verify_failed) — PR #$pr_number merged, resetting to deployed for re-verification"
db "$SUPERVISOR_DB" "UPDATE tasks SET
status = 'deployed',
error = NULL,
updated_at = strftime('%Y-%m-%dT%H:%M:%SZ','now')
WHERE id = '$escaped_stale_id';" 2>/dev/null || true
db "$SUPERVISOR_DB" "INSERT INTO state_log (task_id, from_state, to_state, timestamp, reason)
VALUES ('$escaped_stale_id', 'verify_failed', 'deployed',
strftime('%Y-%m-%dT%H:%M:%SZ','now'),
'Phase 3b2: reset for re-verification (PR #$pr_number merged)');" 2>/dev/null || true
sync_issue_status_label "$stale_id" "deployed" "phase_3b2" 2>>"$SUPERVISOR_LOG" || true
# Cap retries to prevent infinite deployed→verify_failed loop (t1075).
local verify_reset_count
verify_reset_count=$(db "$SUPERVISOR_DB" "
SELECT COUNT(*) FROM state_log
WHERE task_id = '$escaped_stale_id'
AND from_state = 'verify_failed'
AND to_state = 'deployed';" 2>/dev/null || echo "0")
local max_verify_retries=3
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For better maintainability and clarity, it's best to define magic numbers like 3 as a script-level constant. Since this requires a change outside the diff, I can't provide a direct suggestion, but please consider defining readonly MAX_VERIFY_RETRIES=3 at the top of the script and using $MAX_VERIFY_RETRIES here. This also aligns with the style guide's naming convention for constants (line 39).

References
  1. The style guide at line 39 specifies that constants should use UPPER_SNAKE_CASE. (link)


if [[ "$verify_reset_count" -ge "$max_verify_retries" ]]; then
# Exhausted verification retries — mark permanently failed
log_error " Phase 3b2: $stale_id exhausted $max_verify_retries verification retries — marking failed"
db "$SUPERVISOR_DB" "UPDATE tasks SET
status = 'failed',
error = 'Verification failed after $max_verify_retries retries — manual fix needed',
updated_at = strftime('%Y-%m-%dT%H:%M:%SZ','now')
WHERE id = '$escaped_stale_id';" 2>/dev/null || true
db "$SUPERVISOR_DB" "INSERT INTO state_log (task_id, from_state, to_state, timestamp, reason)
VALUES ('$escaped_stale_id', 'verify_failed', 'failed',
strftime('%Y-%m-%dT%H:%M:%SZ','now'),
'Phase 3b2: verification exhausted ($verify_reset_count/$max_verify_retries retries)');" 2>/dev/null || true
sync_issue_status_label "$stale_id" "failed" "phase_3b2" 2>>"$SUPERVISOR_LOG" || true
else
log_info " Phase 3b2: $stale_id (verify_failed) — PR #$pr_number merged, resetting to deployed for re-verification (attempt $((verify_reset_count + 1))/$max_verify_retries)"
db "$SUPERVISOR_DB" "UPDATE tasks SET
status = 'deployed',
error = NULL,
updated_at = strftime('%Y-%m-%dT%H:%M:%SZ','now')
WHERE id = '$escaped_stale_id';" 2>/dev/null || true
db "$SUPERVISOR_DB" "INSERT INTO state_log (task_id, from_state, to_state, timestamp, reason)
VALUES ('$escaped_stale_id', 'verify_failed', 'deployed',
strftime('%Y-%m-%dT%H:%M:%SZ','now'),
'Phase 3b2: reset for re-verification attempt $((verify_reset_count + 1))/$max_verify_retries (PR #$pr_number merged)');" 2>/dev/null || true
sync_issue_status_label "$stale_id" "deployed" "phase_3b2" 2>>"$SUPERVISOR_LOG" || true
fi
Comment on lines +613 to +635
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The style guide (line 50) states that 2>/dev/null should only be used when redirecting to log files, not for blanket suppression. The db calls in this block use this pattern. To improve debuggability and adhere to the style guide, please redirect stderr to $SUPERVISOR_LOG instead (e.g., ... 2>>"$SUPERVISOR_LOG" || true).

References
  1. The style guide at line 50 states that 2>/dev/null is only acceptable when redirecting to log files, not for blanket error suppression. (link)

else
# blocked: PR merged but task stuck in blocked state.
# Advance to deployed and mark complete.
Expand Down
29 changes: 29 additions & 0 deletions .agents/scripts/supervisor/todo-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,35 @@ process_verify_queue() {

ensure_db

# Recover tasks stuck in 'verifying' state (t1075)
# If a pulse crashes mid-verification, tasks stay in 'verifying' forever.
# Reset any task that has been in 'verifying' for more than 5 minutes back to 'deployed'.
local stuck_verifying
stuck_verifying=$(db -separator '|' "$SUPERVISOR_DB" "
SELECT id FROM tasks
WHERE status = 'verifying'
AND updated_at < strftime('%Y-%m-%dT%H:%M:%SZ', 'now', '-5 minutes')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The timeout value '5 minutes' is a magic number. For better maintainability, please define it as a script-level constant, e.g., readonly STUCK_VERIFYING_TIMEOUT_MINUTES=5, and use the variable in the query. This makes the timeout policy easier to find and adjust.

ORDER BY id;
" 2>/dev/null || echo "")

if [[ -n "$stuck_verifying" ]]; then
while IFS='|' read -r stuck_id; do
[[ -z "$stuck_id" ]] && continue
log_warn " $stuck_id: stuck in 'verifying' for >5min — resetting to 'deployed'"
local escaped_stuck_id
escaped_stuck_id=$(sql_escape "$stuck_id")
db "$SUPERVISOR_DB" "UPDATE tasks SET
status = 'deployed',
error = NULL,
updated_at = strftime('%Y-%m-%dT%H:%M:%SZ','now')
WHERE id = '$escaped_stuck_id';" 2>/dev/null || true
db "$SUPERVISOR_DB" "INSERT INTO state_log (task_id, from_state, to_state, timestamp, reason)
VALUES ('$escaped_stuck_id', 'verifying', 'deployed',
strftime('%Y-%m-%dT%H:%M:%SZ','now'),
'process_verify_queue: recovered from stuck verifying state (>5min timeout)');" 2>/dev/null || true
Comment on lines +320 to +341
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The style guide (line 50) states that 2>/dev/null should only be used when redirecting to log files, not for blanket suppression. The db calls in this block (lines 320, 333, and 338) use this pattern. To improve debuggability and adhere to the style guide, please redirect stderr to $SUPERVISOR_LOG instead (e.g., ... 2>>"$SUPERVISOR_LOG" || true).

References
  1. The style guide at line 50 states that 2>/dev/null is only acceptable when redirecting to log files, not for blanket error suppression. (link)

done <<<"$stuck_verifying"
fi

# Find deployed tasks that need verification
local deployed_tasks
local where_clause="t.status = 'deployed'"
Expand Down
1 change: 0 additions & 1 deletion .agents/scripts/tech-stack-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ init_log_file

# Common message constants
readonly HELP_SHOW_MESSAGE="Show this help"
readonly USAGE_COMMAND_OPTIONS="Usage: $0 [command] [options]"
readonly HELP_USAGE_INFO="Use '$0 help' for usage information"

# Cache constants
Expand Down
7 changes: 5 additions & 2 deletions .agents/subagent-index.toon
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pro,gemini-2.5-pro,Capable large context
grok,grok-3,Research and real-time web knowledge
-->

<!--TOON:subagents[48]{folder,purpose,key_files}:
<!--TOON:subagents[50]{folder,purpose,key_files}:
aidevops/,Framework internals - extending aidevops and architecture and plugins,setup|architecture|troubleshooting|self-improving-agents|claude-flow-comparison|plugins
memory/,Cross-session memory - SQLite FTS5 storage,README
seo/,Search optimization - keywords and rankings and UX/CRO,dataforseo|serper|semrush|neuronwriter|google-search-console|gsc-sitemaps|site-crawler|eeat-score|analytics-tracking|bing-webmaster-tools|screaming-frog|rich-results|debug-opengraph|debug-favicon|contentking|programmatic-seo|schema-validator|content-analyzer|seo-optimizer|keyword-mapper|mom-test-ux
Expand Down Expand Up @@ -72,6 +72,8 @@ services/monitoring/,Error monitoring and debugging,sentry|socket
services/accounting/,Accounting integration - invoicing,quickfile
services/document-processing/,Document processing - LLM-powered extraction,unstract
tools/research/,Tech stack research - frontend technology detection providers,providers/unbuilt
tools/research/,Tech stack research - open-source technology explorer provider,providers/openexplorer
tools/research/,Tech stack research - Wappalyzer OSS technology detection provider,providers/wappalyzer
-->

<!--TOON:workflows[13]{name,file,purpose}:
Expand All @@ -90,7 +92,7 @@ feature-development,workflows/feature-development.md,Feature development workflo
conversation-starter,workflows/conversation-starter.md,Session greeting and auto-recall
-->

<!--TOON:scripts[79]{name,purpose}:
<!--TOON:scripts[80]{name,purpose}:
accessibility-helper.sh,Accessibility and contrast testing (WCAG compliance WAVE API for websites and emails)
accessibility-audit-helper.sh,Accessibility audit CLI wrapping axe-core WAVE API WebAIM contrast and Lighthouse a11y
auto-update-helper.sh,Automatic update polling daemon (enable disable status check logs)
Expand Down Expand Up @@ -176,6 +178,7 @@ comfy-cli-helper.sh,ComfyUI management via comfy-cli (status install setup launc
real-video-enhancer-helper.sh,REAL Video Enhancer CLI - AI video upscaling interpolation denoising and decompression (install enhance upscale interpolate denoise batch models backends gui)
runway-helper.sh,Runway API CLI for video image and audio generation (video image tts sts sfx dub isolate status wait cancel credits usage)
wavespeed-helper.sh,WaveSpeed AI REST API client - unified generation for 200+ models (generate status models upload balance usage)
wappalyzer-helper.sh,Wappalyzer OSS technology detection provider (detect lookup install status)
plugin-loader-helper.sh,Plugin agent loader - discover validate load unload agents hooks index status
claim-task-id.sh,Distributed task ID allocation with collision prevention (online GH/GL issue lock or offline +100 offset)
planning-commit-helper.sh,Planning file auto-commit helper (next-id complete commit check status)
Expand Down
Loading