← Back to Pull requests

feat(release): compose a candidate's evidence with its lane-scoped retry #2472

Closed
unknown closed this pull request without merging on Oct 22, 2026 07:21 UTC
View on GitHub
unknown unknown commented on Oct 22, 2026 06:06 UTC
Author

Summary

Item 8 of the "Next" plan in #2422, PR 2 of 2 (PR 1: #2471 added the retry request). A candidate batch that lost lanes to the platform can now be released through its one lane-scoped retry instead of a new cut and a full 4–5 hour batch. Decision: docs/prd/decisions/2026-10-22-candidate-lane-retry.md (Owner confirmed 2026-10-22); plan: docs/plans/2026-10-22-lmdj-candidate-lane-retry.md.

The invariants kept: attempt 1 is the only admissible attempt everywhere; every suite's passing evidence comes from exactly one run; a candidate's failure conclusion is accepted only through lanes proven environmental on its own jobs API; a lane that failed on a test is never covered.

Change

  • tools/release/batch_reference.py: lmdj.ci-batch-release-reference.v2 is the v1 record of the candidate run plus exactly one retries record: the retry's frozen request (kind retry, focused or full selection, retry_of naming the candidate with a closed environmental proof per retried suite), its executor control/event, digests and executor_run_id. v1 parses unchanged; parse_reference is shared by the ledger model, the intent spec, the consumer and the carrier.

  • tools/release/batch_evidence.py: _verify is split into _verify_record (one run's complete proof, with the status the reference claims for it) and _compose: the retry covers exactly the suites the candidate's verdict did not pass; each such suite is a debt outcome, or failed with its failures naming exactly the proof's jobs and each job's conclusion on the candidate run's jobs API timed_out/cancelled and equal to the proof; the retry verdict passes every retried suite. A composite's candidate run must have concluded failure and its verdict failed; a plain reference still needs a passed one. Published mode reads both runs. Retention covers all six artifacts.

  • tools/release/verification.py: retry_result(events, witness, original_id) finds the unique terminal retry result through the journal's frozen request (two are a conflict, another candidate's retry never composes); _result_for admits a non-passed candidate only with a terminal passed retry over exactly its non-passed suites; release_reference composes the v2 document from retained facts (_record per run); the evidence reference string gains ;retry:<run>.

  • tools/release/verified_recheck.py and tools/release/carriers.py: the reference regex accepts the optional ;retry:<run>; the recheck re-verifies the candidate run as the completed failed run it was composed over and the retry run as a completed passed attempt 1, each drift a conflict.

  • tools/release/audit.py: the permanent marker's ci.conclusion is the candidate executor's actual conclusion (failure for a composite); prepare already records it.

  • scripts/ci/batch_verdict.py: a retry selection is canonical but not closed over the dependency graph. Found while fixturing: without this, a retry of a suite with dependents (for example core_asan) could never produce a valid verdict, because build demanded the closure; the closure rule exists for changes, and a retry re-runs lanes.

  • Governance and skill: docs/governance/version-management.md §12.1 (the retry short form, the v2 composition rule and what the consumer checks), the pipeline design §3 sentence, the lmdj-release skill (composed source in the evidence precondition, the retry short form beside the candidate dispatch, recovery wording); the plan records PR 2's files and tests.

  • Tests: consumer fixture compose_retry (a stress lane the platform timed out, a retry executed by run 104 admitted through the real reducer) with ten composite cases; carrier (four), recheck (three), ledger model (one with six refusals), enrollment (one), binding (one through plan, marker and audit), verdict (one), skill pins.
  • Related Issue

    Related issue: #2422

    Premise refresh (issue-done §0)

    Base: origin/main at 54cca7fc449e79cd4fe10302d3696dd0a45552b2 (#2471). Verified on the base: verification._candidate_results selects candidate-kind results only and _result_for fails any non-passed outcome; batch_evidence._verify requires one passed full-selection run; parse_reference knows v1 only; verified_recheck and carriers parse batch-result:<run>:<witness> only; audit expects "conclusion": "success"; batch_verdict.build closes every selection. The design doc and version policy still said "不接受 Re-run jobs" and "exactly one passed source" without the composed form. Still outstanding; delivered here. No release request is active (every journal request is retired; no driver process).

    Verification

  • The new tests were written against the implemented change and proven by revert-style mutations (file restored with a fresh mtime, exit read), one gate at a time:

  • - consumer _compose skipped: the test-failure, exact-jobs and coverage cases fail;
    - carrier retry_result returns None: the composition journey fails;
    - recheck ignores the retry run: all three drift subtests fail;
    - audit expects success for a composite: the binding journey fails;
    - verdict closes retry selections again: the verdict closure test errors;
    - parser skips _parse_retry: four of the ledger refusals fail.
    - consumer skips the cross-run source check: the changed-ci.yml retry test fails; carrier ignores the frozen retry selection: the partial-selection test fails.
    Restored after each: all suites OK.
  • Fixture facts found on the way: the evidence fixture's artifact metadata took its control from the run number, so the retry's origin run (103, candidate control) needed a per-run map; the binding test re-dates artifacts relative to the real clock and must do so again after composing.
  • Commands run on the committed head:

    python3 tests/build/release_batch_evidence_test.py        # OK (87)
    python3 tests/build/release_verification_carrier_test.py  # OK (24)
    python3 tests/build/release_verified_recheck_test.py      # OK (26)
    python3 tests/build/release_model_test.py                 # OK (29)
    python3 tests/build/release_entry_enrollment_test.py      # OK (145)
    python3 tests/build/release_batch_binding_test.py         # OK (15)
    python3 tests/build/release_audit_test.py                 # OK (71)
    python3 tests/build/release_ci_evidence_test.py           # OK (16)
    python3 tests/build/release_intent_carrier_test.py        # OK (20)
    python3 tests/build/release_intent_pr_test.py             # OK (11)
    python3 tests/build/release_prepared_step_test.py         # OK (10)
    python3 tests/build/release_self_test_evidence_test.py    # OK (19)
    python3 tests/build/release_skill_test.py                 # OK (15)
    python3 tests/build/ci_batch_verdict_test.py              # OK (39)
    python3 tests/build/ci_batch_execution_test.py            # OK (23)
    python3 tests/build/ci_batch_runtime_test.py              # OK (89)
    python3 tests/build/ci_batch_controller_test.py           # OK (59)
    python3 tests/build/ci_incremental_batch_test.py          # OK (31)
    python3 tests/build/ci_change_scope_test.py               # OK (77)
    git diff --cached --check                                 # clean
    

    Complete tests/build/release_*_test.py run (all 80 modules, one at a time, on 0da743a in a detached worktree; the run started on 2914e45 was stopped at six modules because the review fix changed consumer, carrier and audit code the suite reads): 80 PASS, 0 FAIL.

    PR Review

    Head SHA: 0da743a114cf4930f54bf6af934903a0bab884b0. Review of 2914e45 raised five findings: proof not re-validated against the verdict (answered: _compose compares outcome, failing jobs and API conclusions; an explicit test now injects a contradicting proof); retry control not bound to the candidate's (fixed in 0da743a: the candidate's and retry's frozen controls must carry identical execution workflow sources); carrier accepts a partial retry (fixed: the frozen request selection must equal the non-passed suites); recheck does not bind the retry control (answered: the consumer proves it and the verified digest hashes both controls; the recheck is an immutability check of both runs); audit keys the conclusion off key presence (fixed: keyed off the v2 schema). All threads resolved. Current-head review evidence is checked with scripts/ci/review_wait.py before merge.

    CI Scope

    Expected mode: full
    Expected selected lanes: ci_contract core_asan core_coverage core_macos core_ubuntu creator deploy_contract docs_static package portal web_runtime_host web_runtime_lab web_toolchain
    Expected skipped lanes:
    ci:full required: no
    Reason: scripts/ci/batch_verdict.py is a central CI control-plane path (full rule); the rest is release tooling, its tests, governance documents and the skill.

    Batch-only Lanes

    core_asan core_coverage core_macos core_ubuntu creator deploy_contract package web_runtime_host web_runtime_lab web_toolchain: not run locally; verified by the next incremental main batch. The change touches release evidence verification and one verdict rule for the retry kind; no product code or lane command changes. The deploy_contract lane's release suite is run locally one module at a time (see Verification).

    Version Management

    Version impact: none
    Reason: the batch release reference document gains a v2 schema that the intent ledger and plan marker embed; it is not a registered contracts/ Contract, v1 documents stay readable and no Product, Module, Contract or Provider version changes.

    Documentation Impact

    Documentation impact: none
    Affected portal pages:
    Reason: governance and design documents under docs/ and a .agents skill; no page under apps/docs-site/docs/ changes.

    Pitfall Impact

    Pitfall impact: none — reason: the composition is a tool capability with gates (gate:tests/build/release_batch_evidence_test.py, gate:tests/build/release_verification_carrier_test.py); the operator rule (send a retry, never list suites) is recorded in the lmdj-release skill and in the open entry manual-batch-dispatch-short-request-format by #2471.

    Merge Danger

    Door: two-way
    Blast Radius: release evidence verification; a plain v1 reference and a fully passed candidate behave exactly as before, and a composite is admissible only through the proven environmental lanes.

    Release Impact

    Release impact: none
    Candidate tag: none
    Profile: none
    Channel: none
    Intent disposition: none
    Release assets: none
    Release gates: none
    Reason: no release is active; tags, Releases and the ledger are untouched.

    Transition authority

    Authorized transitions: push | PR | merge (standing Task authorization in CLAUDE.md; cleanup not requested)
    No tag, Release, deploy, publication, or Channel promotion is implied.

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: endaye Review duration: 74m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2472"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository