← Back to Pull requests

feat(scheduler): record build identity and reservations in the observation log #749

Closed
unknown closed this pull request without merging on Oct 18, 2026 21:09 UTC
View on GitHub
unknown unknown commented on Oct 18, 2026 20:43 UTC
Author

mbx's scheduler observation log (#746) records one line per finished compile, link, and test run. Replaying it to compare admission policies showed two gaps. The log has no build identity, so per-build limits cannot be modelled. And mbx reserve writes no observation, so capacity held by reserved external commands, such as test runs that wrap a whole build, is invisible. In a replay of 3,333 real admissions, the modelled baseline accounted for only 57% of the waiting actually recorded. These were the two main missing inputs.

This change fills both gaps:

  • Each observation can now include build_id, build_capacity (that build's permit ceiling), and domain_capacity, when the scheduler knows them. All three are optional and omitted when unset. The line version stays 1, so older readers and older lines keep working.

  • When an mbx reserve reservation ends, mbx appends an observation with kind reservation. It records:

  • - the reserved permits;
    - the bytes per permit;
    - the admission wait and run times;
    - the external command's outcome, or unknown if it could not start.

    A reservation has no measured peak, so mbx stats --scheduler counts reservations under their own reservation key and never treats them as exceeding a reservation.

    Both follow the existing gates. Nothing is written when events = false or when memory weighting is off.

    Validation: the scheduler and reserve tests pass. They cover:

  • the schema with and without the new fields;

  • old lines still parsing;

  • a reservation being recorded when it ends, and respecting the events gate;

  • the summary handling reservation lines.
  • cargo clippy -p mbx --all-targets --all-features -- -D warnings and cargo fmt --check pass. The full library suite passed 979 tests and failed 3, all in tests this change does not touch. One is the renderer test mascot_keeps_progress_readable_and_leaves_successful_builds. The other two are materialize filesystem-timestamp tests: a_restore_stamp_is_never_ahead_of_a_write_that_follows_it and a_filesystem_without_clones_links_the_object_instead_of_copying_it. They ran on a heavily loaded host, and they fail intermittently there. The full mise run ci gate was not run locally.

    AI-assisted — Tool: Claude Code; model: Anthropic/claude-opus-5-5; version: 2.1.302.
    AI-assisted — Tool: Codex; model: OpenAI/gpt-6-luna; version: unavailable.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Reservation activity is now included in scheduling observations, with reservation weight, wait and run times, and command outcome.
    Scheduling observations can include build identity and applicable build and domain capacity details. Older observation records remain compatible.
    Bug Fixes
    Reservation requests that lack required resources, or request memory when memory scheduling is unavailable, now return an error.
    Documentation
    * Updated scheduling guidance to describe the additional reservation observation details.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 399 lines (+299 / -100) across 4 files Reviewer: jbellis Review duration: 25m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 399 lines diff across 4 files
    0.43
    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.358
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #749"
    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: 43.2% (MEDIUM) · Higher = larger blast radius
    43.2%
    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: 17.1% · Safe to merge
    17.1%