Skip to content

fix(outcalls): stop waiting for the transform at the outcall's deadline - #12121

Merged
eichhorl merged 3 commits into
masterfrom
eichhorl/outcall-transform-deadline
Nov 18, 2026
Merged

eichhorl merged 3 commits into
masterfrom
eichhorl/outcall-transform-deadline

Conversation

@eichhorl

@eichhorl eichhorl commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #11932, which made the HTTPS outcalls client stop waiting for the adapter at an outcall's effective deadline. The transform that follows is still awaited without a deadline. A transform that hasn't run by the deadline is wasted work: consensus has already timed the outcall out and drops its result.

This PR applies the same deadline to the transform:

  • At the outcall's effective deadline, measured from dispatch like the adapter call, the client gives up on a transform that hasn't started and reports the same SYS_TRANSIENT "Deadline Exceeded" reject. The query handler then skips it.
  • A transform that has started by the deadline is still waited for and charged as before. The query handler and the client decide once, through TransformStart in TransformExecutionInput, which of the two happens, so a transform can't start after the client has given up on it.

Behavior changes:

  • A transform that hasn't started by its outcall's deadline no longer runs.
  • In PocketIC, mocked outcalls go through the same client, so the transform of a mocked response now has to start within the time the outcall has left.

Tests (client):

  • test_client_stops_waiting_for_transform_at_request_deadline: a transform that never starts is given up on at the deadline with the deadline reject, and the query handler would skip it. On master the client keeps waiting.
  • test_client_waits_for_transform_started_by_request_deadline: a transform that starts before the deadline but finishes after it is waited for, and charged under pay-as-you-go pricing.

🤖 Generated with Claude Code

The client already stops waiting for the adapter at an outcall's effective
deadline (#11932), but still awaits the transform without one. Apply the same
deadline to the transform: the client gives up with the same "Deadline
Exceeded" reject, and dropping the call makes the query handler skip the
transform if it hasn't started.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Deadline expiry can be incorrectly replaced by a SysFatal response-size error when max_response_bytes is below 17, causing inconsistent rejects between timeout paths.

1 open issue
What changed in this PR

Extends the HTTPS outcall deadline introduced in #11932 to response transforms, so the client stops waiting once the outcall’s remaining time expires.

Changes:

  • Passes a shared deadline to transform execution and returns a deadline reject on timeout.
  • Drops timed-out transform calls, allowing queued work to be skipped.
  • Adds a regression test covering timeout rejection, cancellation, and request-slot reuse.
File Description
rs/​https_outcalls/​client/​src/​client.rs Applies the outcall deadline to transforms and tests timeout handling and slot reuse.

Review effort: Balanced

Comment thread rs/https_outcalls/client/src/client.rs Resolved
Giving up on a transform that is already running doesn't stop it, and its
instructions then go unreported, so it would go uncharged under pay-as-you-go
pricing. The query handler and the client now decide once, via
`TransformStart`, whether a transform runs: if the client gives up first at the
deadline, the query handler skips the transform; if the transform has started,
the client waits for it to finish and charges for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Client-side deadline rejects still pass through the transform-output size limit, causing small valid response limits to turn cancellation into SYS_FATAL instead of SYS_TRANSIENT.

2 open issues

Review effort: Balanced

Comment thread rs/https_outcalls/client/src/client.rs Resolved
The query handler and the client do the same thing: claim the transform, and
only the first claim succeeds. The call sites say what each claim means.

Also replace the query handler's stale comment about a weak pointer: the
closures check whether the caller dropped the call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the change extending HTTPS outcall deadlines to queued transforms.

1 open issue
1 resolved since last review

Review effort: Balanced

@eichhorl
eichhorl marked this pull request as ready for review November 16, 2026 15:38
@eichhorl
eichhorl requested a review from a team as a code owner November 16, 2026 15:38
@zeropath-ai

zeropath-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to f27ad66.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/execution_environment/src/query_handler.rs
    Modify transform execution handling to track transform start via TransformStart and conditionally start/cancel based on client state
► rs/https_outcalls/client/src/client.rs
    Integrate TransformStart into transform flow, add deadline-based gating, and handle timeout behavior for transform execution
► rs/interfaces/src/execution_environment.rs
    Add TransformStart structure and integration into TransformExecutionInput

@eichhorl
eichhorl added this pull request to the merge queue Nov 18, 2026
Merged via the queue into master with commit 80a596f Nov 18, 2026
42 checks passed
@eichhorl
eichhorl deleted the eichhorl/outcall-transform-deadline branch November 18, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants