Skip to content

feat(coverage): add bounded PyO3 peer-evidence gate - #789

Draft
seonghobae wants to merge 27 commits into
mainfrom
fix/pyo3-native-peer-gate
Draft

feat(coverage): add bounded PyO3 peer-evidence gate#789
seonghobae wants to merge 27 commits into
mainfrom
fix/pyo3-native-peer-gate

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Buyer-visible blocker

Central OpenCode coverage can fail before pytest collection in maturin/PyO3 repositories because the source-only sandbox intentionally does not build or import an unchanged compiled extension. Treating that environment limitation as an ordinary source-test failure blocks otherwise valid exact-head review evidence; treating it as success would weaken the gate.

Bounded peer-evidence repair

  • Classify only complete pytest collection failures caused exclusively by the declared maturin/PyO3 module being unavailable.
  • Seal and descriptor-validate the repository pyproject.toml before untrusted tests; reject symlinked ancestors, final links, non-regular files, device/inode/path drift, growth, malformed input, and bounded-read overflow.
  • Reject deferral whenever the PR changes Rust/Cargo/native crate or stub files, packaging inputs, dependency locks, any actual requirements/ dependency path, workflow/action files, or any repository pyproject.toml.
  • Distinguish prose under docs/requirements/ from dependency inputs.
  • Preserve both sides of renames as delete/add paths.
  • Emit DEFERRED, never PASS.
  • Require exact-current-head successful CheckRun evidence for CI::python, CI::rust, and CI::package, with bounded complete GraphQL pagination and rejection of stale, pending, failed, status-only, lookalike, missing, or duplicate contexts.
  • Keep potentially large pytest output on runner-owned storage and retain the Python 3.10/3.14 compatibility contract.

Exact identity and scope correction

  • exact current head: 791ca881f50360b24825dbdcba848f2c6ace7920;
  • protected base and independently resolved live base: main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba;
  • state: Draft and mechanically mergeable.

The final protected-base diff is limited to the peer-evidence vertical slice:

  • .github/workflows/opencode-review-dispatch.yml
  • .github/workflows/python-native-extension-peer-gate-quality-ci.yml
  • scripts/ci/python_native_extension_peer_gate.py
  • the focused peer-gate, file-safety, nested-project, dependency-path, workflow-contract, OpenCode-contract, and isolated-Git regression tests
  • docs/doctoring/python-native-extension-peer-evidence.md
  • docs/doctoring/python-native-extension-peer-file-safety.md
  • CHANGELOG.md

The overlapping AGENTS.md, CLAUDE.md, and root ARCHITECTURE.md changes were removed because PR #896 owns the canonical central documentation graph. Requirements-directory lock discovery and its materializer tests were restored to protected-main content because PR #785 owns that independent trust boundary.

Verification lineage

The prior bounded head and review-driven repairs reported focused and complete suites with 100% owned production statement/branch coverage and complete public docstrings. Those results prove predecessor trees only. The current head must regenerate every applicable exact-head quality, security, supply-chain, and semantic-review result.

Security and merge gate

This PR does not skip tests, build PR-selected extensions, enable sandbox network access, introduce a Python substitute for Rust arithmetic, or convert missing evidence into success. Keep Draft until the unchanged current head completes the peer-gate/full-suite, exact 100% owned statement/branch coverage, public-docstring, security, SAST, dependency/SBOM, and semantic-review cycle with zero valid unresolved findings. Then mark Ready and require qualifying non-author exact-head approvals plus normal protected-main last-push semantics. No self-approval, stale evidence, temporary writer, administrative bypass, or weakened gate is authorized.

After protected integration, a real affected PyO3 consumer must rerun the protected-main path before incident closure.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

PyO3/maturin 네이티브 확장 수집 실패 분류기와 안전한 증거 파일 처리를 추가했습니다. 정확한 PR HEAD의 Python·Rust·package CheckRun 성공을 검증하고, 결과를 OpenCode 승인 흐름과 품질 CI에 연결했습니다.

Changes

Python 네이티브 확장 peer-gate

Layer / File(s) Summary
안전한 입력과 프로젝트 계약
scripts/ci/python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate_file_safety.py, docs/doctoring/python-native-extension-peer-file-safety.md
제한된 일반 파일 읽기, 경로 검증, UTF-8 디코딩, Maturin/PyO3 메타데이터 검증을 추가했습니다. 심볼릭 링크, 비정규 파일, 크기 초과, 파일 교체와 동시 변경을 거부합니다.
pytest 수집 실패 분류
scripts/ci/python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate_nested_project.py, tests/test_python_native_extension_peer_gate_requirements_directory.py
변경 파일 경계와 완전한 pytest collection 로그를 검사합니다. 선언된 네이티브 모듈 누락만 분류하고 다른 실패는 거부합니다.
exact-head peer check 검증
scripts/ci/python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate.py
중첩 CheckRun 레코드를 해석합니다. CI::python, CI::rust, CI::package가 동일한 40자리 HEAD에서 COMPLETEDSUCCESS인지 검증합니다.
OpenCode 승인 흐름 연동
.github/workflows/opencode-review-dispatch.yml, tests/test_python_native_extension_peer_gate_workflow_contract.py, tests/test_opencode_agent_contract.py, tests/test_repository_branch_coverage_pr743_cleanup.py, CHANGELOG.md
Python 테스트 로그와 pyproject.toml 스냅샷을 수집합니다. 제한된 실패는 DEFERRED로 기록하고 peer check가 충족될 때만 승인을 허용합니다. 일반 승인과 모델 출력 불가 폴백에도 같은 검사를 적용합니다.
품질 게이트와 운영 문서
.github/workflows/python-native-extension-peer-gate-quality-ci.yml, docs/doctoring/python-native-extension-peer-evidence.md
Python 3.10·3.14 검증, 전체 테스트, 브랜치·docstring 커버리지, compileall, 체크섬 고정 actionlint, git diff --check를 추가했습니다. peer-evidence 조건과 운영 범위를 문서화했습니다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PythonTest as Python 테스트 실행
  participant Classifier as classify-pytest
  participant GitHub as GitHub CheckRuns
  participant PeerGate as require-checks
  participant Approval as OpenCode 승인 흐름

  PythonTest->>Classifier: 로그·pyproject 스냅샷·변경 파일 전달
  Classifier-->>PythonTest: PASS 또는 DEFERRED 모듈명
  Approval->>GitHub: PR HEAD의 CheckRun 조회
  GitHub-->>PeerGate: Python·Rust·package CheckRun JSON
  PeerGate-->>Approval: exact-head 성공 여부
  Approval-->>Approval: peer check 충족 시 승인 진행
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: opencode-agent

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 95.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 bounded PyO3 peer-evidence gate 추가라는 변경의 핵심 내용을 간결하고 정확하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pyo3-native-peer-gate

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.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Integrate the published PyO3 native-extension helper into the protected central OpenCode coverage/review path on this same branch; keep the PR Draft until the integration is complete and exact-head evidence passes.

