← Back to Pull requests

Send the first request behind `Configure` without waiting for its reply #1250

Closed
unknown closed this pull request without merging on Nov 10, 2026 10:19 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 18:39 UTC
Author

The pool no longer configures a session in a turn of its own: Checkout::create keeps the Configure and the first request writes it out ahead of itself, reading the Configure reply (bounded by request_timeout) before its own. The child answers in order, so a session opens and runs its first Feed or Load in one round trip. A refused Configure is that request's error and ends the session; an oversize first request still opens it; a checkout finished without a request never configures its worker. Redial and turn_raw take the same path, and the wasm transport pipelines the same way.

session_id is None until the first turn; a Load reply replaces it and a refused Load keeps it. The telemetry recorders track the unanswered Configure apart from the turn pipelined behind it.

Claude-Session: https://claude.ai/code/session_018zfZ5xdFiagSnfMeWL7Nb6

<!-- This is an auto-generated description by cubic. -->
---

Summary by cubic


The session's Configure now carries its first Feed or Load (Configure.first), so a session opens and runs its first request in one round trip: the pool sends the Configure and the request as one frame, and a refused Configure is the reply, a SessionRefused event, so that request never runs and ends the session.

Protocol and pool

  • The pool encodes the borrowed Configure and first request together (OpeningRequest) without cloning either, and the child arms the session's memory ceiling before running the request — except the subprocess shell, which sets its allocator baseline on the pristine worker before any request, so a first request decoded before its ceiling is armed still counts toward max_memory. Each session is charged its own stored Configure, shifting the exact usage figures in the subprocess tests.

  • Redial, raw turns, and the wasm transport take the same path; a checkout finished without a request never configures its worker, and a write that breaks the pipe keeps reading so a refused Configure reports the child's own reason.

  • The protocol version bumps to 8, since a version 7 child would drop a request carried inside Configure; version 7 parents still send Configure alone, which this child serves, so MIN_SUPPORTED_PROTOCOL_VERSION stays at 7.
  • Session ID and errors

  • session_id is unset until the first request is answered, so it is read through the new awaitable get_session_id() / getSessionId(), which sends a lone Configure when no request has gone out yet; the session_id property is deprecated. A Load reply replaces the ID, and a refused Load keeps it along with the clock and limits of the Configure reply reported. A refused Configure raises MontyConfigurationError from Python and JS, including the wasm worker.

  • Telemetry tracks the unanswered Configure apart from the request behind it. Only the first turn-ending reply acknowledges a Configure carrying a request — a later abort reply no longer re-adopts the server's clock, which would switch a remote CPU session to wall-clock supervision. FatalError and Shutdown replies report no clock and are classified as themselves, and a refused Configure records no run. A remote session's first request relies on a finite request_timeout in place of the wall-time backstop, since the server's clock arrives with its reply.
  • <sup>Written for commit 269f10ce1b8c8735c88de92ff5907b34fe12c084. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/pydantic/monty/pull/1250?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/pydantic/monty/1250?returnTo=https%3A%2F%2Fgithub.com%2Fpydantic%2Fmonty%2Fpull%2F1250&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    Diff: 568 lines (+426 / -142) across 7 files Reviewer: samuelcolvin Review duration: 6699m
    All Vouch review confidence checks passed
    Residual risk 0.31 = Change Risk (0.78) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.78 · 568 lines diff across 7 files
    0.78
    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.380
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.078
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1250"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 77.9% (HIGH) · Higher = larger blast radius
    77.9%
    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: 30.8% · Safe to merge
    30.8%
    Repository