Skip to content

raceCallDeadline

raceCallDeadline<T>(deadline, start): Promise<typeof CALL_TIMED_OUT | T>

Defined in: packages/core/src/runtime/abortableCall.ts:136

Run one provider call under an already-started budget, returning either the call’s value or CALL_TIMED_OUT.

The deadline is passed in rather than started here so that a multi-turn caller can hold one budget across many calls. The alignment checker’s budget is one wall-clock budget for one gate decision; starting a fresh one per turn would silently multiply it by the turn count, on exactly the slow local models the budget exists to accommodate. Single-shot callers use withCallDeadline, which starts and disposes one for them.

The call’s own rejections still propagate. Only the abort this module causes is swallowed; a provider error, an auth failure or a transport failure rejects out of here as before, so each site’s existing catch arm keeps its meaning.

T

CallDeadline

The budget from startCallDeadline.

(signal) => Promise<T>

Starts the call, given the signal to pass to the provider. It is called exactly once. The signal has to reach the provider invocation — a start that ignores it produces a helper that times out and aborts nothing, which is the defect this module was written to fix. It is invoked inside runWithCallSignal, so a client that has no way to accept a signal can still pick it up from the ambient context.

Promise<typeof CALL_TIMED_OUT | T>