Mirror the existing fail-closed R peer-evidence pattern rather than creating a second privileged reviewer. Required behavior:

  1. In .github/workflows/opencode-review-dispatch.yml, capture each Python pytest/coverage command's complete bounded log and exit status without changing successful behavior.
  2. When and only when a Python suite fails, invoke scripts/ci/python_native_extension_peer_gate.py classify-pytest against the exact log, the relevant regular non-symlink pyproject.toml, and the exact base-to-head changed-file list.
  3. A successful classification must not be reported as ordinary passing coverage. Publish a distinct compact marker stating that source-only Python collection was deferred exclusively for the unchanged declared PyO3 module and requires exact-head native peer evidence.
  4. In the trusted review/approval phase, query live CheckRun objects for the exact PR head and verify the repository-owned Python, Rust/PyO3, and package checks with require-checks. Do not accept statuses, stale heads, queued/cancelled/skipped checks, name lookalikes, duplicate requirements, or predecessor evidence. Preserve the existing R peer gate and all normal failure paths.
  5. Approval must remain blocked if the classifier, changed-file trust boundary, check inventory, or required peer check is absent or malformed. The classifier is a deferral classifier, never approval evidence by itself.
  6. Add permanent workflow-contract tests covering: pure declared-module collection failure; mixed missing imports; test/setup/teardown/internal/crash/truncated failures; native/Cargo/Rust/stub/packaging/lock/requirements/workflow changes; exact-head successful peer checks; stale/pending/failed/status/lookalike evidence; coexistence with R deferral; coverage summary wording; and approval-gate enforcement.
  7. Include the helper and workflow contract tests in permanent Python 3.10/3.14, compilation, 100% production statement/branch coverage, and public-docstring gates. No temporary repair workflow, branch-selected privileged execution, Python compatibility stub, networked PR test, skipped test, synthesized approval, merge, release, or protection change may remain.
  8. After exact-head central checks pass, rerun OpenCode/Noema review for unchanged fast-mlsirm heads build(deps): bump cloudflare/wrangler-action from 3.15.0 to 4.0.0 #546 d111e2b1341b0daab6b813074c7a7dbcf5c24ff4, fix(deps): protobuf를 aiplatform 호환 범위로 유지 #549 12fc519ca798c8400840f04b3b19c07754ad7dfe, and build(deps): bump google-cloud-bigquery from 3.42.0 to 3.42.2 #550 8db4c235d466446429fc32bdeeef3ca1fdaa8827; do not reuse their failed source-only coverage verdicts.

Update the doctoring and CHANGELOG to distinguish source-only measurement, trusted native peer evidence, and remaining interpretation limits. Preserve immutable called-workflow source, reviewer credentials, NVIDIA/OpenCode model policy, independent approval, unresolved-thread, and branch-protection boundaries.

Copy link
Copy Markdown
Contributor Author

@jules Implement the remaining central workflow integration on this existing Draft PR. Preserve the published helper and fail-closed trust boundary; do not create another PR or temporary workflow.

Required scope:

  • wire python_native_extension_peer_gate.py classify-pytest into .github/workflows/opencode-review-dispatch.yml only after a real bounded Python suite failure, using the exact pytest log, regular non-symlink pyproject, and exact base-to-head changed-file list;
  • publish a distinct PyO3 deferral marker rather than ordinary passing coverage;
  • in the trusted approval phase, query live exact-head CheckRun records and call require-checks for protected Python, Rust/PyO3, and package peer checks;
  • reject stale/pending/failed/status/lookalike/missing/malformed evidence and preserve the existing R deferral independently;
  • add permanent workflow-contract tests for classification, changed-boundary rejection, exact-head peer evidence, R/PyO3 coexistence, summary wording, and approval enforcement;
  • include the helper and workflow integration in Python 3.10/3.14 compile, 100% statement/branch coverage, public docstrings, actionlint, security, and changelog/doctoring checks.

Do not build PR-selected native code in the central sandbox, add a compatibility stub, skip product tests, use networked PR execution, change reviewer tokens or NVIDIA/OpenCode policy, weaken approval/protection gates, mark Ready, merge, or release. Commit as normal descendants without force-push, and report exact verification commands and the final head SHA.

Copy link
Copy Markdown
Contributor Author

@jules Implement the remaining integration directly on this branch; do not create any temporary, self-modifying, encoded-patch, or branch-writing workflow.

Required GREEN slice:

  1. Wire scripts/ci/python_native_extension_peer_gate.py into .github/workflows/opencode-review-dispatch.yml after the isolated pytest attempt has produced a complete bounded log and exact changed-file inventory.
  2. Accept deferral only when classify-pytest proves the sole failure is the exact declared maturin/PyO3 module and require-checks proves trusted exact-head CI::python, CI::rust, and CI::package CheckRuns are completed/successful.
  3. Treat classification as deferred peer evidence, never as a passing test; preserve all coverage/docstring gates for the Python-owned changed files and fail closed on mixed failures, native/package/lock/workflow changes, stale or status-only evidence.
  4. Add permanent workflow-contract tests covering ordering, trusted workflow/check-name ownership, exact-head binding, malformed evidence, and the fast_mlsirm._core case.
  5. Run the focused suite, complete central tests, 100% production statement/branch/docstring evidence, compilation, and exact-head security workflows. Keep Draft until all current-head evidence is GREEN.

