Skip to content

Commit ead7d64

Browse files
authored
fix: surface apply health on dashboard (#391)
Adds apply-health telemetry and an actionable, quiet-by-default dashboard alert for stalled or fully blocked pruning windows. Reworked cursor requirements and result classification against the current 128-worker scheduler/apply baseline. Validated with focused tests, full coverage, structured AutoReview, exact-head CI, and production Worker smoke/live browser proof. Co-authored-by: brokemac79 <[email protected]>
1 parent 1343d8e commit ead7d64

12 files changed

Lines changed: 1025 additions & 7 deletions

File tree

‎.github/workflows/sweep.yml‎

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,6 +2326,28 @@ jobs:
23262326
git restore results/sweep-status || true
23272327
fi
23282328
}
2329+
write_apply_health() {
2330+
report_path="$1"
2331+
output_path="$2"
2332+
health_mode="$3"
2333+
health_processed_limit="$4"
2334+
health_cursor_path="${5:-}"
2335+
health_cursor_required="${6:-false}"
2336+
health_args=(
2337+
--target-repo "$TARGET_REPO"
2338+
--report "$report_path"
2339+
--mode "$health_mode"
2340+
--processed-limit "$health_processed_limit"
2341+
--close-limit "$limit"
2342+
)
2343+
if [ -n "$health_cursor_path" ]; then
2344+
health_args+=(--cursor-path "$health_cursor_path")
2345+
fi
2346+
if [ "$health_cursor_required" = "true" ]; then
2347+
health_args+=(--cursor-required true)
2348+
fi
2349+
pnpm run --silent workflow -- summarize-apply-report "${health_args[@]}" > "$output_path"
2350+
}
23292351
reconcile_args=(--target-repo "$TARGET_REPO" --skip-closed-at)
23302352
if [ -n "$item_numbers" ]; then
23312353
reconcile_args+=(--item-numbers "$item_numbers")
@@ -2396,6 +2418,12 @@ jobs:
23962418
fi
23972419
if [ "$sync_comments_only" != "true" ] && [ -z "$item_numbers" ]; then
23982420
echo "No unchanged high-confidence close proposals are awaiting apply. Scheduled apply wakes every 15 minutes and exits without scanning unrelated keep-open records when there is no close work."
2421+
pnpm run status -- \
2422+
--target-repo "$TARGET_REPO" \
2423+
--state "Apply idle" \
2424+
--detail "No unchanged high-confidence close proposals are awaiting apply. Scheduled apply wakes every 15 minutes and exits without scanning unrelated keep-open records when there is no close work." \
2425+
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
2426+
publish_status "chore: update idle sweep apply status"
23992427
{
24002428
echo "APPLY_CLOSED_TOTAL=0"
24012429
echo "APPLY_LIMIT=1"
@@ -2455,11 +2483,21 @@ jobs:
24552483
--target-repo "$TARGET_REPO"
24562484
fi
24572485
publish_changes "chore: sync sweep review comments checkpoint $checkpoint" records apply-report.json results/comment-sync-cursors
2486+
comment_sync_health_cursor_path=""
2487+
comment_sync_health_cursor_required="false"
2488+
comment_sync_health_processed_limit="$comment_sync_processed_limit"
2489+
if [ "$sync_open_pr_batch" = "true" ]; then
2490+
comment_sync_health_cursor_path="$cursor_path"
2491+
comment_sync_health_cursor_required="true"
2492+
comment_sync_health_processed_limit="$sync_batch_size"
2493+
fi
2494+
write_apply_health ".artifacts/apply-reports/apply-report-$checkpoint.json" ".artifacts/apply-health-$checkpoint.json" "comment_sync" "$comment_sync_health_processed_limit" "$comment_sync_health_cursor_path" "$comment_sync_health_cursor_required"
24582495
pnpm run status -- \
24592496
--target-repo "$TARGET_REPO" \
24602497
--state "Apply comments synced" \
24612498
--detail "Comment-only apply checkpoint $checkpoint finished. Synced durable review comments: $synced_count. Result records: $result_count. Item numbers: ${item_numbers:-all}. Next cursor: ${next_cursor:-none}." \
2462-
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
2499+
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
2500+
--apply-health-file ".artifacts/apply-health-$checkpoint.json"
24632501
publish_status "chore: update sweep comment sync status"
24642502
echo "::endgroup::"
24652503
fi
@@ -2506,11 +2544,17 @@ jobs:
25062544
apply_publish_paths+=(results/apply-cursors)
25072545
fi
25082546
publish_changes "chore: apply sweep decisions checkpoint $checkpoint" "${apply_publish_paths[@]}"
2547+
close_health_cursor_path=""
2548+
if [ "$auto_selected_apply_batch" = "true" ]; then
2549+
close_health_cursor_path="$apply_cursor_path"
2550+
fi
2551+
write_apply_health ".artifacts/apply-reports/apply-report-$checkpoint.json" ".artifacts/apply-health-$checkpoint.json" "close" "$close_processed_limit" "$close_health_cursor_path" "$auto_selected_apply_batch"
25092552
pnpm run status -- \
25102553
--target-repo "$TARGET_REPO" \
25112554
--state "Apply in progress" \
25122555
--detail "Checkpoint $checkpoint finished. Fresh closes in checkpoint: $closed_in_chunk. Total fresh closes in this run: $closed_total/$limit. Result records in checkpoint: $result_count, including durable review comment syncs." \
2513-
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
2556+
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
2557+
--apply-health-file ".artifacts/apply-health-$checkpoint.json"
25142558
publish_status "chore: update sweep apply checkpoint $checkpoint status"
25152559
echo "::endgroup::"
25162560
if [ "$result_count" -ge "$close_processed_limit" ]; then
@@ -2535,11 +2579,30 @@ jobs:
25352579
continue_apply=true
25362580
break
25372581
done
2582+
final_health_mode="close"
2583+
final_health_processed_limit="$close_processed_limit"
2584+
final_health_cursor_path=""
2585+
final_health_cursor_required="$auto_selected_apply_batch"
2586+
if [ "$auto_selected_apply_batch" = "true" ]; then
2587+
final_health_cursor_path="$apply_cursor_path"
2588+
fi
2589+
if [ "$sync_comments_only" = "true" ]; then
2590+
final_health_mode="comment_sync"
2591+
final_health_processed_limit="$comment_sync_processed_limit"
2592+
final_health_cursor_required="false"
2593+
if [ "$sync_open_pr_batch" = "true" ]; then
2594+
final_health_cursor_path="$cursor_path"
2595+
final_health_cursor_required="true"
2596+
final_health_processed_limit="$sync_batch_size"
2597+
fi
2598+
fi
2599+
write_apply_health "apply-report.json" ".artifacts/apply-health-final.json" "$final_health_mode" "$final_health_processed_limit" "$final_health_cursor_path" "$final_health_cursor_required"
25382600
pnpm run status -- \
25392601
--target-repo "$TARGET_REPO" \
25402602
--state "Apply finished" \
25412603
--detail "Apply/comment-sync run finished with $closed_total fresh closes out of requested limit $limit. See apply-report.json for per-item results." \
2542-
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
2604+
--run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
2605+
--apply-health-file ".artifacts/apply-health-final.json"
25432606
publish_status "chore: mark sweep apply finished"
25442607
next_apply_item_numbers="$item_numbers"
25452608
if [ "$auto_selected_apply_batch" = "true" ] && [ -z "$explicit_item_numbers" ]; then

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ checkpoint, and status-only commits are intentionally omitted.
99

1010
### Added
1111

12+
- Added apply-health telemetry and a quiet-by-default dashboard alert for stalled, cursorless, or fully blocked pruning windows. Thanks @brokemac79.
1213
- Added author-wide PR repair intake across configured public repositories, with private and unsupported repositories excluded before job generation. Thanks @Jhacarreiro.
1314
- Added a system, light, and dark theme switcher to the generated documentation site. Thanks @joshka.
1415

0 commit comments

Comments
 (0)