fix(ci): gate-check-v3 crashes on HTTPError during comment posting #548

Closed
core-devops wants to merge 1 commits from fix/gate-check-v3-http-error-crash into main
Member

Summary

  • Wrap the comment-posting section of run() in tools/gate-check-v3/gate_check.py with try/except urllib.error.HTTPError
  • When the token lacks write:repository (403 from Gitea on POST/PATCH comments), the error is now caught, a warning is printed to stderr, and the function returns the already-computed result instead of crashing
  • The verdict (CLEAR/BLOCKED/ERROR) is unaffected — comment posting is best-effort

Root cause

urllib.error.HTTPError is NOT a subclass of GiteaError. The outer except GiteaError block catches API errors during gate computation, but the direct urllib.request.urlopen() calls for comment POST/PATCH were not wrapped. A 403 (token lacks write:repository) would raise HTTPError and propagate as an unhandled exception, causing the script to exit non-zero.

Test plan

  • Verify script still exits 0 for CLEAR verdict when token lacks write:repository (warning printed, no crash)
  • Verify script exits 1 for BLOCKED verdict (correct) when token lacks write:repository
  • Existing gate-check-v3 runs in CI (with the token that has write:repository) are unaffected

🤖 Generated with Claude Code

## Summary - Wrap the comment-posting section of `run()` in `tools/gate-check-v3/gate_check.py` with `try/except urllib.error.HTTPError` - When the token lacks `write:repository` (403 from Gitea on POST/PATCH comments), the error is now caught, a warning is printed to stderr, and the function returns the already-computed result instead of crashing - The verdict (CLEAR/BLOCKED/ERROR) is unaffected — comment posting is best-effort ## Root cause `urllib.error.HTTPError` is NOT a subclass of `GiteaError`. The outer `except GiteaError` block catches API errors during gate computation, but the direct `urllib.request.urlopen()` calls for comment POST/PATCH were not wrapped. A 403 (token lacks write:repository) would raise `HTTPError` and propagate as an unhandled exception, causing the script to exit non-zero. ## Test plan - [ ] Verify script still exits 0 for CLEAR verdict when token lacks write:repository (warning printed, no crash) - [ ] Verify script exits 1 for BLOCKED verdict (correct) when token lacks write:repository - [ ] Existing gate-check-v3 runs in CI (with the token that has write:repository) are unaffected 🤖 Generated with [Claude Code](https://claude.ai/code)
core-devops added 1 commit 2026-05-11 19:09:23 +00:00
fix(ci): catch urllib.error.HTTPError in gate-check-v3 comment posting
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 18s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 16s
gate-check-v3 / gate-check (pull_request) Failing after 21s
qa-review / approved (pull_request) Failing after 15s
security-review / approved (pull_request) Failing after 19s
sop-tier-check / tier-check (pull_request) Successful in 18s
CI / Detect changes (pull_request) Successful in 1m11s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m11s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m7s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m6s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m13s
CI / Platform (Go) (pull_request) Successful in 9s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 9s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 8s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 9s
CI / Python Lint & Test (pull_request) Successful in 11s
CI / Canvas (Next.js) (pull_request) Successful in 11s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 11s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 15s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
audit-force-merge / audit (pull_request) Has been skipped
f0f9d44fde
HttpError (e.g. 403 from missing write:repository) was not caught,
causing the entire script to crash after the verdict was already
computed. Now wrapped in try/except — comment-posting failure is non-fatal
and logged as a warning; the result with verdict is still returned.

Fixes: #543
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
core-devops closed this pull request 2026-05-11 19:15:45 +00:00
Some checks are pending
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 18s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 16s
gate-check-v3 / gate-check (pull_request) Failing after 21s
qa-review / approved (pull_request) Failing after 15s
security-review / approved (pull_request) Failing after 19s
sop-tier-check / tier-check (pull_request) Successful in 18s
CI / Detect changes (pull_request) Successful in 1m11s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m11s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m7s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m6s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m13s
CI / Platform (Go) (pull_request) Successful in 9s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 9s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 8s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 9s
CI / Python Lint & Test (pull_request) Successful in 11s
CI / Canvas (Next.js) (pull_request) Successful in 11s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 11s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 15s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
audit-force-merge / audit (pull_request) Has been skipped
CI / all-required (pull_request)
Required

Pull request closed

Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#548