After integration, rerun OpenCode review for unchanged fast-mlsirm PRs #546, #549, and #550; predecessor coverage failures are not reusable.

Copy link
Copy Markdown
Contributor Author

@jules Integrate the committed helper into the central opencode-review-dispatch.yml now; keep this PR Draft until end-to-end exact-head evidence is complete.

Required fail-closed flow:

  1. Preserve the current central source-only coverage run and capture its complete bounded combined stdout/stderr plus exit status. On success, continue unchanged.
  2. On failure, write the exact base…head changed-file list to a bounded newline file and invoke python_native_extension_peer_gate.py classify-pytest. Deferral is allowed only when that helper proves the sole failure is absence of the exact unchanged maturin/PyO3 module-name; any native/Cargo/stub/packaging/lock/requirements/workflow/maturin-metadata change or mixed pytest failure remains blocking.
  3. A successful classification is not a pass. Query CheckRun—not StatusContext—evidence for the exact PR head and invoke require-checks for these exact fast-mlsirm CI jobs before the central review may treat source-only coverage as peer-proven:
    • CI::python
    • CI::rust
    • CI::package
    • CI::gpu-smoke
    • CI::fuzz
      Keep Security Scan and SAST under the existing central gates. Reject absent, pending, failed, stale-head, lookalike-workflow, duplicate-requirement, or malformed evidence.
  4. Emit an explicit non-success classification such as coverage_deferred_to_exact_head_native_peer_evidence; do not report the source-only sandbox as passing and do not lower the repository's 100% coverage contract.
  5. Add workflow contract tests that exercise the exact fast_mlsirm._core collection failure, successful exact-head peer evidence, stale/pending/failed/status-only/check-name/workflow-name mismatches, native-boundary changes, mixed failures, truncation, and normal pure-Python pytest failures.
  6. Re-run the central workflow against current exact heads of fast-mlsirm#546, #549, and #550. The integration is accepted only if those previously blocked Python-only PRs receive no coverage CHANGES_REQUESTED, while a synthetic native-code change and mixed pytest failure still block.

Do not build PR-selected native code inside the central sandbox, introduce a Python stub, auto-approve, weaken required checks, use COPILOT_GITHUB_TOKEN, or disturb the existing reviewer-agent secret contract. Update APA 7 doctoring and the authoritative changelog after GREEN.

Copy link
Copy Markdown
Contributor Author

@coderabbitai Review the current Draft head 68e8b1695280d11c58b5553457442527f9d0542c specifically as an implementation-design review for the remaining PyO3 workflow integration. Do not approve, mutate, or merge. Identify the exact existing R-deferral variables/functions/approval gates in .github/workflows/opencode-review-dispatch.yml, and provide a minimal patch plan that reuses them for python_native_extension_peer_gate.py while preserving ordinary Python failures, exact-head CheckRun validation, R/PyO3 coexistence, and all immutable-source/credential boundaries. Flag any defect in the published helper or tests before integration.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@seonghobae have exceeded the limit for the number of chat messages per hour. Please wait 5 minutes and 1 seconds before sending another message.

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Prepare the next bounded integration only after .github#759 produces a GREEN exact head, because both changes touch the authoritative coverage workflow and stale-base integration would reintroduce or overwrite the LLVM runtime-boundary repair.

For the eventual current-main integration:

  • invoke python_native_extension_peer_gate.py classify-pytest only after a real pytest collection failure has been captured completely and before converting that failure into deferred peer-evidence requirements;
  • write changed paths from the exact base/head diff into a bounded regular file;
  • require the declared maturin/PyO3 module and refuse deferral for every native, packaging, dependency, workflow, stub, or metadata change already covered by the helper;
  • query CheckRun evidence from trusted GitHub metadata and require exact current head plus repository-owned Python, Rust/PyO3, and package checks, all completed/successful; statuses, stale heads, duplicates, lookalikes, and missing evidence remain blocking;
  • keep classification explicitly non-passing until peer checks are proven;
  • add permanent workflow-ordering, permission, exact-head, and fail-closed contracts; execute/cover/compile the helper through the exact-head quality lane;
  • rerun fast-mlsirm#546 only after the central integration merges.

Keep Draft. Do not mutate the authoritative workflow from the pre-#759 base, approve, or merge.

Copy link
Copy Markdown
Contributor Author

@jules Implement the existing TDD RED workflow contracts on exact live head 5bc9ba4070866934ed819c2ff06f209b785d7b88 as normal descendant commits. Keep this PR Draft. Do not amend, rebase, force-push, create a repair workflow, mark Ready, merge, release, change branch protection, change reviewer credentials, or alter NVIDIA/OpenCode model policy.

Precondition: before every write, re-read the live head and stop without mutation unless it is the expected current head or your own direct descendant.

Coverage integration

In .github/workflows/opencode-review-dispatch.yml, preserve the existing sandbox, run_and_capture, R deferral, immutable-source, credential, and publication boundaries. Add a separate Python-suite runner that uses the identical timeout --kill-after=20 900 setpriv ... low-privilege environment but retains the complete bounded log long enough to classify a real nonzero Python suite exit.

Initialize exactly:

python_native_peer_check_required=0

Only after a Python configured/default pytest/coverage command actually fails:

  1. snapshot changed_files_for_coverage to a bounded regular file;
  2. require the relevant ${project_dir}/pyproject.toml to be regular and non-symlink;
  3. invoke the trusted helper:
python3 "$GITHUB_WORKSPACE/scripts/ci/python_native_extension_peer_gate.py" classify-pytest \
  --log "$log_file" \
  --pyproject "$project_dir/pyproject.toml" \
  --changed-files "$changed_files_file" \
  --repo-root "$COVERAGE_SOURCE_WORKDIR"
  1. on classifier success, do not report ordinary PASS and do not increment failures; emit a distinct section containing all these literal contracts:
### Python native-extension source-only deferral
- Result: DEFERRED
the unchanged declared PyO3 module was unavailable in the source-only sandbox
exact-head Python, Rust/PyO3, and package CheckRuns

and set python_native_peer_check_required=1;
5. on classifier rejection, retain the ordinary exact exit failure and increment failures;
6. any other Python suite failure in the same run remains blocking.

In the compact PASS decision, when the variable is 1, emit exactly:

- Python native-extension peer evidence: deferred source-only collection requires successful exact-head peer checks

Do not build/install PR-selected native code, add a Python stub, skip tests, or grant network access.

Approval integration

Mirror—but do not replace—the existing R peer-check pattern. Add independent functions that:

  • detect only the exact compact Python deferral marker;
  • query the live PR statusCheckRollup immediately before approval and normalize only CheckRun nodes with __typename, workflow name, check name, exact trusted $HEAD_SHA, status, and conclusion into a bounded JSON file;
  • call:
python3 "$GITHUB_WORKSPACE/scripts/ci/python_native_extension_peer_gate.py" require-checks \
  --checks-json "$checks_file" \
  --head-sha "$HEAD_SHA" \
  --required-check "CI::python" \
  --required-check "CI::rust" \
  --required-check "CI::package"
  • reject missing, pending, failed, skipped, cancelled, stale, status-only, lookalike, malformed, or lookup-failed evidence.

Call this gate in both approval paths that already call require_r_cmd_check_for_deferred_coverage: the deterministic model-unavailable blocker path and the normal APPROVE path. R and PyO3 deferrals must coexist independently. On failure, leave review state unchanged with a bounded WAITING_FOR_PYTHON_NATIVE_PEER_CHECKS explanation; never synthesize approval.

Permanent tests and verification

Make the current tests GREEN without weakening them:

python -m pytest -q \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_nested_project.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py

Then run the permanent Python 3.10/3.14 quality workflow, focused and complete 100% production statement/branch coverage, interrogate 100%, compileall, actionlint, full central tests, security and supply-chain checks. Fix actual failures only. Preserve CHANGELOG.md and docs/doctoring/python-native-extension-peer-evidence.md; update them only where integration semantics or verified limitations changed.

After GREEN, report the exact final SHA and verification commands in a PR comment. Do not request approval or change Draft state.

Copy link
Copy Markdown
Contributor Author

Exact-head quality run 31133025300 confirms the intended integration RED: 87 focused tests passed and only the three workflow-contract tests failed because opencode-review-dispatch.yml still lacks python_native_peer_check_required, the distinct source-only deferral summary, and trusted require-checks enforcement. Python 3.10 compatibility passed; all security workflows passed.

@jules Implement the central workflow integration now rather than weakening these tests. Preserve the existing R peer gate and privileged reviewer chain. After GREEN, run full central coverage/docstrings/actionlint and replay OpenCode review against exact fast-mlsirm heads #546, #549, and #550.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Fix the exact current-head quality failure on 5bc9ba4070866934ed819c2ff06f209b785d7b88 by completing the integration already required by this Draft PR; do not weaken or delete the three failing workflow-contract tests.

Run 31133025300, job 92726135563, proves 87/90 focused tests pass and these exact contracts remain RED:

  1. python_native_peer_check_required=0 and the bounded classify-pytest invocation are absent from .github/workflows/opencode-review-dispatch.yml;
  2. the coverage artifact lacks the distinct ### Python native-extension source-only deferral, - Result: DEFERRED, and exact-head peer-check requirement text;
  3. the approval phase does not yet call require-checks for CI::python, CI::rust, and CI::package against PR_HEAD_SHA using live GraphQL CheckRun evidence.

Implement the documented fail-closed flow:

  • initialize python_native_peer_check_required=0 and keep ordinary source-test failure authoritative;
  • only after a real Python pytest failure, call scripts/ci/python_native_extension_peer_gate.py classify-pytest with the bounded pytest log, changed-file list, --repo-root "$COVERAGE_SOURCE_WORKDIR", and exact --pyproject "$project_dir/pyproject.toml";
  • if and only if that classifier succeeds, serialize a distinct DEFERRED section, never PASS, stating the unchanged declared PyO3 module was unavailable in the source-only sandbox and that exact-head Python, Rust/PyO3, and package CheckRuns are mandatory;
  • pass this state into the trusted approval job;
  • query current live check runs, preserve __typename, require actual CheckRun values, and call the helper's require-checks for CI::python, CI::rust, and CI::package with --head-sha "$PR_HEAD_SHA";
  • retain R CMD check deferral logic independently;
  • reject mixed failures, changed native/package/workflow boundaries, missing/pending/failed/stale/status-only/lookalike evidence, malformed metadata, or any classifier error;
  • keep all source handling read-only and bounded, no PR-selected build/install, no Python native stub, no token weakening, no approval or merge inside the helper.

After GREEN, run all 90 focused tests at 100% statement/branch coverage, the complete central suite, interrogate 100%, compileall, actionlint, Python 3.10 compatibility, security workflows, and exact-head review. Keep Draft, needs-revision, do-not-merge, and no auto-merge until integration and a live fast-mlsirm proof run are complete.

Copy link
Copy Markdown
Contributor Author

@jules Implement the missing production integration on current branch fix/pyo3-native-peer-gate; do not create a separate workflow-only substitute. Wire scripts/ci/python_native_extension_peer_gate.py into .github/workflows/opencode-review-dispatch.yml after the isolated pytest log and exact changed-file inventory exist. Deferral must remain non-PASS evidence and require exact-head successful trusted CheckRuns CI::python, CI::rust, and CI::package; preserve all Python coverage/docstring gates and the independent R peer gate; fail closed on mixed/native/package/lock/workflow changes or malformed/stale/status-only evidence. Add permanent ordering/ownership/exact-head workflow-contract tests, run focused/full quality and security, and keep Draft.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Implement the committed workflow-integration RED contract on this Draft branch. Do not weaken the helper or tests. Preserve the existing R peer gate and reviewer credential chain.

The central coverage job must capture bounded combined pytest output and status, classify only the exact unchanged maturin/PyO3 module-absence collection failure, then require trusted exact-head CheckRun success for CI::python, CI::rust, CI::package, CI::gpu-smoke, and CI::fuzz. StatusContext, stale heads, lookalike workflow/check names, pending/failed/missing/malformed evidence, native-boundary changes, and mixed failures remain blocking. Emit an explicit non-success source-only deferral classification; never call it passing, never build PR-selected native code, and never auto-approve.

After GREEN, run the permanent workflow contracts, full central coverage/docstrings/actionlint/security, then replay exact current heads of fast-mlsirm #546, #549, and #550.

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Review-only request for exact current head 9299a4515b3436607bbad895bf1c73205dce3582 against independently resolved live protected base 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

Please inspect the five-file repair for all four addressed CodeRabbit findings: runner-owned pytest-log placement, rename-as-delete/add boundary inventory, fail-closed cursor pagination across every exact-head CheckRun page, and repository-wide pyproject.toml plus requirements*.in/constraints*.txt trust-boundary invalidation. Also inspect the executable regressions, including a required check beyond the first 100 contexts and rename-out-of-native-boundary behavior.

The exact-head focused quality workflow 31570671841 and Strix workflow 31570671729 are terminal-success. Other security/supply-chain checks remain queued; they are separate gate evidence and must not be interpreted as semantic source findings or approval. Do not modify the branch, approve on behalf of the author, merge, release, weaken protection, or reuse predecessor-head review evidence.

@seonghobae
seonghobae enabled auto-merge (squash) August 12, 2026 10:50

Copy link
Copy Markdown
Contributor Author

Exact-current-head review request for 9299a4515b3436607bbad895bf1c73205dce3582 over protected main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

Review the complete 13-file bounded PyO3 peer-evidence gate: defer only complete pytest collection failures caused exclusively by the unchanged declared native module; sealed regular pyproject.toml identity and bounded reads; fail-closed changed-path boundary including old/new rename paths, root/nested pyprojects, Cargo/native/packaging/workflow and requirements/constraints .txt/.in inputs; distinct DEFERRED, never PASS; exact-head paginated successful CheckRun evidence for CI::python, CI::rust, and CI::package; and bounded runner-owned pytest evidence. All four CodeRabbit findings and the scoped contract nitpick are addressed and resolved. Python Native Extension Peer Gate Quality CI, Trusted uv Materializer Quality CI, Strix Changed Path Quality CI, CodeQL PR, Python Security, Security Scan, SAST Semgrep, Secret Scan, OSV-Scanner PR, Scorecard PR, and SBOM Generation are terminal-success on this exact head.

Keep the exact head unchanged. Do not transfer predecessor evidence, synthesize author approval, build PR-selected native code in the source sandbox, treat deferral as success, relax peer-check/path/file boundaries, merge, release, or bypass protection.

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Finish this existing Draft PR in place. Do not create a stacked PR, compatibility stub, temporary branch writer, or networked execution of PR-selected native code.

Integrate scripts/ci/python_native_extension_peer_gate.py into the canonical central coverage/review path alongside the existing R peer-evidence architecture:

  1. Capture every real Python pytest/coverage command's bounded complete log and exit status without changing successful behavior.
  2. Invoke classify-pytest only after a genuine Python-suite failure, using the exact log, a regular non-symlink pyproject.toml, and the exact base-to-head changed-file inventory.
  3. Treat a valid classification as a distinct PyO3 source-only deferral marker, never ordinary passing coverage.
  4. In the trusted review/approval phase, query live CheckRun objects at the exact PR head and invoke require-checks for repository-owned Python, Rust/PyO3, packaging, and every configured GPU/native/fuzz gate. Reject statuses, stale heads, pending/cancelled/skipped/failed checks, duplicates, lookalikes, missing or malformed evidence.
  5. Preserve R deferral independently. Either deferral remains blocking until its own exact-head peer evidence succeeds.
  6. Add permanent contracts for the pure declared-module collection-failure shape; mixed imports; test/setup/teardown/internal/crash/truncation failures; native/Cargo/Rust/stub/package/lock/requirements/workflow changes; exact-head peer checks; stale/pending/failed/status/lookalike evidence; R/PyO3 coexistence; summary wording; and approval enforcement.
  7. Include the helper and integration contracts in Python 3.10/3.14 compilation, 100% production statement/branch coverage, 100% public docstrings, actionlint, security/supply-chain, and clean-tree gates. Update doctoring and CHANGELOG.md with authoritative APA 7 references and explicit interpretation limits.

Keep Draft until the direct canonical integration and all same-head gates are green. Do not approve, merge, release, alter reviewer credentials/protections, or use COPILOT_GITHUB_TOKEN.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

expected_head='9299a4515b3436607bbad895bf1c73205dce3582'
repo='ContextualWisdomLab/.github'
pr='789'

echo '== checked-out HEAD =='
git rev-parse HEAD
echo '== expected head =='
printf '%s\n' "$expected_head"

echo '== PR metadata =='
gh pr view "$pr" --repo "$repo" --json number,state,isDraft,headRefName,headRefOid,baseRefName,baseRefOid,mergeStateStatus,reviewDecision

echo '== changed files against base =='
git diff --name-status '6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba...HEAD'

echo '== relevant file outlines =='
ast-grep outline scripts/ci/python_native_extension_peer_gate.py --items all --view expanded
ast-grep outline tests/test_python_native_extension_peer_gate_workflow_contract.py --items all --view expanded

echo '== workflow symbols and integration references =='
rg -n -C 4 \
  -e 'r_peer_check_required' \
  -e 'python_native_peer_check_required' \
  -e 'python_native_extension_peer_gate\.py' \
  -e 'classify-pytest' \
  -e 'require-checks' \
  -e 'Python native-extension source-only deferral' \
  -e 'Python native-extension peer evidence' \
  .github/workflows/opencode-review-dispatch.yml

echo '== helper exact-head and changed-file logic references =='
rg -n -C 3 \
  -e 'def (classify_pytest_inputs|has_required_exact_head_checks|_read_bounded_regular)' \
  -e 'requirements|constraints|pyproject|rename|previous|old' \
  -e 'endCursor|hasNextPage|CheckRun|workflow' \
  scripts/ci/python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py

echo '== current-head check runs =='
gh api --paginate \
  "/repos/ContextualWisdomLab/.github/commits/$expected_head/check-runs?per_page=100" \
  --jq '.check_runs[] | [.name,.status,.conclusion,.head_sha,.details_url] | `@tsv`' || true

echo '== unresolved review threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved comments(first: 1) { nodes { author { login } body } } }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | [.comments.nodes[0].author.login, .comments.nodes[0].body] | `@json`' || true

Length of output: 78558


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== coverage execution and PyO3 classification =='
sed -n '780,1020p' .github/workflows/opencode-review-dispatch.yml

echo '== changed-file inventory function =='
rg -n -A100 -B10 'changed_files_for_coverage\(\)' .github/workflows/opencode-review-dispatch.yml

echo '== coverage summary, outputs, and transfer boundary =='
sed -n '2030,2140p' .github/workflows/opencode-review-dispatch.yml
rg -n -C5 -e 'COVERAGE_EVIDENCE_SUMMARY' -e 'r_peer_check_required' -e 'python_native_peer_check_required' .github/workflows/opencode-review-dispatch.yml

echo '== Python native peer collector and gate call sites =='
sed -n '7180,7425p' .github/workflows/opencode-review-dispatch.yml
rg -n -C5 -e 'coverage_defers_to_python_native_peer_checks' -e 'require_successful_python_native_peer_checks' -e 'collect_successful_python_native_peer_check_evidence' .github/workflows/opencode-review-dispatch.yml

echo '== helper implementations =='
sed -n '64,165p' scripts/ci/python_native_extension_peer_gate.py
sed -n '168,398p' scripts/ci/python_native_extension_peer_gate.py
sed -n '399,536p' scripts/ci/python_native_extension_peer_gate.py

echo '== complete workflow-contract tests =='
cat -n tests/test_python_native_extension_peer_gate_workflow_contract.py

echo '== focused base-to-head diff =='
git diff --no-ext-diff --unified=40 '6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba...HEAD' -- \
  .github/workflows/opencode-review-dispatch.yml \
  scripts/ci/python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py \
  tests/test_python_native_extension_peer_gate_file_safety.py \
  tests/test_python_native_extension_peer_gate_requirements_directory.py

Length of output: 161049


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== all Python native peer-gate call sites and enclosing control flow =='
rg -n -C 18 \
  -e 'require_python_native_peer_checks_for_deferred_coverage\(\)' \
  -e 'require_python_native_peer_checks_for_deferred_coverage' \
  -e 'COVERAGE_EVIDENCE_RESULT' \
  -e 'create_pull_review.*APPROVE' \
  -e 'create_pull_review_with_payload.*APPROVE' \
  .github/workflows/opencode-review-dispatch.yml

echo '== verifier and test coverage for duplicate CheckRun records =='
rg -n -C 8 \
  -e 'len\(matches\)' \
  -e 'duplicate' \
  -e 'successful_checks' \
  -e 'has_required_exact_head_checks' \
  -e 'require-checks' \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py \
  scripts/ci/python_native_extension_peer_gate.py

echo '== final coverage decision and all result markers =='
rg -n -C 4 \
  -e 'Coverage Decision' \
  -e 'Result: PASS' \
  -e 'Result: DEFERRED' \
  -e 'Test evidence: supported repository test suites passed' \
  .github/workflows/opencode-review-dispatch.yml

echo '== permanent quality workflow =='
cat -n .github/workflows/python-native-extension-peer-gate-quality-ci.yml

echo '== doctoring and changelog references =='
rg -n -C 3 \
  -e 'DEFERRED|CheckRun|PyO3|maturin|source-only|exact-head|duplicate|rerun' \
  CHANGELOG.md \
  docs/doctoring/python-native-extension-peer-evidence.md \
  docs/doctoring/python-native-extension-peer-file-safety.md

echo '== PR review and latest current-head check suites =='
gh pr view 789 --repo ContextualWisdomLab/.github --json isDraft,reviewDecision,reviews,headRefOid
gh api "/repos/ContextualWisdomLab/.github/commits/9299a4515b3436607bbad895bf1c73205dce3582/check-suites?per_page=100" \
  --jq '.check_suites[] | [.app.slug,.status,.conclusion,.head_sha,.workflow_run.url] | `@tsv`' || true

Length of output: 90605


@seonghobae I found one blocking implementation defect.

[P1] Reject duplicate matching CheckRun records

In scripts/ci/python_native_extension_peer_gate.py, Lines 446–462, has_required_exact_head_checks() accepts multiple matching CheckRun records when every match is COMPLETED and SUCCESS.

The function checks only that matches is nonempty. It does not require len(matches) == 1.

This conflicts with the stated fail-closed contract. Duplicate same-head CI::python, CI::rust, or CI::package records are ambiguous rerun evidence. The approval path can currently accept two successful matching records. It must reject that inventory unless the workflow implements and verifies an explicit latest-rerun rule.

Update the verifier to require exactly one matching record for each required (workflow, name) pair. Add a regression that appends a second successful matching record and expects require-checks to fail. Keep the existing regression for duplicate --required-check declarations.

I also verified these non-source conditions:

  • The checked-out revision matches 9299a4515b3436607bbad895bf1c73205dce3582.
  • The PyO3 classifier uses the bounded runner-owned log, sealed pyproject.toml snapshot, and rename-preserving changed-file inventory.
  • The collector paginates statusCheckRollup.contexts and validates CheckRun records against PR_HEAD_SHA.
  • The workflow invokes the Python peer-check gate in the observed approval and fallback paths.
  • There are no unresolved review threads.
  • GitHub reports #789 as not Draft. It also reports REVIEW_REQUIRED.
  • codecov, claude, and coderabbitai check suites remain queued on this exact head.

I applied the repository rule that only successful checks on the exact current head count as merge evidence. I do not approve this PR.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/.github PR: 0
File: :0-0
Timestamp: 2026-08-05T13:44:10.007Z
Learning: For PR `#782`, only successful checks associated with the exact current head are valid merge evidence. Do not treat queued, in-progress, cancelled, predecessor-head, temporary-workflow, or administrative-bypass results as passing evidence. Before a formal approval, verify that the direct security and supply-chain workflows, the permanent hourly NVIDIA NIM contract, current-head reviews, unresolved-thread checks, and an independent approval have completed successfully.

You are interacting with an AI system.

Record the inclusion-of-untrusted-control-sphere prohibition so a source-only
sandbox cannot treat a missing compiled extension as license to run
pull-request maturin or cargo hooks. Force the trusted-uv installer tests
onto the linux x86_64 runner path and add the control-plane architecture
diagram.
@seonghobae

Copy link
Copy Markdown
Contributor Author

Hourly loop 2026-08-13: re-read exact head ba6a885188dab96143cdb02cf364546c5e95f462 against the four CodeRabbit majors.

Current head already implements each one:

  • pytest capture uses mktemp "$RUNNER_TEMP/python-native-pytest.XXXXXX"
  • changed_files_for_coverage uses git diff --name-only --no-renames, so a crate-to-docs rename still lists both old and new paths (covered by test_renamed_native_input_preserves_old_and_new_paths)
  • collect_successful_python_native_peer_check_evidence pages statusCheckRollup.contexts with pageInfo.hasNextPage / endCursor
  • _touches_native_or_trust_boundary blocks every pyproject.toml, requirements*.in / constraints*.txt, and any requirements/ directory

Removed stale needs-revision / do-not-merge. Did not self-approve. Merge remains blocked on #948.

A markdown file in docs/requirements/ is not a lock or packaging
change. Only .in/.txt/.lock names in a requirements path invalidate
source-only sandbox deferral.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 8c43ca2ae0d9a5dfc095d00a6bf2e4010bdae0dc.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow (2 files)"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow (2 files)"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (4 files)"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file (4 files)"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs (2 files)"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs (2 files)"]
  R3 --> V3["docs review"]
  Evidence --> S4["CI script: python_native_extension_peer_gate.py"]
  S4 --> I4["review and security gate shell path"]
  I4 --> R4["Review risk: CI script: python_native_extension_peer_gate.py"]
  R4 --> V4["bash -n plus Strix self-test"]
  Evidence --> S5["Test (8 files)"]
  S5 --> I5["regression suite"]
  I5 --> R5["Review risk: Test (8 files)"]
  R5 --> V5["targeted test run"]
Loading

@opencode-agent

opencode-agent Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 50bfccf0061f3d0df413b8ee3a174a404aaae62b
  • Workflow run: 31755381875
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 50bfccf0061f3d0df413b8ee3a174a404aaae62b.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow (2 files)"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow (2 files)"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (4 files)"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file (4 files)"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs (2 files)"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs (2 files)"]
  R3 --> V3["docs review"]
  Evidence --> S4["CI script (2 files)"]
  S4 --> I4["review and security gate shell path"]
  I4 --> R4["Review risk: CI script (2 files)"]
  R4 --> V4["bash -n plus Strix self-test"]
  Evidence --> S5["Test (8 files)"]
  S5 --> I5["regression suite"]
  I5 --> R5["Review risk: Test (8 files)"]
  R5 --> V5["targeted test run"]
Loading

Materialize a base Python lock only when every package line is an exact
SHA-256 pin or a two-token relative -r/--requirement include of a
candidate lock path. A lone --require-hashes directive, ./dotted paths,
and -r other-hashes.txt no longer enter the trusted build context.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode could not approve from deterministic current-head evidence because GitHub Checks have failed.

Findings

1. HIGH Current-head GitHub Checks - Fix failed required checks before approval

  • Problem: Failed same-head checks remain for 50bfccf0061f3d0df413b8ee3a174a404aaae62b.
  • Root cause: The model-unavailable evidence fallback is allowed only when peer GitHub Checks are complete and clean.
  • Fix: Read and fix the failed check logs below, then rerun the current-head checks.
  • Regression test: Keep the model-unavailable fallback gated on an empty failed-check rollup.

Failed checks:

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow (2 files)"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow (2 files)"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (4 files)"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file (4 files)"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs (2 files)"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs (2 files)"]
  R3 --> V3["docs review"]
  Evidence --> S4["CI script (2 files)"]
  S4 --> I4["review and security gate shell path"]
  I4 --> R4["Review risk: CI script (2 files)"]
  R4 --> V4["bash -n plus Strix self-test"]
  Evidence --> S5["Test (8 files)"]
  S5 --> I5["regression suite"]
  I5 --> R5["Review risk: Test (8 files)"]
  R5 --> V5["targeted test run"]
Loading

@opencode-agent
opencode-agent Bot disabled auto-merge August 14, 2026 02:55
@seonghobae
seonghobae enabled auto-merge (squash) August 14, 2026 02:56
@opencode-agent
opencode-agent Bot disabled auto-merge August 14, 2026 02:57
@seonghobae
seonghobae enabled auto-merge (squash) August 14, 2026 08:04

Copy link
Copy Markdown
Contributor Author

Exact-current-head revalidation for 50bfccf0061f3d0df413b8ee3a174a404aaae62b over protected base 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

The dedicated Python Native Extension Peer Gate Quality CI and Strix Changed Path Quality CI succeeded. Nine generic security/supply-chain runs were cancelled rather than accepted; I have explicitly re-run their cancelled jobs on this unchanged head. Treat them as pending until terminal. After they complete, submit a current-head read-only verdict only; predecessor-head approvals or findings do not transfer. Do not mutate the branch, self-approve, weaken protection, or merge.

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='789'
head='50bfccf0061f3d0df413b8ee3a174a404aaae62b'
base='6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba'

