fix(watch,review): role guard for start_watch_role + 406 diff-too-large fallback#217
Merged
ProtocolWarden merged 2 commits intoJun 2, 2026
Merged
Conversation
… loops `start_watch_role` had no validation for the role argument; any unknown role (e.g. "all") fell through to the board_worker.main else-branch with --role <unknown>, which argparse rejected with exit code 2. The bash wrapper then restarted the process every 30s indefinitely, producing a silent crash loop with no operational watcher. Added an explicit guard that emits a diagnostic and returns 1 immediately. Fixed a live crash loop (PID 590871, role="all", 333+ cycles, 5+ hours) that prior cycles misclassified as historical. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…file list Root cause: GitHub returns 406 when PR diff exceeds the API size limit. get_pr_diff() silently swallowed HTTPStatusError and returned "", causing the review watcher to log "empty diff" and skip the PR permanently. Fix: Detect 406 explicitly in get_pr_diff() and fall back to the files API (_pr_diff_too_large_summary), returning a file-list summary prefixed with [DIFF_TOO_LARGE]. The review watcher now logs a distinct warning and proceeds with the partial diff rather than skipping the PR entirely. Incidental: ruff-format alignment fixes inherited in both touched files. Affected repo: OperationsCenter Gate/check fixed: PR review watcher now processes large-diff PRs (#214) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two clean fixes cherry-picked onto main (649cf31), rebased from oc-watchdog/20260601-2155-fix-watch-role-guard:
start_watch_roleto prevent crash loops —scripts/operations-center.sh: adds validation guard; unknown roles now emit diagnostic and return 1 instead of restarting every 30s. Root cause:watch-allinvoked with role="all", ran crash loop 5+ hours (333+ restart cycles).get_pr_diff—github_pr.py: falls back to_pr_diff_too_large_summary()using files API when GitHub returns 406.pr_review_watcher/main.py: adds distinct WARNING log for oversized diffs to prevent "empty diff" misclassification.Custodian
0 findings (confirmed by pre-push hook).
Test plan
tests/unit/er000_phase0_golden/: 15/15 passedscripts/operations-center.sh watch-all-status: no role="all" crash loop🤖 Generated with Claude Code