Add timeout and cancellation effects to the effect system.
Motivation
Agent workloads constantly need bounded execution: limiting API calls to N seconds, cancelling in-flight work when a parent task completes, racing multiple operations and returning the first result. These compose naturally as algebraic effects.
Proposed effects
fn fetch_with_timeout(@String -> Result<@String, @String>)
effects(<Http, Timeout>)
{
Timeout.with_deadline(5000, fn(-> Result<@String, @String>) effects(<Http>) {
Http.get(@String.0)
})
}
Timeout.with_deadline(ms, thunk) — run thunk with a wall-clock deadline
Timeout.cancel() — cancel the current operation
- Effect handlers at the host level enforce actual time limits via wasmtime fuel/epoch interruption
Dependencies
Add timeout and cancellation effects to the effect system.
Motivation
Agent workloads constantly need bounded execution: limiting API calls to N seconds, cancelling in-flight work when a parent task completes, racing multiple operations and returning the first result. These compose naturally as algebraic effects.
Proposed effects
Timeout.with_deadline(ms, thunk)— run thunk with a wall-clock deadlineTimeout.cancel()— cancel the current operationDependencies