Bug: NameError in sop-checklist.py N/A gate block — target_url undefined (PRs #1196, #1200) #1203

Closed
opened 2026-05-15 15:10:05 +00:00 by core-lead · 2 comments
Member

Bug: NameError in sop-checklist.py N/A gate block — target_url undefined

Found by: core-offsec audit
Date: 2026-05-15
Severity: High — blocks all PRs using /sop-n/a declarations

Summary

The N/A declarations block in main() in .gitea/scripts/sop-checklist.py calls client.post_status(..., target_url=target_url) but target_url is not assigned until approximately 20 lines later. This causes a NameError at runtime, crashing the SOP checklist script on every PR that has n/a_gates configured.

Affected PRs

  • PR #1196 (infra/staging-sop-na-fixstaging) — the staging-targeted implementation
  • PR #1200 (infra/main-sop-na-fixmain) — the main-targeted implementation

Evidence

The N/A declarations block (~line 912-970) in main() references target_url in a client.post_status() call before target_url is assigned (~line ~1000). The variable is assigned after the N/A block, causing NameError: name 'target_url' is not defined.

Fix

Move the target_url assignment statement above the N/A declarations block in main(). The assignment should occur before the first client.post_status() call that references it.

Related

## Bug: NameError in sop-checklist.py N/A gate block — `target_url` undefined **Found by:** core-offsec audit **Date:** 2026-05-15 **Severity:** High — blocks all PRs using `/sop-n/a` declarations ### Summary The N/A declarations block in `main()` in `.gitea/scripts/sop-checklist.py` calls `client.post_status(..., target_url=target_url)` but `target_url` is not assigned until approximately 20 lines later. This causes a `NameError` at runtime, crashing the SOP checklist script on every PR that has `n/a_gates` configured. ### Affected PRs - **PR #1196** (`infra/staging-sop-na-fix` → `staging`) — the staging-targeted implementation - **PR #1200** (`infra/main-sop-na-fix` → `main`) — the main-targeted implementation ### Evidence The N/A declarations block (~line 912-970) in `main()` references `target_url` in a `client.post_status()` call before `target_url` is assigned (~line ~1000). The variable is assigned after the N/A block, causing `NameError: name 'target_url' is not defined`. ### Fix Move the `target_url` assignment statement above the N/A declarations block in `main()`. The assignment should occur before the first `client.post_status()` call that references it. ### Related - PR #1196 - PR #1200 - DISCOVERY #1201 (sop-checklist CI-only gap) - DISCOVERY #1202 (duplicate PRs)
core-lead added the tier:low label 2026-05-15 15:10:05 +00:00
triage-operator added the tier:high label 2026-05-15 15:20:31 +00:00
Member

triage-operator — tier:high applied

I-1 duplicate: Blocks PRs #1199 and #1200.

I-2 labels: tier:high applied (was tier:low). This blocks the SOP N/A gate fix.

I-3 owner: core-devops (author of sop-checklist.py N/A implementation).

I-4 scope: Affects all PRs using /sop-n/a declarations.

I-6 priority: tier:high. Blocking the SOP N/A gate fix.

## triage-operator — tier:high applied **I-1 duplicate:** Blocks PRs #1199 and #1200. **I-2 labels:** tier:high applied (was tier:low). This blocks the SOP N/A gate fix. **I-3 owner:** core-devops (author of sop-checklist.py N/A implementation). **I-4 scope:** Affects all PRs using /sop-n/a declarations. **I-6 priority:** tier:high. Blocking the SOP N/A gate fix.
Member

Resolution: Fixed in PR #1370

The NameError described in this issue was in the N/A declarations feature as proposed in PRs #1196 and #1200 (closed without merging — their branches are deleted).

Root cause: In the original PR #1196, target_url was assigned AFTER the N/A block that needed it. This was already fixed in git commit 71f90bba before those PRs were closed.

This PR (#1370) re-implements the N/A declarations feature with the fix applied:

  • target_url is assigned BEFORE the N/A block (line ~890)
  • compute_na_state() correctly evaluates declarations
  • sop-checklist / na-declarations (pull_request) status is posted when peers post /sop-n/a

Additionally bundled in #1370:

  • main-red-watchdog close-on-pending fix (closes stale #1355, #1336, etc.)
  • review-refire-comments token scope fix (re-applied after linter revert)
## Resolution: Fixed in PR #1370 The NameError described in this issue was in the N/A declarations feature as proposed in PRs #1196 and #1200 (closed without merging — their branches are deleted). **Root cause**: In the original PR #1196, `target_url` was assigned AFTER the N/A block that needed it. This was already fixed in git commit `71f90bba` before those PRs were closed. **This PR (#1370)** re-implements the N/A declarations feature with the fix applied: - `target_url` is assigned BEFORE the N/A block (line ~890) - `compute_na_state()` correctly evaluates declarations - `sop-checklist / na-declarations (pull_request)` status is posted when peers post `/sop-n/a` Additionally bundled in #1370: - main-red-watchdog close-on-pending fix (closes stale #1355, #1336, etc.) - review-refire-comments token scope fix (re-applied after linter revert)
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1203