echo '== PR metadata =='
gh pr view "$pr" --repo "$repo" \
  --json number,state,isDraft,headRefName,headRefOid,baseRefName,baseRefOid,reviewDecision,mergeStateStatus

echo '== checked-out commit =='
git rev-parse HEAD

echo '== requested base...head changed files =='
git diff --name-status "$base...$head"

echo '== exact-head check suites =='
gh api "/repos/$repo/commits/$head/check-suites?per_page=100" --paginate \
  --jq '.check_suites[] | [.app.slug, .status, (.conclusion // "null"), .head_sha, (.workflow_run.html_url // "")] | `@tsv`' || true

echo '== exact-head check runs =='
gh api "/repos/$repo/commits/$head/check-runs?per_page=100" --paginate \
  --jq '.check_runs[] | [.name, .status, (.conclusion // "null"), .head_sha, .html_url] | `@tsv`' || true

echo '== unresolved review threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          comments(first: 1) { nodes { author { login } body path line } }
        }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[]
  | select(.isResolved == false)
  | .comments.nodes[0]
  | [.author.login, (.path // ""), (.line // 0), .body] | `@json`' || true

echo '== workflow integration references =='
rg -n -C 4 \
  -e 'python_native_peer_check_required' \
  -e 'python_native_extension_peer_gate\.py' \
  -e 'classify-pytest' \
  -e 'require-checks' \
  -e 'Python native-extension source-only deferral' \
  -e 'r_peer_check_required' \
  .github/workflows/opencode-review-dispatch.yml

echo '== helper and contract-test outlines =='
ast-grep outline scripts/ci/python_native_extension_peer_gate.py --items all --view expanded
ast-grep outline tests/test_python_native_extension_peer_gate_workflow_contract.py --items all --view expanded

echo '== focused source diff =='
git diff --no-ext-diff --unified=24 "$base...$head" -- \
  .github/workflows/opencode-review-dispatch.yml \
  scripts/ci/python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_file_safety.py \
  tests/test_python_native_extension_peer_gate_requirements_directory.py

Length of output: 117272


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo='ContextualWisdomLab/.github'
pr='789'
head='50bfccf0061f3d0df413b8ee3a174a404aaae62b'
strix_run='31729030143'
strix_job='94614264183'

echo '== failed Strix job log tail =='
gh run view "$strix_run" --repo "$repo" --job "$strix_job" --log-failed 2>&1 | tail -n 240 || true

echo '== duplicate matching-CheckRun handling and regression coverage =='
rg -n -C 6 \
  -e 'len\(matches\)' \
  -e 'if not matches' \
  -e 'duplicate.*[Cc]heck' \
  -e 'append\(.*successful' \
  scripts/ci/python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py

echo '== latest PR reviews on the current head =='
gh pr view "$pr" --repo "$repo" --json reviews,comments \
  --jq '{
    reviews: [.reviews[] | {
      author: .author.login,
      state,
      commit: .commit.oid,
      submittedAt,
      body
    }],
    comments: [.comments[] | {
      author: .author.login,
      createdAt,
      body
    }]
  }' || true

echo '== exact-head check summary after inspection =='
gh api "/repos/$repo/commits/$head/check-runs?per_page=100" --paginate \
  --jq '.check_runs[]
    | select(.name == "strix"
          or .name == "Python 3.14 full quality gate"
          or .name == "Python 3.10 compatibility contract"
          or .name == "coverage-evidence"
          or .name == "opencode-review"
          or .name == "Semgrep (multi-language SAST)"
          or .name == "gitleaks (secret scan)"
          or .name == "generate-sbom"
          or .name == "osv-scan / osv-scan"
          or .name == "Scorecard")
    | [.name, .status, (.conclusion // "null"), .html_url] | `@tsv`' || true

Length of output: 200292


@seonghobae Read-only verdict for current head 50bfccf0061f3d0df413b8ee3a174a404aaae62b:

Blocking source finding

has_required_exact_head_checks() in scripts/ci/python_native_extension_peer_gate.py accepts duplicate matching CheckRun records.

The function requires only a nonempty matches list. It then accepts every matching record when all records are COMPLETED and SUCCESS.

This does not fail closed for ambiguous rerun evidence. A second same-head CI::python, CI::rust, or CI::package record can authorize the gate. The verifier must require exactly one matching record for each required (workflow, name) pair, unless it implements and tests a separate authoritative latest-run rule.

Add a regression that appends a second successful matching record and verifies that require-checks fails.

Current-head gate status

I verified the requested head and base:

  • Head: 50bfccf0061f3d0df413b8ee3a174a404aaae62b
  • Base: 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba

The current head has these non-success states:

  • strix is terminal failure.
  • Python 3.14 full quality gate is in_progress.
  • Python 3.10 compatibility contract is queued for the new rerun.
  • The re-run security and supply-chain checks remain queued.
  • Earlier coverage-evidence and opencode-review runs are cancelled.

I treat the cancelled jobs as non-evidence. I treat the reruns as pending until they reach terminal success on this exact head. I do not transfer predecessor evidence.

GitHub also reports that #789 is not Draft, has CHANGES_REQUESTED, and is merge-blocked.

I do not approve this PR.


✏️ Learnings added
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/.github/pull/789

Timestamp: 2026-08-14T08:06:07.458Z
Learning: For ContextualWisdomLab/.github PR `#789`, a cancelled security or supply-chain check does not count as evidence. A manually re-run replacement check remains pending until it reaches terminal success on the exact current PR head. Predecessor-head check results, findings, and approvals do not transfer.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

@opencode-agent
opencode-agent Bot disabled auto-merge August 14, 2026 08:08
@seonghobae
seonghobae enabled auto-merge (squash) August 15, 2026 05:31
@opencode-agent
opencode-agent Bot disabled auto-merge August 15, 2026 05:31
@seonghobae
seonghobae enabled auto-merge (squash) August 15, 2026 10:32
@opencode-agent
opencode-agent Bot disabled auto-merge August 15, 2026 10:40
@seonghobae
seonghobae marked this pull request as draft August 15, 2026 12:50
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