fix(ci): gate-check-v3 fails on every PR — token lacks write:repository, --post-comment 403s #543

Closed
opened 2026-05-11 18:57:50 +00:00 by claude-ceo-assistant · 0 comments
Owner

Symptom (reproduces on every PR)

gate-check-v3 / gate-check (pull_request) reports Failing after 27s on:

  • molecule-core#535 (head e922351b and updated)
  • molecule-core#536 (head b95a20bb and updated)
  • — confirmed by hongming-pc 2026-05-11 18:51Z as reproducing on multiple PRs

Root cause (sub-agent diagnosis, comment 12357 on #535)

Run log: tools/gate-check-v3/gate_check.py:514 (in run(), AFTER the verdict JSON CI_PENDING was emitted) dies with:

urllib.error.HTTPError: HTTP Error 403: Forbidden

Most likely the --post-comment POST call. The token (likely SOP_TIER_CHECK_TOKEN or the workflow-default) lacks write:repository scope required to comment on issues. This is the same class as internal#321 defect #2.

Why it matters

If gate-check-v3 / gate-check is (or becomes) a required status check, it blocks every PR merge across the merge-queue. Currently it's NOT in status_check_contexts on main (verified: only Secret scan + sop-tier-check required), so merges aren't blocked TODAY — but the red is noise that obscures real findings + signals broken CI hygiene.

Fix options (pick ONE)

Option A (preferred — keep least-privilege): make the script exit 0 if the VERDICT was OK even when the --post-comment POST 403s. The comment is informational; the job's conclusion IS the status. Same logic as RFC#324 A1-α's job-conclusion-status approach. Sidesteps needing write:repository entirely.

Pseudo-diff in tools/gate-check-v3/gate_check.py:

try:
    post_pr_comment(pr, body)
except urllib.error.HTTPError as e:
    if e.code == 403:
        print(f'WARN: --post-comment 403 (token scope) — verdict={verdict}; skipping comment-post', file=sys.stderr)
    else:
        raise

Exit code derives from the verdict, not the comment-post success.

Option B: give SOP_TIER_CHECK_TOKEN write:repository scope. But — we're retiring SOP_TIER_CHECK_TOKEN entirely per RFC#324 Step 4 (Remove SOP_TIER_CHECK_TOKEN from secret store after final delete PR merges), so this is throwaway work.

Option C: route through safe_curl / -K stdin pattern (per molecule-core#541 — defense-in-depth for RFC_324_TEAM_READ_TOKEN). Orthogonal to the scope issue — doesn't fix the 403 by itself.

Recommendation: Option A

  • One-line try/except in the comment-post path
  • No token-scope change (compatible with SOP_TIER_CHECK_TOKEN's upcoming retirement)
  • Comments still post when token IS scoped (no regression for properly-configured deployments)

Tier

tier:medium — currently noise (not a required check) but obscuring real CI findings + would become a merge-blocker if added to status_check_contexts.

Cross-links

  • molecule-core#535 + #536 — reproducing PRs
  • molecule-core#541 — related token-handling discipline (safe_curl for argv-exposed tokens)
  • internal#321 — sibling token-scope class (sop-tier-refire defect #2)
  • internal#324 — RFC retiring SOP_TIER_CHECK_TOKEN; this PR's fix should land BEFORE SOP_TIER_CHECK_TOKEN is removed

— filed by claude-ceo-assistant per hongming-pc directive 2026-05-11 18:51Z ("reproduces — warrants filing now, not 'if reproduces'")

## Symptom (reproduces on every PR) `gate-check-v3 / gate-check (pull_request)` reports `Failing after 27s` on: - molecule-core#535 (head `e922351b` and updated) - molecule-core#536 (head `b95a20bb` and updated) - — confirmed by hongming-pc 2026-05-11 18:51Z as reproducing on multiple PRs ## Root cause (sub-agent diagnosis, comment 12357 on #535) Run log: `tools/gate-check-v3/gate_check.py:514` (in `run()`, AFTER the verdict JSON `CI_PENDING` was emitted) dies with: ``` urllib.error.HTTPError: HTTP Error 403: Forbidden ``` Most likely the `--post-comment` POST call. The token (likely `SOP_TIER_CHECK_TOKEN` or the workflow-default) lacks `write:repository` scope required to comment on issues. This is the same class as internal#321 defect #2. ## Why it matters If `gate-check-v3 / gate-check` is (or becomes) a required status check, it blocks every PR merge across the merge-queue. Currently it's NOT in `status_check_contexts` on `main` (verified: only `Secret scan` + `sop-tier-check` required), so merges aren't blocked TODAY — but the red is noise that obscures real findings + signals broken CI hygiene. ## Fix options (pick ONE) **Option A (preferred — keep least-privilege):** make the script `exit 0` if the VERDICT was OK even when the `--post-comment` POST 403s. The comment is informational; the job's conclusion IS the status. Same logic as RFC#324 A1-α's job-conclusion-status approach. Sidesteps needing `write:repository` entirely. Pseudo-diff in `tools/gate-check-v3/gate_check.py`: ```python try: post_pr_comment(pr, body) except urllib.error.HTTPError as e: if e.code == 403: print(f'WARN: --post-comment 403 (token scope) — verdict={verdict}; skipping comment-post', file=sys.stderr) else: raise ``` Exit code derives from the verdict, not the comment-post success. **Option B:** give `SOP_TIER_CHECK_TOKEN` `write:repository` scope. But — we're retiring SOP_TIER_CHECK_TOKEN entirely per RFC#324 Step 4 (`Remove SOP_TIER_CHECK_TOKEN from secret store after final delete PR merges`), so this is throwaway work. **Option C:** route through `safe_curl` / `-K` stdin pattern (per molecule-core#541 — defense-in-depth for RFC_324_TEAM_READ_TOKEN). Orthogonal to the scope issue — doesn't fix the 403 by itself. ## Recommendation: Option A - One-line `try/except` in the comment-post path - No token-scope change (compatible with `SOP_TIER_CHECK_TOKEN`'s upcoming retirement) - Comments still post when token IS scoped (no regression for properly-configured deployments) ## Tier `tier:medium` — currently noise (not a required check) but obscuring real CI findings + would become a merge-blocker if added to `status_check_contexts`. ## Cross-links - molecule-core#535 + #536 — reproducing PRs - molecule-core#541 — related token-handling discipline (`safe_curl` for argv-exposed tokens) - internal#321 — sibling token-scope class (sop-tier-refire defect #2) - internal#324 — RFC retiring SOP_TIER_CHECK_TOKEN; this PR's fix should land BEFORE SOP_TIER_CHECK_TOKEN is removed — filed by claude-ceo-assistant per hongming-pc directive 2026-05-11 18:51Z ("reproduces — warrants filing now, not 'if reproduces'")
claude-ceo-assistant added the securitytier:medium labels 2026-05-11 18:57:51 +00:00
core-devops self-assigned this 2026-05-11 19:08:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#543