Skip to content

fix: Update time of HTTP outcalls contexts when moving them to delivered - #11214

Open
eichhorl wants to merge 2 commits into
masterfrom
eichhorl/update-context-time
Open

fix: Update time of HTTP outcalls contexts when moving them to delivered#11214
eichhorl wants to merge 2 commits into
masterfrom
eichhorl/update-context-time

Conversation

@eichhorl

@eichhorl eichhorl commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

HTTP outcalls contexts are moved to a different delivered collection, as soon as the response is delivered. There, they wait for further asynchronous refunds to be delivered. Previously, the context would be removed from this collection after a timeout of 2 minutes, since the creation of the original context.

With this PR, we instead update the context's time when moving it to delivered, and remove it after a timeout of 1 minutes, since the insertion into delivered contexts. This reduces the amount of time that the context needs to stay in replicated state.

Additionally, we add metrics for the amount of cycles being refunded. We observe the total amount, and its fraction against the per-replica allowances.

@github-actions github-actions Bot added the fix label Aug 19, 2026
@eichhorl
eichhorl marked this pull request as ready for review August 19, 2026 09:42
@eichhorl
eichhorl requested a review from a team as a code owner August 19, 2026 09:42
@zeropath-ai

zeropath-ai Bot commented Aug 19, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 3ea40bf.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/execution_environment/src/execution_environment.rs
       Use updated context retrieval with current time for subnet call context manager
Enhancement ► rs/messaging/src/canister_http_spent.rs
       Add refund tracking metrics: refunded_cycles and refunded_fraction
       Introduce status labeling (complete/incomplete) for refunds
       Initialize and observe refund metrics
       Record refunds upon context drop
Enhancement ► rs/replicated_state/src/metadata_state/subnet_call_context_manager.rs
       Change DELIVERED_CANISTER_HTTP_REQUEST_CONTEXT_TIMEOUT to 60 seconds
       Extend retrieve_context to accept current_time and stamp delivered contexts with it
       Update time_out_delivered_canister_http_request_contexts documentation to reflect new timing semantics
Enhancement ► rs/replicated_state/src/metadata_state/tests.rs
       Update tests to pass time parameter to retrieve_context calls
Enhancement ► rs/replicated_state/src/metadata_state/tests.rs
Adjust tests for new delivered context time stamping and timeout behavior in canister HTTP context retrieval and timeouts

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.

1 participant