Skip to main content

agent_engine/session/
budgets.rs

1//! Teardown budgets shared by every session host (values copied from
2//! `agent-tui/src/tui/signals.rs`; `signals.rs` re-exports these on day 2).
3//!
4//! - `SAVE_TIMEOUT_SECS`  — session save + index end record (data safety first)
5//! - `HOOKS_TIMEOUT_SECS` — `on_session_end` hook emit (concurrent, fail-open)
6//! - `TEARDOWN_TIMEOUT_SECS` = their sum.
7
8pub const SAVE_TIMEOUT_SECS: u64 = 2;
9pub const HOOKS_TIMEOUT_SECS: u64 = 5;
10pub const TEARDOWN_TIMEOUT_SECS: u64 = SAVE_TIMEOUT_SECS + HOOKS_TIMEOUT_SECS;
11
12pub const SAVE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(SAVE_TIMEOUT_SECS);
13pub const HOOKS_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(HOOKS_TIMEOUT_SECS);
14
15/// `SessionActor::create` bound on `EngineHost::extensions_ready()`: the
16/// loader guard should make this unreachable; it exists so a session can
17/// never hang on a loader that never reports (warns, then proceeds).
18pub const EXTENSIONS_READY_TIMEOUT_SECS: u64 = 30;
19pub const EXTENSIONS_READY_TIMEOUT: std::time::Duration =
20    std::time::Duration::from_secs(EXTENSIONS_READY_TIMEOUT_SECS);
21
22/// `SessionActor::unpark` bound (B3): journal load + runtime rebuild.
23/// Transports wait `ATTACH_TIMEOUT_PARKED` (25 s) for a parked attach.
24pub const UNPARK_TIMEOUT_SECS: u64 = 20;
25pub const UNPARK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(UNPARK_TIMEOUT_SECS);