Repository navigation
Description
Parent
#763 — M2 Adaptive proof loop.
Depends on #767 for portfolio replanning and terminal request semantics.
Problem
A fixed cutoff wastes useful short work near the deadline, while an unbounded planner risks losing receipts, cleanup time, or the final report. The runner needs duration-aware admission and drain behavior rather than an abrupt global stop.
The hard invariant is:
pending proof requests at reporter start = 0
Not every request must execute. Every request must receive a terminal disposition before reporting.
Selected design
For each candidate task:
latest_safe_start =
hard_deadline
- estimated_p95_duration
- receipt/artifact/posting/cleanup_margin
As the deadline approaches:
- stop admitting long tasks first;
- continue admitting short high-value work while it can finish safely;
- drain in-flight work;
- persist completed receipts immediately;
- terminalize queued work with explicit reasons;
- reserve time for lane reconsideration, reporter compilation, artifacts, and cleanup.
Scope
- Track remaining wall time and explicit cleanup/reporting reserve.
- Estimate task duration from command family defaults plus observed repository history where available.
- Make admission decisions per task, not through one global
allow-heavyswitch. - Stop launching tasks whose
latest_safe_starthas passed. - Allow short, high-value tasks after longer tasks are no longer admissible.
- Cancel or classify in-flight work only under an explicit policy; never silently discard it.
- Route all completed receipts before reporter start.
- Terminalize non-started requests as
deferred_hard_wallwith selected higher-value work and timing basis. - Emit a bounded wind-down artifact showing deadline, reserve, admitted/drained/deferred tasks, and final queue state.
Non-goals
- Changing proof-task value ranking; M2: iteratively plan proof portfolios and route receipts back to every interested lane #767 owns portfolio selection.
- Adding new command adapters.
- GitHub Actions cancellation policy or sole-gate watchdog; feat(gate): classify current-head terminal watchdog state with receipts #745 / ub-review/gate as the sole branch-protection check: trusted stable coordinator, receipted proofs, inconclusive state, watchdog, break-glass #658 own external terminal state.
- Making deferred optional work a code failure.
Acceptance criteria
- Long tasks are rejected once they cannot finish inside p95 + reserve.
- Short high-value tasks may still be admitted afterward.
- In-flight tasks drain or receive an explicit terminal receipt; none disappear.
- Every completed receipt reaches interested lanes before reporter compilation.
- Every queued request is terminalized before reporter start.
-
deferred_hard_wallrecords timing basis and is not rendered as maintainer homework. - Required missing evidence can still make the gate inconclusive; optional deferred work does not.
- Artifact/posting/cleanup reserve is preserved in deterministic clock fixtures.
- The final artifact reports zero pending requests.
Proof
- Fake-clock fixtures for long-task rejection and short-task admission.
- In-flight drain, timeout, and cancellation fixtures.
- Receipt-routing-before-reporter fixture.
- Required-versus-optional deferred evidence fixture.
- Queue terminalization and artifact verifier tests.
- Planner/broker/CLI suites, workspace tests, fmt, Clippy, policy-check, exact-diff RIPR, authoritative gate.
Rollback
Restore conservative early admission cutoff while retaining terminal dispositions. Do not restore a path that begins reporting with pending requests.
Claim boundary
This proves internal safe wind-down and queue closure. It does not prove GitHub workflow watchdog behavior or runner replacement across separate Actions runs.
Activity
EffortlessSteven commentedon Jul 15, 2026
Research update — verified current state (2026-07-14)
I verified the proof-shutdown and deadline infrastructure. The hard invariant (pending requests at reporter start = 0) is partially enforced — terminal dispositions exist but duration-aware admission/drain is not built.
Current facts
The latest_safe_start formula is the core design
The issue proposes: latest_safe_start = hard_deadline - estimated_p95_duration - receipt/artifact/posting/cleanup_margin. This is sound. The p95 estimation needs historical data (per-command-type runtime distribution), which calibration.json could accumulate over runs.
Recommendation
Depends on #767 (portfolio replanning) for the planning substrate. The admission/drain logic operates on the portfolio planner candidate set. The p95 estimation could start with conservative static estimates per ProofKind and refine from calibration data.
This is M2 and correctly depends on #767. I have not started implementation — this is the verified assessment.
EffortlessSteven commentedon Aug 11, 2026
Child split from the live-run investigation
#862 now owns the duration-accounting prerequisite for this wind-down contract.
The observed failure is concrete: required proof reserved 1500s of an 1800s budget but consumed about 62.5s. Later 600s red/green candidates were declined despite more than 58 minutes remaining before the hard wall. The current budget treats a safety timeout as permanently consumed time.
Recommended order:
#862 does not replace this issue. It fixes the accounting needed for duration-aware admission to be meaningful.
EffortlessSteven commentedon Aug 24, 2026
Product deadline semantics amendment
Keep the existing latest-safe-start/hard-wall contract, but expose the deadline phases explicitly so the scheduler/model loop can optimize and wind down predictably:
Before the signal target, bias toward early discriminating evidence. After the optional-work stop, admit no broad/weak optional work; short high-value work may still start if p95 + reserve fits. At finalization reserve, start no new executable work, terminalize queued requests, drain/persist terminal receipts, run only necessary reconsideration/final-lead/delivery work, and convert unsatisfied Required obligations to
not_proven. Hard kill is for hung/unexpected work and must emit explicit timeout/cancel receipts.#862 supplies actual p50/p95/consumed-time inputs, #930/#934/#938 later supply model/cache-window economics, and #926 owns final outcome. Do not rely on being able to interrupt a live provider call to 'wrap up'; bound turns and stop launching new stages as the soft boundary approaches.
EffortlessSteven commentedon Aug 24, 2026
PR-sized decomposition — #945 C2.3–C2.4
Soft boundaries guide convergence; the hard wall catches hangs. Required work that cannot complete becomes
NOT_PROVEN; optional deferred work stays artifact-only and never becomes maintainer homework.EffortlessSteven commentedon Aug 24, 2026
Concrete PR decomposition
#768 consumes #993 duration estimates and #991 scheduler authority. Long/weak optional work stops first; Required work that cannot fit becomes NOT_PROVEN; final judgment/delivery reserve is protected; hard kill is only for genuine hangs. Close only with every queued/in-flight item terminally accounted.