Skip to content

fix(opencode): break runner-capacity dispatch deadlock - #1823

Merged
seonghobae merged 1 commit into
mainfrom
codex/opencode-direct-dispatch-deadlock
Sep 4, 2026
Merged

fix(opencode): break runner-capacity dispatch deadlock#1823
seonghobae merged 1 commit into
mainfrom
codex/opencode-direct-dispatch-deadlock

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

문제

조직의 60개 동시 실행 슬롯이 Required OpenCode Review의 판정 polling job으로 모두 채워지면, 각 job이 먼저 queue에 넣은 merge-scheduler가 실행될 runner를 얻지 못합니다. 실제 opencode-review dispatch가 생성되지 않으므로 60개 job이 판정을 기다리며 3시간 동안 슬롯을 점유하는 자기 교착이 발생합니다.

2026-09-04 실측:

  • 조직 전체 in_progress: 정확히 60개
  • 중앙 .github queued: 1,911개
  • 다수의 Required OpenCode Review job이 Fail closed without a current-head OpenCode verdict 단계에서 실행 중

수정

required workflow가 이미 교환한 repository-scoped app token으로 기존 opencode-review default-branch dispatch를 직접 호출합니다. 대상 저장소, PR 번호, base/head ref와 SHA, 현재 required run ID를 기존 dispatch 계약 그대로 전달합니다. merge-scheduler 중간 hop만 제거하며 판정 polling, exact-head 검증, fail-closed 동작은 유지합니다.

검증

  • actionlint .github/workflows/opencode-review.yml
  • uv run pytest -q tests/test_required_workflow_queue_contract.py → 75 passed
  • git diff --check

운영 후속

이 PR이 main에 반영된 뒤 기존 60개 교착 run을 정리하고 현재 head에 필요한 required checks를 다시 실행해야 합니다. 이는 새 실행이 먼저 실제 review dispatch를 생성할 수 있게 runner 슬롯을 비우기 위한 닭-달걀 복구입니다.

Send the trusted opencode-review repository dispatch directly from the required workflow so sixty polling jobs cannot starve the scheduler that produces their verdicts.

Signed-off-by: Seongho Bae <me@seonghobae.me>

Commit-Message-Assisted-by: Claude (via Claude Code)
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: f73d049c-14a5-4ba9-803e-5e4f79d6b210

📥 Commits

Reviewing files that changed from the base of the PR and between 07d9ec2 and e41e1c5.

📒 Files selected for processing (2)
  • .github/workflows/opencode-review.yml
  • tests/test_required_workflow_queue_contract.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae merged commit 03a89c7 into main Sep 4, 2026
6 of 19 checks passed
@seonghobae
seonghobae deleted the codex/opencode-direct-dispatch-deadlock branch September 4, 2026 04:36
seonghobae added a commit that referenced this pull request Sep 4, 2026
)

Both are required-check tests that were broken org-wide, for every PR
regardless of its own diff -- reproduced fresh on unmodified main. Root
causes:

tests/test_central_required_workflow_exact_inventory.py: its hard-coded
EXPECTED_REQUIRED_WORKFLOW_PATHS oracle still had 9 entries (including
osv-scanner-pr.yml and scorecard-pr.yml). #1826 ("consolidate required OSV
and Scorecard scans") intentionally shrank the production
REQUIRED_WORKFLOW_PATHS tuple to 7 entries and updated its sibling test
file (test_central_required_workflow_ruleset_audit.py) to match, but missed
this independent-oracle file. Confirmed via docs/org-required-workflow-rollout.md
and git history (git log -S) that the 7-path production state is the
intentional, current design -- not a regression -- so the fix updates the
stale oracle, not production.

tests/test_opencode_required_verdict_regression.py: two separate gaps from
#1823 ("break runner-capacity dispatch deadlock"), which replaced
opencode-review.yml's old event_type:"merge-scheduler" dispatch (a minimal
payload: target_repository/pr_number/base_branch/max_prs/trigger_reviews/
enable_auto_merge/etc.) with a direct event_type:"opencode-review" dispatch
carrying exact base/head SHAs and a required_run_id:
- test_required_workflow_cannot_succeed_with_an_echo_only_placeholder still
  asserted the old event_type string and two fields (trigger_reviews:true,
  enable_auto_merge:false) that no longer exist anywhere in the workflow.
  Updated to check the new event_type and required_run_id fields instead;
  dropped the assertion with no direct successor field.
- The "Request current-head OpenCode review execution" step's env block
  grew three new vars (BASE_SHA, HEAD_REF, plus the always-present
  $GITHUB_RUN_ID) that the subprocess-harness test building this step's env
  by hand hadn't been updated to supply, so the script died on `set -u`
  before reaching the code under test. Added the three missing entries.

Verified full local triad: coverage run -m pytest tests -> 2779 passed,
coverage report --fail-under=100 -> 100%, interrogate -> 100%.

Not fixed in this pass (separate, lower-priority prose drift, no test
currently pins it): docs/org-required-workflow-rollout.md still says "9
entries... through osv-scanner-pr.yml", stale since #1826's consolidation.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant