← Back to Pull requests

feat(ci): add the lane-scoped candidate retry request #2471

Closed
unknown closed this pull request without merging on Oct 22, 2026 05:40 UTC
View on GitHub
unknown unknown commented on Oct 22, 2026 04:34 UTC
Author

Summary

Item 8 of the "Next" plan in #2422 (bounded, audited re-run of an environmentally failed lane; #2404 item 2), PR 1 of 2. Decision recorded with the Owner on 2026-10-22 (option A: lane-scoped retry with composed evidence) in docs/prd/decisions/2026-10-22-candidate-lane-retry.md; plan in docs/plans/2026-10-22-lmdj-candidate-lane-retry.md.

Today one lane the platform stopped (a timed-out or cancelled job, a lost runner, a missing artifact) costs a whole new cut and a 4–5 hour batch: every layer accepts attempt 1 only, a candidate is one full-selection request, and complete-test-v2 admits one candidate result per target. This PR adds the request kind that re-runs only the environmentally failed lanes; the release side that composes its result with the original (reference schema v2, consumer, recheck, governance docs and skill) is PR 2 and lands separately. Release behaviour is unchanged by this PR: tools/release/verification.py selects candidate-kind results only, so a retry result is inadmissible until PR 2.

Change

  • scripts/ci/incremental_batch.py: kind retry (explicit, fair queue). make_request takes retry_of = {"request": <candidate id>, "environmental": {suite: {"outcome", "jobs"}}}, required exactly for kind retry; _retry_of closes the proof shape (ENVIRONMENTAL_CONCLUSIONS = {timed_out, cancelled}; a failure conclusion is a test failure and never qualifies; a failed suite needs its failing jobs' conclusions, a debt outcome carries none). A retry selection is not closed over dependencies: it re-runs lanes, it is not a change. The reducer's enqueue cross-checks journal truth (_retry_admissible): the original is a candidate for the same target and policy with a durable result; the retried suites are exactly the ones that result did not pass; each proof outcome matches the result; one retry per candidate. advance already moves no cursor and records no debt for explicit kinds.

  • scripts/ci/batch_verdict.py: retry is a known identity kind; the full-selection rule stays for bootstrap/node/candidate.

  • scripts/ci/batch_runtime.py: the explicit command {"id","kind":"retry","target","retry_of"}; a command whose ID the journal already holds reuses that frozen request (same kind, target and retry_of) before any API read; otherwise retry_request replays the journal, reads the original result's verdict and the original executor's jobs from the API, refuses a failing job whose conclusion is not environmental, and freezes the proof. Policy drift at settlement applies to retries as to candidates.

  • Tests: reducer (5 new), controller (1), verdict (1), runtime (4 plus a timed_out_job fixture option: needs failure, API timed_out).

  • .agents/pitfalls/manual-batch-dispatch-short-request-format.md: the retry short form beside the candidate one (second commit).
  • Not touched on purpose: .github/workflows/self-test-report.yml passes batch_request through unchanged and is an execution source whose digest must stay compatible for queued requests; the operator command is documented in the skill by PR 2.

    Related Issue

    Related issue: #2422

    Premise refresh (issue-done §0)

    Base: origin/main at e9d1047a835371e2fef85682bf04aa602aa74c03 (#2470). Verified on the base: attempt-1 rules in incremental_batch.identity, batch_verdict._identity, batch_runtime.Runtime, batch_reference, verification.py, batch_evidence.py, verified_recheck.py; full selection for candidates in make_request, batch_verdict.build, parse_reference, batch_evidence._verify; one candidate result per target in verification._candidate_results; the verdict's _debt outcomes versus the API timed_out reconciliation in batch_evidence_validation.validate_job_observations; ci.yml lane gating by the execution manifest. No open issue or branch delivers a lane re-run. Still outstanding; PR 1 delivered here. No release request is active (every journal request is retired; no driver process).

    Verification

  • The ten new tests were written first and failed on the base (unknown request kind, TypeError: retry_of, invalid explicit execution command); after the change they pass.

  • Mutation proofs (files restored with a fresh mtime, exit read):

  • - reducer skips _retry_admissible: four reducer tests fail (durable result, exact suites, proof-vs-result, once per candidate); restored: OK.
    - request shape accepts any job conclusion (_retry_of): the reducer proof test fails; the runtime refusal test still passes through the runtime's own API gate; dropping both gates fails test_retry_refuses_a_lane_that_failed_on_a_test; restored: OK.
    - verdict rejects kind retry: the verdict test errors; restored: OK.
    - redelivery derives the proof before the journal lookup again: the runtime journey (jobs aged out before redelivery) errors; restored: OK.
    - the failing-job completeness check is dropped: test_environmental_proof_requires_the_complete_failing_job_set fails; restored: OK.
  • A fixture collision surfaced while writing the runtime journey (run number 20 gives controller job id 2000, which the evidence helper uses for a lane job); the test uses runs 25–27.
  • Commands run on the committed head:

    python3 tests/build/ci_incremental_batch_test.py   # OK (31)
    python3 tests/build/ci_batch_verdict_test.py       # OK (38)
    python3 tests/build/ci_batch_execution_test.py     # OK (23)
    python3 tests/build/ci_batch_controller_test.py    # OK (59)
    python3 tests/build/ci_batch_runtime_test.py       # OK (88)
    python3 tests/build/ci_change_scope_test.py        # OK (77)
    python3 tests/build/ci_report_runtime_test.py      # OK (93)
    python3 tests/build/ci_self_test_test.py           # OK (41)
    git diff --cached --check                          # clean
    

    Complete tests/build/release_*_test.py run (all 80 modules, one at a time, started on 3836876 in a detached worktree): 80 PASS, 0 FAIL. The two later commits changed a pitfall entry, the plan, the runtime test and Runtime.reconcile's explicit branch; the release tests that import scripts/ci/batch_runtime (release_verification_carrier_test, release_entry_enrollment_test, release_model_test, plus release_batch_evidence_test and release_verified_recheck_test) were rerun on d3f296b: all OK; release_verification_carrier_test rerun on 5cc1abb (the only later change to a module they import is batch_runtime.environmental_proof): OK.

    PR Review

    Head SHA: 5cc1abbb600f0ce360cc0928870852362f969166. Review of 0b42c77 raised two findings: a redelivered retry command re-derived its proof from the API before the journal lookup (fixed in d3f296b: the frozen request is reused first, the journey ages the jobs out before redelivering, mutation proven); the reducer does not compare a failed suite's job map with the verdict's failing jobs (answered: the reducer is pure and reference-opaque; the exact-jobs check belongs to the release consumer and is now recorded in the plan's PR 2 section). Both threads resolved. Review of d3f296b raised three: the proof could under-report failing jobs (fixed in 5cc1abb: pure environmental_proof requires the complete failing job set, unit-tested and mutation proven); the retry freezes the redelivering run's control (answered: same rule as a queued candidate, policy pinned equal, each run verified against its own control in PR 2); the reducer does not compare job sets (answered, plan wording narrowed to name the owning layer of each check). 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/incremental_batch.py, batch_verdict.py and batch_runtime.py are central CI control-plane paths (full rule); the rest is their tests, one plan and one decision file.

    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 adds a request kind to the scheduler and its runtime; 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: scheduler control plane only; no Product, Module, Contract or Provider version changes and no Build allocation.

    Documentation Impact

    Documentation impact: none
    Affected portal pages:
    Reason: a plan under docs/plans/ and a decision under docs/prd/decisions/; no page under apps/docs-site/docs/ describes the scheduler's request kinds.

    Pitfall Impact

    Pitfall impact: update manual-batch-dispatch-short-request-format — the open entry named the candidate short form as the only manual dispatch; it now shows the retry short form ({"id","kind":"retry","target","retry_of"}) and that the controller derives the lanes and the proof. No recurrence is recorded (nothing was observed in production); exit stays none because the manual format is still exercised only by real controller runs. The missing capability itself is delivered with gates (gate:tests/build/ci_incremental_batch_test.py, gate:tests/build/ci_batch_runtime_test.py).

    Merge Danger

    Door: two-way
    Blast Radius: a new explicit request kind the operator must dispatch deliberately; automatic batches, candidates and release verification behave as before.

    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; retry results are not yet admissible evidence.

    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: 66m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). 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%
    56%
    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 #2471"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 22.5% · Safe to merge
    22.5%
    Repository