Skip to content

proof: release unused timeout reservations and replan from actual and learned duration #862

Open

Description

@EffortlessSteven

Parents

Verified gap

Focused-proof budget is currently reduced by each granted lease's full timeout rather than by the work's actual consumption.

On self-gate run 31277083645, the configured required proof reserved:

policy-check  300s
cargo-check   600s
cargo-doc     600s
              ─────
              1500s

The commands actually consumed about 62.5 seconds in total. More than 58 minutes remained before the hard wall, but each requested red/green proof was still costed at 600 seconds and declined against the nominal 300-second remainder. Three lane-requested tests therefore executed zero times.

A timeout is a safety ceiling, not a claim that the command consumed the entire reservation.

Outcome

admit with bounded reservation
→ record queue/resource/process timing
→ release unused reservation immediately at terminal state
→ update command-family estimates
→ rebuild the proof portfolio from actual remaining capacity and deadline

The scheduler remains conservative through p95/latest-safe-start admission, but completed short work no longer permanently consumes its maximum timeout.

Scope

  • Separate per-task estimated p50, estimated p95, reserved maximum, queue wait, resource wait, process execution, and actual elapsed time.
  • Release unused CPU/time/resource reservation immediately when a task becomes terminal.
  • Recompute remaining proof capacity after every task completion or material estimate update.
  • Maintain deterministic command-family defaults for cold-start operation.
  • Persist bounded repository/profile history for learned duration estimates, with version and environment identity sufficient to reject stale or incompatible samples.
  • Prefer conservative p95 for latest-safe-start decisions while using actual consumed time for remaining-budget accounting.
  • Distinguish timeout safety from expected cost.
  • Record the estimate source and confidence in each admission/deferral decision.
  • Integrate with M2: wind down proof safely before the hard wall with zero pending requests #768 reporting/cleanup reserve and zero-pending-request invariant.
  • Keep optional deferred work non-blocking and required unproven work explicit.

Acceptance

  • A task admitted with a 600s timeout that completes in 1s releases the unused reservation for later proof.
  • Reproduce the observed shape: three required tasks reserve 1500s but consume ~63s; a later 600s red/green candidate is admitted when the hard deadline and p95 permit it.
  • A genuinely slow command is not admitted after its latest safe start.
  • A short high-value task may still be admitted after long work becomes unsafe.
  • Queue/resource wait does not contaminate process-duration estimates without being separately visible.
  • Cold/no-history runs use conservative deterministic defaults.
  • Incompatible toolchain/profile/command-family history is ignored.
  • Timeout, cancellation, and setup failure release resources and produce terminal receipts.
  • Final wind-down artifacts report the timing basis for every selected or deferred task and zero pending work.

Proof

  • Fake-clock admission/release fixtures.
  • Observed-run reproduction fixture using the 1500s reservation / 63s consumption shape.
  • Cold-start, learned-p95, stale-history, and incompatible-profile fixtures.
  • Queue-wait versus process-time fixture.
  • Timeout/cancellation/setup-failure release fixtures.
  • Short-after-long latest-safe-start fixture.
  • Full proof budget, scheduler, wind-down, artifact verifier, CLI, workspace, fmt, Clippy, policy, and exact-head gate.

Non-goals

  • No new task ranking model.
  • No weakening of command timeouts.
  • No optimistic mean-only admission.
  • No public review wording change.
  • No branch-protection change.

Rollback

Return to deterministic conservative duration defaults while retaining actual timing receipts and terminal resource release. Do not restore permanent full-timeout charging after successful completion.

Activity

  1. coderabbitai commented on Aug 11, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #848 - fix(test): make the suite green and deterministic on Windows [open]
    #852 - feat(proof): select real cargo tests for Rust diffs [open]
    #858 - fix(reporter): bind review and gate to latest current-head turn [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. EffortlessSteven commented on Aug 24, 2026

    @EffortlessSteven
    MemberAuthor

    Timing-history / cache-domain amendment

    Keep #862 focused on release/replanning from actual duration, but condition learned estimates on explicit compatibility domains rather than one undifferentiated repository history.

    Use #924/#925 task timing as source truth and #931 cache-domain identity for at least:

    task family
    runner/profile
    Rust toolchain/target/features
    cold/warm target state
    cache-domain/trust-domain compatibility
    

    #932 later persists trusted duration observations; #862 must still work cold from conservative deterministic defaults. Queue wait, resource wait, setup, process, cleanup, and timeout ceiling remain separate. Historical p95 may guide latest_safe_start; only actual terminal consumption reduces remaining runtime/resource budget.

  3. EffortlessSteven commented on Aug 24, 2026

    @EffortlessSteven
    MemberAuthor

    PR-sized decomposition — #945 C2.1–C2.2

    1. C2.1 actual consumption/release — separate queue/resource/setup/process/cleanup from timeout ceiling; release unused reservations immediately on every terminal path and reproduce the 1500s-reserved/~63s-consumed failure.
    2. C2.2 estimates/replanning — deterministic cold defaults, compatible task-family p50/p95 samples, estimate source/confidence and replan after terminal events.

    The first PR must not wait for learned history. The second may consume bounded compatible history but cannot weaken timeout or Required semantics. Deadline admission/finalization remains #768; Cargo cache-domain identity remains #931.

  4. EffortlessSteven commented on Aug 24, 2026

    @EffortlessSteven
    MemberAuthor

    Concrete PR decomposition

    #992  release unused reservations from actual terminal duration
    → #993 compatible p50/p95 estimates + replanning after terminal events
    

    Timeout remains a kill ceiling, never consumed duration. #993 may improve ordering/admission only from compatible samples and conservative defaults; it cannot satisfy proof or override Required policy. #768 owns deadline phases and final wind-down; #931 owns cache compatibility.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions