pub enum RetryPolicy {
Retry,
RetryWithSameKey,
Never,
}Expand description
Whether and how a failed live tool execution may be retried, as a function
of the tool’s Effect.
This encodes the retry column of the effect table. It is pure data and logic: it decides nothing and enforces nothing on its own.
§Scope: live execution only
This governs a tool call that is executing now and failed. It says
nothing about replay: a completed recorded call is read from the log and
never re-executed, whatever its effect. That rule lives in
salvor_core::Effect and the replay cursor, not here.
§Consumer: the agent loop
This type is consumed by the runtime loop, which owns retry enforcement.
When a live DynTool::call_json returns a
ToolError::Handler, the loop asks
RetryPolicy::for_effect what it is allowed to do:
Retry: re-execute the call.RetryWithSameKey: re-execute, reusing the original idempotency key (carried onToolCtx) so the provider collapses duplicate attempts into one effect.Never: do not auto-retry; the write’s at-most-once intent was recorded before execution, and a crash between intent and completion surfaces asNeedsReconciliationfor a human.
This layer only classifies. Recording intent, counting attempts, and surfacing reconciliation are the loop’s job.
Variants§
Retry
Retry freely. A Read has no side effect, so a repeat
attempt only re-observes state.
RetryWithSameKey
Retry, but only reusing the same idempotency key. For an
Idempotent call, the shared key is what makes a
retry safe.
Never
Never auto-retry. A Write that may have landed is not
re-attempted on a guess; it is left for human reconciliation.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn for_effect(effect: Effect) -> Self
pub fn for_effect(effect: Effect) -> Self
The retry policy for a tool of the given effect class.
This is the whole table: Read maps to
Retry, Idempotent to
RetryWithSameKey, and
Write to Never.
Sourcepub fn allows_retry(self) -> bool
pub fn allows_retry(self) -> bool
Whether a failed live execution of this policy may be re-attempted at
all. A convenience over matching; false only for Never.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
impl Eq for RetryPolicy
Source§impl Hash for RetryPolicy
impl Hash for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.