← Back to Pull requests

Cap restored session budgets at destination limits #1027

Closed
unknown closed this pull request without merging on Oct 13, 2026 15:08 UTC
View on GitHub
unknown unknown commented on Oct 12, 2026 14:31 UTC
Author

@strawgate's commit:

What it does

When a worker loads a snapshot, each resource limit of the restored session is now capped at the restoring worker's Configure limit. A snapshot from a worker with bigger limits (memory, durations, total sleep, recursion depth, suspensions, GC interval) can no longer bring them onto a smaller worker. Before this, a Load adopted the dump's own limits. A dump's limits that are already stricter still apply.

  • monty-types: ResourceTracker::tighten_limits, which takes the tighter of the two values for each limit.

  • monty-proto: on Load, the worker caps the idle or suspended session it restores at the limits from its Configure.

  • monty: tracker_mut on a suspended progress, so the worker can tighten a session restored at a suspension.

  • monty-pool: docs only. The checkout still adopts the limits in the worker's reply, which are now the capped ones.

  • Docs: docs/snapshots.md and docs/limitations/resource_limits.md.

  • Tests: tracker unit tests, a dispatch test and a real-process pool test, all run by make test-restore-policy.
  • Cherry-pick conflicts

  • crates/monty-proto/src/worker.rs: kept module_stubs, which main added with the host import work (#942), when unpacking the restored Dump.

  • crates/monty-proto/tests/dispatch.rs: merged the monty_types imports, and gave the new test's dump(...) call the &[] module-stubs argument main added.

  • docs/snapshots.md: merged the capped-limits wording into main's rewritten restore bullet about module stubs.
  • 🤖 Generated with Claude Code

    Diff: 204 lines (+153 / -51) across 2 files Reviewer: rewitt94 Review duration: 1477m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 204 lines diff across 2 files
    0.36
    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.318
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1027"
    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: 36.3% (MEDIUM) · Higher = larger blast radius
    36.3%
    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: 14.3% · Safe to merge
    14.3%
    Repository