← Back to Pull requests

Add await_io() and await_io_value() to the Rust io-context crate #8117

Closed
unknown closed this pull request without merging on Nov 03, 2026 04:14 UTC
View on GitHub
unknown unknown commented on Oct 31, 2026 04:07 UTC
Author

await_io() is the promise-returning counterpart of await_io_and_run(), as
C++ IoContext::awaitIo() is of awaitIoAndRun(): it waits for a future
without the isolate lock, then returns a promise for what its callback
returns when called with the output under the lock. await_io_value() is
await_io() with a callback that converts the output with ToJS.

As in C++, the returned promise settles in a reaction. The callback's Ok
value resolves it, following a promise or thenable. An error the callback
returns is thrown by that reaction, as C++ throwOrReturnResult() does, so
that V8 records an async stack trace; an exception that JavaScript threw
in the callback rejects it. A panic while polling the future rejects it
with an internal error and lets execution continue, as a KJ exception from
the I/O does for C++ awaitIo(). A panic in the callback, or a termination,
settles nothing and fails the task, as for await_io_and_run().

A panic while dropping the future no longer aborts the process. kj-rs drops
the future of io_future_wait() through an extern "C" function, so a panic
in the drop of a cancelled future now is caught and logged. await_io()
drops its future once the output is ready, catching and logging a panic
there too, and keeps the output.

The first commit adds TestFixture::setLimitsExceeded(), which the test of a termination in the callback uses: the mock limit enforcer then reports the given outcome and fails requireLimitsNotExceeded(), as the real enforcer does once a limit such as CPU time is exceeded.

Diff: 191 lines (+143 / -48) across 2 files Reviewer: nathanwhit Review duration: 4327m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 191 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%
56%
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.315
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8117"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% 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: 35.9% (MEDIUM) · Higher = larger blast radius
35.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: 56.8% · Lower = rushed or shallow review
56.8%
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: 15.5% · Safe to merge
15.5%