Skip to content

fix(opencode): bind coverage artifacts to workflow attempts - #812

Draft
seonghobae wants to merge 58 commits into
mainfrom
fix/opencode-attempt-scoped-coverage-artifact
Draft

fix(opencode): bind coverage artifacts to workflow attempts#812
seonghobae wants to merge 58 commits into
mainfrom
fix/opencode-attempt-scoped-coverage-artifact

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Incident and root cause

A failed-jobs-only rerun of central OpenCode run 31022108085 for ContextualWisdomLab/pg-llm-batch#53 reran coverage-evidence without rerunning the already-successful coverage-source-tree producer. Its one-day source artifact had expired, so the consumer failed at actions/download-artifact before tests or docstrings ran.

The previous static artifact name did not bind the consumer to one immutable upload. Extending retention would retain private source evidence longer and would not repair attempt identity.

Exact current state

  • exact head: 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba;
  • protected base/main: e71fdab2ab088001f218765ecb5e3b7fabfee11a;
  • state: Draft / focused control-flow RED;
  • predecessor-head evidence is historical only.

Permanent boundary already implemented

  • each source archive is named with github.run_attempt;
  • the upload step exports its immutable artifact-id and a producer-attested literal run attempt;
  • the consumer validates positive-integer attempt and artifact identity before download;
  • exact artifact-ID download and one-day retention are preserved;
  • coverage-evidence remains limited to actions: read, with no repository-content token, OIDC credential, model secret, or write credential;
  • exact-head, same-repository, merge-tree, archive-member, isolated execution, coverage, docstring, security, and approval boundaries remain unchanged.

Current RED evidence

Exact-head workflow run 31153864111, job 92831560192, reports 1 failed, 4 passed in tests/test_opencode_coverage_artifact_rerun_contract.py.

The remaining defect is control flow after producer failure:

  • Report coverage source materialization failure still exits immediately;
  • that early failure can prevent bounded identity/download recovery guidance from running;
  • the identity, download, and final recovery steps do not yet use the required always()-based aggregate conditions.

Required GREEN repair

  • keep the producer-failure step as a non-terminating diagnostic;
  • run identity validation under always() while retaining continue-on-error and exact current-attempt/artifact-ID checks;
  • download only under always(), producer success, and identity success;
  • run the final missing-source report under always() and fail when producer, identity, or download evidence is not successful;
  • preserve full-rerun/fresh-dispatch guidance;
  • never search or select prior artifacts, weaken retention, add credentials, or create temporary/one-shot/self-modifying branch writers.

Permanent scope

  • .github/workflows/opencode-review-dispatch.yml
  • .github/workflows/opencode-coverage-artifact-rerun-quality-ci.yml
  • tests/test_opencode_coverage_artifact_rerun_contract.py
  • docs/doctoring/opencode-coverage-artifact-reruns.md
  • CHANGELOG.md

Keep Draft until the focused contract, complete central suite, 100% production branch/docstring evidence, compilation, exact-head security/supply-chain checks, automated review, qualifying independent non-author approval, zero actionable threads, and branch protection all succeed without bypass. Closes #811 only after protected merge.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

커버리지 소스 아티팩트를 워크플로 실행 시도와 불변 ID로 연결했습니다. 현재 시도의 아티팩트가 없으면 이전 아티팩트를 사용하지 않고 재실행을 요구합니다. 새 CI는 정확한 소스와 품질 검사를 실행하며, 계약 테스트와 운영 문서를 추가했습니다.

Changes

OpenCode 커버리지 아티팩트 재실행

Layer / File(s) Summary
시도 범위 아티팩트 전달
.github/workflows/opencode-review-dispatch.yml
coverage-source-tree가 실행 시도별 아티팩트를 업로드하고 불변 artifact-id를 출력합니다. coverage-evidence는 이름 검색 대신 해당 ID로 다운로드하며, 현재 시도에 아티팩트가 없으면 작업을 실패시킵니다.
정확한 소스 및 품질 검증
.github/workflows/opencode-coverage-artifact-rerun-quality-ci.yml
새 워크플로가 관련 PR과 push를 감지합니다. Python 3.14와 해시 고정 의존성을 사용하고, 커버리지·docstring·컴파일·생성 상태·공백 검사를 실행합니다.
재실행 운영 계약
CHANGELOG.md, docs/doctoring/opencode-coverage-artifact-reruns.md
아티팩트 보존 기간, 자격 증명 분리, fail-closed 동작, 전체 재실행 및 새 repository dispatch 절차를 기록합니다.
재실행 계약 검증
tests/test_opencode_coverage_artifact_rerun_contract.py
시도별 아티팩트 ID 전달, 누락 시 실패, credential-free consumer, 임시 복구 경로 부재를 검증합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Producer as coverage-source-tree
  participant Artifacts as GitHub Actions artifact store
  participant Consumer as coverage-evidence
  participant Contract as rerun contract tests
  Producer->>Artifacts: 실행 시도별 coverage source 업로드
  Artifacts-->>Producer: immutable artifact-id 반환
  Producer->>Consumer: coverage_source_artifact_id 전달
  Consumer->>Artifacts: artifact-id로 source 다운로드
  Artifacts-->>Consumer: 현재 시도 아티팩트 반환
  Contract->>Consumer: 누락 아티팩트 및 credential-free 계약 검증
Loading

Possibly related PRs

  • ContextualWisdomLab/.github#743: 새 커버리지 워크플로의 해시 고정 의존성과 브랜치 커버리지 검사가 기존 신뢰된 의존성 materialization 및 품질 게이트를 기반으로 합니다.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed 워크플로 시도별 아티팩트 ID, 현재 시도만의 다운로드, 실패 시 안내, 보존 기간과 자격 증명 분리를 구현해 이슈 #811의 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed 변경 범위는 관련 워크플로, 회귀 테스트, 문서 및 변경 로그로 제한되어 있으며 이슈 #811의 목적과 일치합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 커버리지 아티팩트를 워크플로 실행 시도에 연결하는 핵심 변경을 정확하고 간결하게 설명합니다.
✨ 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/opencode-attempt-scoped-coverage-artifact

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

Copy link
Copy Markdown
Contributor Author

Release blocker: current head 54436c6119a790bd8d99b485aa0fe5d0e8b30332 has regressed into a branch-writing materialization design. The permanent diff currently contains .github/opencode-attempt-scoped-coverage-artifact.trigger, materialize-opencode-attempt-scoped-coverage-artifact.yml, and opencode-coverage-artifact-rerun-repair.yml instead of the direct production repair. Do not execute or merge this supply-chain path.

@opencode-agent address

Delete every trigger, materializer, repair, self-removing, encoded-patch, and branch-push workflow from the final tree. Implement the fix through ordinary reviewed commits directly in the authoritative central OpenCode workflow and permanent tests/docs/changelog only.

The final contract must bind source evidence to the current workflow attempt without inventing a mutable fallback:

  • producer uploads an attempt-qualified artifact and exposes the exact immutable artifact-id;
  • consumer downloads only that ID from the same attempt;
  • a failed-jobs-only rerun with no producer output in the current attempt fails early with bounded guidance to use a full rerun or fresh repository dispatch;
  • no lookup by static name, previous attempt, newest artifact, or expired artifact;
  • one-day retention and source confidentiality stay unchanged;
  • coverage-evidence retains only actions: read, with no contents, OIDC, repository credential, or secrets;
  • producer remains the separately credentialed exact-head source materializer;
  • all existing PR metadata, same-repository, merge-tree, archive, sandbox, coverage, docstring, and approval gates remain fail-closed.

Preserve the permanent RED contract, then prove RED against protected main and GREEN after the ordinary source change. The final PR diff must contain no temporary workflow or trigger and must pass complete 100% production statement/branch/docstring coverage, compilation, all security/supply-chain checks, exact-head review, and independent approval.

Copy link
Copy Markdown
Contributor Author

@jules Replace the temporary trigger/materializer/repair scope on exact live head 17d16cfe230b22b5bdf6014ef8f2388d6952531d with the ordinary reviewed attempt-scoped artifact fix directly in the authoritative central workflow. Keep Draft.

Delete .github/opencode-attempt-scoped-coverage-artifact.trigger, .github/workflows/materialize-opencode-attempt-scoped-coverage-artifact.yml, .github/workflows/opencode-coverage-artifact-rerun-repair.yml, scripts/ci/prepare_opencode_attempt_artifact_patch.py, and any other transient branch writer/finalizer. Retain the permanent quality workflow, permanent contract test, APA 7 operator doctoring, and authoritative CHANGELOG material.

Implement only this exact contract in .github/workflows/opencode-review-dispatch.yml:

  • coverage-source-tree uses an attempt-qualified artifact name and exposes the immutable actions/upload-artifact artifact-id as a job output;
  • coverage-evidence downloads only that exact ID from the current workflow attempt;
  • a failed-jobs-only rerun with no current-attempt producer output fails early with bounded guidance to perform a full rerun or fresh repository dispatch;
  • never query by static name, previous/newest attempt, or expired artifact;
  • retain one-day retention and exact-head source confidentiality;
  • retain the credentialed producer separation;
  • keep coverage-evidence at actions: read only, without contents, OIDC, repository credential, or secrets;
  • preserve exact PR metadata, same-repository, merge-tree, archive-member, sandbox, test, coverage, docstring, R/PyO3 peer, review, and approval gates unchanged.

Prove the permanent contract RED against the inherited source and GREEN after the direct repair. Run complete central tests, compilation, 100% production statement/branch/public-docstring evidence for any helper, actionlint/workflow syntax, every security and supply-chain gate, and git diff --check. Commit normally; no amend, force-push, additional workflow, Ready transition, approval, merge, release, credential/protection change. Stop without mutation if the live head differs before writing.

@seonghobae
seonghobae marked this pull request as ready for review August 7, 2026 00:20
@seonghobae
seonghobae marked this pull request as draft August 7, 2026 00:22

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact-head rerun-safety blocker on cae2d8f9e7c95e9044bb77468f6c1b132889a37b: the workflow binds the consumer to an immutable artifact-id, but it does not prove that the successful producer job actually ran in the current workflow attempt. GitHub explicitly supports failed-job-only and specific-job reruns while retaining the same workflow run identity, and run attempts are distinct. If upstream successful job outputs remain available to the rerun, coverage-evidence can receive the earlier producer's artifact ID; while the one-day artifact is still retained, that exact-ID download can succeed even though coverage-source-tree did not run in the current attempt. This contradicts this PR's stated contract that failed-jobs-only reruns must not reuse prior-attempt source evidence.

Fix test-first before merge. Add a permanent RED assertion that the producer records the literal attempt in a step output (for example coverage_source_run_attempt: ${{ steps.coverage_source_attempt.outputs.run_attempt }} where the step writes the current GITHUB_RUN_ATTEMPT), then make coverage-evidence compare that producer-attested value with its current ${{ github.run_attempt }} before artifact download and fail closed on empty or mismatched values with full-rerun/fresh-dispatch guidance. Keep the immutable artifact-ID download, one-day retention, and credential separation unchanged. Using a step-produced literal is important: a job output expression that directly re-evaluates github.run_attempt would not attest when the producer actually executed.

Also update doctoring/changelog to distinguish artifact immutability from current-attempt provenance and retain APA 7 primary-source references. GitHub's current rerun documentation confirms selective reruns and distinct attempts; actions/upload-artifact@v7 confirms artifact-id is immutable/unique but does not itself attest current-attempt execution.

Copy link
Copy Markdown
Contributor Author

@coderabbitai autofix

Exact current head 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba still violates the already-published RED control-flow contract in tests/test_opencode_coverage_artifact_rerun_contract.py. Apply the smallest direct source repair on the existing branch only:

  1. In Report coverage source materialization failure, use if: ${{ always() && needs.coverage-source-tree.result != 'success' }} and remove exit 1; retain the diagnostic.
  2. Add if: ${{ always() }} to Verify coverage source identity for current workflow attempt; retain continue-on-error: true, producer-attested run-attempt comparison, numeric artifact-ID validation, and fresh-full-rerun guidance.
  3. Gate Download current-attempt materialized pull request merge tree on ${{ needs.coverage-source-tree.result == 'success' && steps.coverage_source_identity.outcome == 'success' }}; retain immutable ID download and continue-on-error: true.
  4. Use ${{ always() && (needs.coverage-source-tree.result != 'success' || steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success') }} for the final missing-source report, which must remain the single terminating exit 1 path.
  5. Do not create a patch artifact, helper workflow, branch, or pull request. Do not change credentials, action pins, retention, archive validation, or evidence semantics.
  6. Run the focused contract and complete permanent quality gate before committing. Resolve the still-open CodeRabbit thread only after exact-head verification.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

The agent generated fixes only for .github/workflows/ files, which cannot be committed due to permission restrictions. Please apply these changes manually.


⚠️ 1 file(s) could not be committed — the agent does not have permission to push to .github/workflows/. Please apply these changes manually:

.github/workflows/opencode-review-dispatch.yml — 3 changes:

Lines 447–456
         if: needs.coverage-source-tree.result != 'success'
         run: |
           echo "::error::Coverage source tree could not be materialized; see the coverage-source-tree job log for the exact target repository, base SHA, head SHA, and fetch or merge failure."
-          exit 1
 
       - name: Verify coverage source identity for current workflow attempt
         id: coverage_source_identity
+        if: always()
         continue-on-error: true
         env:
           COVERAGE_SOURCE_ARTIFACT_ID: ${{ needs.coverage-source-tree.outputs.coverage_source_artifact_id }}
Lines 473–479
           printf 'artifact_id=%s\n' "$artifact_id" >>"$GITHUB_OUTPUT"
 
       - name: Download current-attempt materialized pull request merge tree
-        if: steps.coverage_source_identity.outcome == 'success'
+        if: needs.coverage-source-tree.result == 'success' && steps.coverage_source_identity.outcome == 'success'
         id: coverage_source_download
         continue-on-error: true
         uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Lines 482–488
           path: ${{ runner.temp }}/opencode-coverage-artifact
 
       - name: Report missing current-attempt coverage source
-        if: steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success'
+        if: always() && (needs.coverage-source-tree.result != 'success' || steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success')
         env:
           GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
         run: |

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Implement the exact minimal workflow control-flow repair in comment 5213612449 on existing head 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba. The permanent RED contract already exists in tests/test_opencode_coverage_artifact_rerun_contract.py; do not weaken it. Apply always() to the diagnostic/identity/final gate, keep the first report non-terminating, gate immutable-ID download on producer and identity success, and retain one final terminating missing-source path with fresh-full-rerun guidance. Preserve action pins, one-day retention, producer-attested run-attempt binding, credential-free consumer, archive validation, and exact-head evidence. Update this branch only; do not create a branch, PR, patch artifact, helper workflow, approval bypass, merge, release, or force push. Run the focused contract and complete permanent quality gate before committing.

Copy link
Copy Markdown
Contributor Author

/oc Refetch exact live head and abort unless it is 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba. Fix the same-head failure in OpenCode Coverage Artifact Rerun Quality CI run 31153864111, job 92794532770, by completing the already-written contract in tests/test_opencode_coverage_artifact_rerun_contract.py directly in .github/workflows/opencode-review-dispatch.yml. The producer-failure reporting step must emit bounded diagnostics but return success so the single final recovery step remains reachable. Add if: always() to the current-attempt identity step; gate the download on needs.coverage-source-tree.result == 'success' and successful identity; make the final missing-source step use if: always() && ( covering producer failure, identity failure, or download failure, and make that one step issue full-rerun/fresh-dispatch guidance and exit 1. Preserve immutable artifact ID binding, run-attempt equality, one-day retention, credential-free actions: read consumer, exact-head archive validation, and all isolation/coverage/security gates. Run the focused test first, then complete central tests/coverage/docstrings, and commit only this PR branch if green. Do not add temporary workflows, repair helpers, branch writers, or extend artifact retention.

Copy link
Copy Markdown
Contributor Author

/oc Fix only the fresh exact-head regression on 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba; stop without writing if the live head differs. OpenCode Coverage Artifact Rerun Quality CI run 31153864111, job 92794532770 fails test_missing_or_expired_artifact_fails_with_bounded_recovery_guidance because the test still asserts that the producer-failure reporting step contains no exit 1, while the current workflow deliberately fails closed when the current attempt's producer did not succeed.

First inspect the exact workflow step and intended recovery contract. Do not weaken fail-closed behavior merely to satisfy the assertion. If the current exit 1 is the intended security/reliability boundary, update the permanent contract test to require the bounded diagnostic plus hard failure, while preserving the separate missing/expired-artifact guidance path and exact run-attempt/artifact-id binding. If the hard failure is misplaced and prevents the intended same-attempt recovery path, fix production instead. Preserve one-day retention, immutable producer artifact ID, exact-head/source identity checks, least-privilege actions: read consumer, no content/model/OIDC/write credential in coverage evidence, no stale/static artifact fallback, and no failed-jobs-only stale reuse.

Use the observed CI failure as RED, then run the focused artifact-rerun contract to GREEN, full central suite with 100% statement/branch coverage, 100% public docstrings, compileall, and git diff --check. Commit normally on this existing branch. Do not create another branch, PR, workflow, repair helper, patch artifact/fragment, classifier, or bypass; do not merge or mark Ready.

Copy link
Copy Markdown
Contributor Author

@opencode-agent Implement the minimal permanent GREEN repair directly on exact current head 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba of branch fix/opencode-attempt-scoped-coverage-artifact.

The exact-head quality failure is deterministic: run 31153864111, job 92789017624, test tests/test_opencode_coverage_artifact_rerun_contract.py::test_missing_or_expired_artifact_fails_with_bounded_recovery_guidance fails because the producer-failure reporting step exits before the attempt-bound identity/recovery path can execute.

Modify only the existing permanent five-file slice as needed, with the production change limited to .github/workflows/opencode-review-dispatch.yml unless a truthful contract/doc/changelog adjustment is required. Preserve all exact-head, credential, archive-validation, one-day-retention, and fail-closed boundaries.

Required workflow behavior:

  1. Report coverage source materialization failure must report the producer failure without exit 1, allowing the final bounded recovery step to own the failure.
  2. Verify coverage source identity for current workflow attempt must use if: always() and retain continue-on-error: true.
  3. Download current-attempt materialized pull request merge tree must run only when needs.coverage-source-tree.result == 'success' and steps.coverage_source_identity.outcome == 'success'.
  4. Report missing current-attempt coverage source must use always() and fail when the producer failed, identity validation failed, or exact-ID download failed.
  5. A failed-jobs-only rerun must never reuse another attempt’s artifact, static artifact name, stale ID, or expired evidence.
  6. Do not touch the LLVM runtime-boundary work tracked separately in fix(coverage): preserve LLVM 19 across isolated Rust evidence #816, do not create a temporary/self-removing/encoded-patch/branch-writer workflow, and do not modify reviewer identities or model credentials.

Run the focused contract first, then the complete exact-head quality suite, coverage, docstrings, compileall, git diff --check, and current security/supply-chain checks. Keep the PR Draft until the exact new head is GREEN. Do not merge, approve, enable bypass, rebase, retarget, release, or publish.

Copy link
Copy Markdown
Contributor Author

/oc Refetch the live pull request and abort unless its exact head is 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba. Exact-head quality run 31153864111, job 92827882170, is RED with 1 failed, 4 passed: test_missing_or_expired_artifact_fails_with_bounded_recovery_guidance proves that Report coverage source materialization failure still executes exit 1, suppressing the final bounded recovery guidance. Apply the minimum direct GREEN repair on this branch only. In .github/workflows/opencode-review-dispatch.yml, make that early report a non-terminating diagnostic by removing only its exit 1; retain the producer-result condition. Preserve Verify coverage source identity for current workflow attempt as if: always() plus continue-on-error: true, keep download gated on producer success and identity success with the validated numeric artifact ID, and keep Report missing current-attempt coverage source as the sole fail-closed terminal step using always() and exit 1 for producer, identity, or download failure. Do not weaken artifact ID/run-attempt binding, one-day retention, immutable action pins, actions: read credential-free consumer permissions, exact-head/archive validation, or source privacy. Run tests/test_opencode_coverage_artifact_rerun_contract.py first, then the complete exact-head central suite, 100% statement/branch coverage, production docstrings, compilation, and clean generated state. Do not create a helper branch, PR, patch artifact, encoded patch, or one-shot/self-modifying workflow. Keep Draft until the new exact head is green and resolve the existing actionable thread only after verification.

Copy link
Copy Markdown
Contributor Author

@opencode-agent Repair exact current head 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba directly on this branch. The sole focused failure is tests/test_opencode_coverage_artifact_rerun_contract.py::test_missing_or_expired_artifact_fails_with_bounded_recovery_guidance.

In .github/workflows/opencode-review-dispatch.yml, the step Report coverage source materialization failure currently emits the source-tree diagnostic and immediately exit 1, which prevents the later always-running identity/download outcomes from reaching the unified Report missing current-attempt coverage source fail-closed recovery step. Remove only that premature exit so the job continues through the continue-on-error identity/download gates and the final recovery step emits the bounded failed-jobs-only/full-rerun guidance and exits nonzero.

Preserve:

  • the initial materialization diagnostic;
  • coverage_source_identity and coverage_source_download continue-on-error boundaries;
  • exact artifact-ID/run-attempt binding;
  • actions: read-only credential-free consumer;
  • the final recovery step's exit 1;
  • absence of list-artifacts fallback and temporary branch writers.

Run the focused five-test contract first, then the complete repository quality/security suite. Do not weaken the final fail-closed result, add a repair workflow, or open a stacked PR.

Copy link
Copy Markdown
Contributor Author

/oc Refetch the exact live PR head and abort unless it is 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba. Fix OpenCode Coverage Artifact Rerun Quality CI run 31153864111 directly on this branch. The focused RED contract correctly shows that Report coverage source materialization failure exits immediately, so the bounded full-rerun/fresh-dispatch recovery guidance is unreachable. Preserve fail-closed semantics without making producer failure pass: remove the early exit 1 from that reporting step, record an explicit producer-failed output/state, gate identity/download/materialization steps on producer success, ensure Report missing current-attempt coverage source runs with always() for producer, identity, or download failure, emits bounded guidance, and then terminates the evidence job nonzero after guidance. Do not continue into tests using absent/stale artifacts; do not weaken attempt/artifact-ID binding, one-day retention, exact-head validation, least privilege, or coverage/docstring gates. Run tests/test_opencode_coverage_artifact_rerun_contract.py first, then complete exact-head tests/coverage/docstrings/security. Do not create a temporary or branch-writer workflow.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Fix exact head 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba directly. Run 31153864111 proves the focused recovery contract remains RED: Report coverage source materialization failure still exits immediately, so the later current-attempt identity/download recovery step and bounded full-rerun guidance are unreachable when the producer fails.

Implement the minimum canonical control-flow repair in .github/workflows/opencode-review-dispatch.yml and update only the permanent contract if necessary:

  • keep the producer-failure diagnostic observable but non-terminal;
  • guard identity and download steps with always() plus producer-success predicates;
  • make the single Report missing current-attempt coverage source step run for producer failure, identity failure, or download failure and fail closed there with full-rerun/fresh-dispatch guidance;
  • ensure no prior-attempt/latest-artifact lookup or source reconstruction fallback exists;
  • retain exact artifact-ID and run-attempt binding, one-day retention, actions: read only for coverage evidence, exact-head source/archive validation, and all existing isolation/approval gates.

Run the five focused tests and complete exact-head suite. Do not create a temporary/self-modifying repair workflow or merely weaken the test.

Copy link
Copy Markdown
Contributor Author

@opencode-agent Apply the minimal permanent GREEN repair directly on exact Draft head 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba; do not create temporary, self-removing, encoded-patch, or branch-writing workflows.

Current exact-head quality run 31153864111 fails only because Report coverage source materialization failure exits before the bounded same-attempt recovery step can publish actionable guidance. The regression requires exit 1 to be absent from that producer-failure reporting step.

Required behavior:

  • keep if: needs.coverage-source-tree.result != 'success' on Report coverage source materialization failure;
  • report the producer failure, but do not terminate there;
  • let Verify coverage source identity for current workflow attempt, the conditional exact-artifact-ID download, and Report missing current-attempt coverage source remain the sole fail-closed recovery path;
  • preserve rejection of prior-attempt, missing, expired, malformed, name-selected, or latest-selected evidence;
  • preserve one-day retention, current-attempt artifact ID binding, credential-free consumer permissions, archive validation, exact-head materialization, and no repository/model/write credentials in coverage-evidence;
  • run the focused contract, complete central test/branch coverage, docstrings, compileall, and clean-tree checks on the unchanged resulting head.

Keep Draft; do not approve, merge, release, alter reviewer credentials, or weaken branch protection.

Copy link
Copy Markdown
Contributor Author

@coderabbitai autofix

Apply only the existing exact-head blocker on 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba: in .github/workflows/opencode-review-dispatch.yml, remove the premature exit 1 from Report coverage source materialization failure so the later always-running identity/download gates reach Report missing current-attempt coverage source, which remains the sole terminal fail-closed step. Commit directly to this PR branch; do not open another PR or add a repair workflow. Preserve all artifact-ID, run-attempt, credential, privacy, action-pin, and final failure contracts.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

The agent generated fixes only for .github/workflows/ files, which cannot be committed due to permission restrictions. Please apply these changes manually.


⚠️ 1 file(s) could not be committed — the agent does not have permission to push to .github/workflows/. Please apply these changes manually:

.github/workflows/opencode-review-dispatch.yml — 3 changes:

Lines 447–455
         if: needs.coverage-source-tree.result != 'success'
         run: |
           echo "::error::Coverage source tree could not be materialized; see the coverage-source-tree job log for the exact target repository, base SHA, head SHA, and fetch or merge failure."
-          exit 1
 
       - name: Verify coverage source identity for current workflow attempt
+        if: always()
         id: coverage_source_identity
         continue-on-error: true
         env:
Lines 473–479
           printf 'artifact_id=%s\n' "$artifact_id" >>"$GITHUB_OUTPUT"
 
       - name: Download current-attempt materialized pull request merge tree
-        if: steps.coverage_source_identity.outcome == 'success'
+        if: needs.coverage-source-tree.result == 'success' && steps.coverage_source_identity.outcome == 'success'
         id: coverage_source_download
         continue-on-error: true
         uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Lines 482–488
           path: ${{ runner.temp }}/opencode-coverage-artifact
 
       - name: Report missing current-attempt coverage source
-        if: steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success'
+        if: always() && (needs.coverage-source-tree.result != 'success' || steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success')
         env:
           GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
         run: |

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The exact-head quality contract has one blocking control-flow defect. Apply the inline minimal suggestion, rerun the focused five-test contract, then the complete current-head quality/security suite. Keep Draft until GREEN.

@@ -433,12 +449,48 @@ jobs:
echo "::error::Coverage source tree could not be materialized; see the coverage-source-tree job log for the exact target repository, base SHA, head SHA, and fetch or merge failure."
exit 1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This early termination prevents the later continue-on-error identity/download gates and the unified recovery step from emitting the required failed-jobs-only/full-rerun guidance. Keep this as a non-terminating diagnostic; the later Report missing current-attempt coverage source step remains the sole fail-closed exit.

Suggested change
exit 1
# Continue to the unified current-attempt recovery gate for bounded fail-closed guidance.

Copy link
Copy Markdown
Contributor Author

@coderabbitai autofix

Apply the exact inline suggestion from review 4881959011 directly to this PR branch, then run the focused contract. Do not open another PR or add any repair workflow.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

The agent generated fixes only for .github/workflows/ files, which cannot be committed due to permission restrictions. Please apply these changes manually.


⚠️ 1 file(s) could not be committed — the agent does not have permission to push to .github/workflows/. Please apply these changes manually:

.github/workflows/opencode-review-dispatch.yml — 3 changes:

Lines 447–456
         if: needs.coverage-source-tree.result != 'success'
         run: |
           echo "::error::Coverage source tree could not be materialized; see the coverage-source-tree job log for the exact target repository, base SHA, head SHA, and fetch or merge failure."
-          exit 1
 
       - name: Verify coverage source identity for current workflow attempt
         id: coverage_source_identity
+        if: always()
         continue-on-error: true
         env:
           COVERAGE_SOURCE_ARTIFACT_ID: ${{ needs.coverage-source-tree.outputs.coverage_source_artifact_id }}
Lines 473–479
           printf 'artifact_id=%s\n' "$artifact_id" >>"$GITHUB_OUTPUT"
 
       - name: Download current-attempt materialized pull request merge tree
-        if: steps.coverage_source_identity.outcome == 'success'
+        if: needs.coverage-source-tree.result == 'success' && steps.coverage_source_identity.outcome == 'success'
         id: coverage_source_download
         continue-on-error: true
         uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Lines 482–488
           path: ${{ runner.temp }}/opencode-coverage-artifact
 
       - name: Report missing current-attempt coverage source
-        if: steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success'
+        if: always() && (needs.coverage-source-tree.result != 'success' || steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success')
         env:
           GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
         run: |

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Implement the existing RED contract directly on fix/opencode-attempt-scoped-coverage-artifact; refetch and abort unless the live head is 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba. The failing exact-head run is 31153864111, job 92831560192, and the focused failure is test_missing_or_expired_artifact_fails_with_bounded_recovery_guidance because Report coverage source materialization failure still exits before bounded recovery.

Modify only .github/workflows/opencode-review-dispatch.yml unless matching doctoring/changelog text is provably stale:

  1. Keep Report coverage source materialization failure as a non-terminating diagnostic when needs.coverage-source-tree.result != 'success'; remove its exit 1.
  2. Give Verify coverage source identity for current workflow attempt an explicit if: always() and retain continue-on-error: true plus current-attempt/artifact-ID fail-closed validation.
  3. Gate Download current-attempt materialized pull request merge tree with always(), producer success, and identity success; retain exact immutable artifact-ID download and continue-on-error: true.
  4. Make Report missing current-attempt coverage source use always() and fail with exit 1 when the producer failed, identity failed, or download failed, preserving full-rerun/fresh-dispatch guidance.
  5. Do not list/search earlier artifacts, weaken one-day retention, add credentials, or create a temporary/one-shot/self-modifying writer workflow.

Run the focused five-test contract, complete central suite with 100% branch coverage, production docstrings, compileall, and clean-tree checks. Keep Draft until the new exact head is green.

Copy link
Copy Markdown
Contributor Author

@coderabbitai Please fix the deterministic exact-head failure directly on branch fix/opencode-attempt-scoped-coverage-artifact and commit the change, not as a stacked PR. In .github/workflows/opencode-review-dispatch.yml, the Report coverage source materialization failure step must report the producer failure but must not exit 1, because that early exit prevents the Verify coverage source identity for current workflow attempt and Report missing current-attempt coverage source steps from emitting the bounded full-rerun/fresh-dispatch recovery guidance. Remove only that early exit 1; preserve the later recovery step’s fail-closed exit 1, exact artifact-id/run-attempt binding, one-day retention, read-only consumer permissions, and every exact-head isolation gate. Run tests/test_opencode_coverage_artifact_rerun_contract.py first, then the full quality/security suite. Keep Draft and do not merge.

Copy link
Copy Markdown
Contributor Author

/oc

Refetch PR #812 and repair only its live Draft head; abort on movement. The focused current-head contract proves producer-failure recovery is unreachable because Report coverage source materialization failure exits before current-attempt identity/download handling. Make that diagnostic non-terminal, guard identity/download with always() plus producer-success predicates, and make the single missing-current-attempt recovery step cover producer, identity, or download failure and fail closed with full-rerun/fresh-dispatch guidance. Preserve exact artifact-ID and run-attempt binding, one-day retention, actions: read only, and reject any latest/prior-attempt fallback. Run the five focused tests and complete exact-head suite, commit directly, and do not create a repair workflow or weaken the contract.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address
@cwl-noema-review

Repair exact current head 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba directly; keep Draft and do not merge or create a one-shot writer. Permanent quality run 31153864111, job 92831560192, has one deterministic RED contract: test_missing_or_expired_artifact_fails_with_bounded_recovery_guidance rejects exit 1 in the Report coverage source materialization failure step. That early exit prevents the subsequent current-attempt identity/download/recovery steps from emitting the bounded full-rerun or fresh-dispatch guidance this PR is intended to guarantee. Remove only the premature producer-failure termination, preserve fail-closed job conclusion through the later recovery path, retain one-day retention, immutable artifact-id, attempt binding, actions: read consumer permissions, credential separation, and all existing exact-head/security contracts. Run the focused contract, complete central tests with 100% statement/branch coverage and docstrings, compilation, clean-tree validation, every security/supply-chain workflow, and fresh exact-head reviews.

Copy link
Copy Markdown
Contributor Author

/oc Refetch the live head and continue only if it is 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba. Apply the existing one-line control-flow repair directly in .github/workflows/opencode-review-dispatch.yml: in Report coverage source materialization failure, retain the diagnostic but remove the premature exit 1, allowing the later continue-on-error identity/download steps to reach Report missing current-attempt coverage source, which remains the sole terminal fail-closed exit and emits full-rerun/fresh-dispatch guidance. Preserve exact artifact-ID/run-attempt binding, one-day retention, actions:read-only consumer, all action pins and security boundaries. Run the focused five-test contract, then the complete suite. Commit directly here; no new PR or repair workflow.

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Apply the sole remaining exact-head control-flow repair directly to 2137012a2bf57b19a36f20ff6dcaac3e3e3b8cba on fix/opencode-attempt-scoped-coverage-artifact. Do not add a temporary, self-mutating, staged-patch, encoded-patch, helper, or branch-writer workflow.

In .github/workflows/opencode-review-dispatch.yml, make Report coverage source materialization failure a non-terminating diagnostic by removing its early exit 1. Preserve its always() producer-result diagnostic. The later Verify coverage source identity for current workflow attempt and artifact download must continue to run under their existing fail-closed outcome gates, and Report missing current-attempt coverage source must remain the single terminal exit 1 that emits full-rerun/fresh-dispatch guidance for producer absence/failure, attempt-identity failure, invalid artifact ID, or download failure.

Strengthen tests/test_opencode_coverage_artifact_rerun_contract.py only as needed to prove that the diagnostic cannot suppress the later identity/download/recovery sequence. Run the focused contract, complete repository quality suite, actionlint/YAML checks, 100% production statement/branch/public-docstring gates, all security/supply-chain checks, and git diff --check before pushing. Resolve only findings actually addressed by the new head; then request fresh exact-head read-only review. Do not approve, merge, release, or alter branch protection.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The remaining exact-head contract also requires explicit always() aggregate conditions. Apply these three direct YAML suggestions together with removal of the earlier premature exit, then rerun the focused five-test contract.


- name: Download materialized pull request merge tree
- name: Verify coverage source identity for current workflow attempt
id: coverage_source_identity

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Identity validation must still run after a producer failure so it can produce a bounded, inspectable outcome for the unified recovery gate.

Suggested change
id: coverage_source_identity
if: always()
id: coverage_source_identity

printf 'artifact_id=%s\n' "$artifact_id" >>"$GITHUB_OUTPUT"

- name: Download current-attempt materialized pull request merge tree
if: steps.coverage_source_identity.outcome == 'success'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Download must run only for a successful producer and successful current-attempt identity, while remaining evaluable under failed-job reruns.

Suggested change
if: steps.coverage_source_identity.outcome == 'success'
if: >-
always()
&& needs.coverage-source-tree.result == 'success'
&& steps.coverage_source_identity.outcome == 'success'

path: ${{ runner.temp }}/opencode-coverage-artifact

- name: Report missing current-attempt coverage source
if: steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make the final recovery step authoritative for every producer, identity, or download failure.

Suggested change
if: steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success'
if: >-
always()
&& (
needs.coverage-source-tree.result != 'success'
|| steps.coverage_source_identity.outcome != 'success'
|| steps.coverage_source_download.outcome != 'success'
)

Copy link
Copy Markdown
Contributor Author

@coderabbitai autofix

Apply every exact inline suggestion in reviews 4881959011 and 4882311801 directly on this PR branch, including removal of the premature producer-failure exit and the three always() aggregate conditions. Run the focused five-test contract. Do not open another PR or add a repair workflow.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

The agent generated fixes only for .github/workflows/ files, which cannot be committed due to permission restrictions. Please apply these changes manually.


⚠️ 1 file(s) could not be committed — the agent does not have permission to push to .github/workflows/. Please apply these changes manually:

.github/workflows/opencode-review-dispatch.yml — 3 changes:

Lines 447–455
         if: needs.coverage-source-tree.result != 'success'
         run: |
           echo "::error::Coverage source tree could not be materialized; see the coverage-source-tree job log for the exact target repository, base SHA, head SHA, and fetch or merge failure."
-          exit 1
 
       - name: Verify coverage source identity for current workflow attempt
+        if: always()
         id: coverage_source_identity
         continue-on-error: true
         env:
Lines 473–479
           printf 'artifact_id=%s\n' "$artifact_id" >>"$GITHUB_OUTPUT"
 
       - name: Download current-attempt materialized pull request merge tree
-        if: steps.coverage_source_identity.outcome == 'success'
+        if: needs.coverage-source-tree.result == 'success' && steps.coverage_source_identity.outcome == 'success'
         id: coverage_source_download
         continue-on-error: true
         uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Lines 482–488
           path: ${{ runner.temp }}/opencode-coverage-artifact
 
       - name: Report missing current-attempt coverage source
-        if: steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success'
+        if: always() && (needs.coverage-source-tree.result != 'success' || steps.coverage_source_identity.outcome != 'success' || steps.coverage_source_download.outcome != 'success')
         env:
           GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
         run: |

Copy link
Copy Markdown
Contributor Author

/oc

Continue from the exact current head. Verify the permanent coverage-artifact rerun control flow rather than trusting predecessor green runs. The early producer diagnostic must never terminate before recovery guidance; identity validation must run only after producer success and validate the current attempt plus a positive decimal artifact ID; download must require producer and identity success; the final missing-source report must use always() and fail closed for producer, identity, or download failure; preparation must run only on the complete-success path. Strengthen executable step-order tests for failed/skipped producer, malformed ID, identity failure, and download failure. Keep the one-day retention, immutable artifact ID, least privilege, five-file permanent scope, complete central 100% coverage/docstrings, Python 3.10/3.14, and actionlint. Remove every temporary branch writer, rerun exact-head checks, resolve only addressed threads, and mark Ready only when green. Do not merge or bypass protection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] Make OpenCode coverage artifact handoff attempt-scoped and rerun-safe

2 participants