pub enum SessionStatus {
Completed,
Crashed,
Interrupted,
Paused,
Active,
}Expand description
Status of a session. Persisted as a lowercase string.
Backward compatibility has THREE complementary mechanisms, all required for this enum to load files written by every prior build:
-
#[serde(alias = ...)]on individual variants — accepts legacy on-disk strings that map to the same semantic state. For example,Completedaccepts both"completed"(current) and"success"(the string the pre-Goal-276 writer emitted). Without these aliases, old session files would silently load asActive(theothercatch-all) instead ofCompleted. -
#[serde(other)]on the last variant (Active) — catches any unknown string the build does not recognise (e.g."stalled"written by a future version, or a typo). It MUST stay last; serde requires the catch-all at the end. -
#[serde(default)]on the field inSessionMeta(see below) — handles a missingstatusfield on disk. Without it, a.meta.jsonwritten before the field existed would fail to load.
Aliases handle known legacy values and preserve semantics;
#[serde(other)] handles unknown values and degrades safely
to Active; the field-level #[serde(default)] handles a
missing field. They are distinct and not interchangeable.
New variants added here must:
- Provide aliases for any prior string literals mapping to the same semantic state.
- Keep
Activeas the LAST variant (the#[serde(other)]arm must remain terminal — moving it earlier is a serde error).
Variants§
Completed
Session finished its goal successfully.
Legacy alias: "success" (written by cli/resume.rs and
main.rs before Goal 276).
Crashed
Session ended because of an unrecoverable error
(provider crash, panic, transcript-limit hard stop, etc.).
Legacy alias: "incomplete" (written by the pre-Goal-276
finish_status mapping for non-NoMoreToolCalls outcomes).
Interrupted
Session was cancelled by a shutdown signal (SIGINT/SIGTERM).
Legacy alias: "cancelled" (the string FinishReason::Cancelled
emits via its Display impl; that string was used in
cli/session.rs for the interrupt path).
Paused
Session is parked for later resume (e.g. via
recursive pause <id>).
Active
Session is the live, currently-running state. Also acts as
the catch-all (#[serde(other)]) for unknown on-disk
statuses — see the type-level doc comment above.
MUST remain the last variant. Adding a new variant after
Active is a compile error; reorder first.
#[default] makes this the Default::default() value,
which #[serde(default)] on the field in SessionMeta
relies on when a .meta.json file omits the status
key. The #[serde(other)] arm above is a separate
catch-all for unknown string values — see the
type-level doc comment.
Implementations§
Source§impl SessionStatus
impl SessionStatus
Sourcepub fn for_finish(reason: &FinishReason) -> Self
pub fn for_finish(reason: &FinishReason) -> Self
Map a [FinishReason] to the canonical SessionStatus written
when the writer is finalised.
The mapping is EXHAUSTIVE: there is no wildcard arm, so
adding a new variant to FinishReason becomes a compile error
in this function rather than silently falling back to
Crashed. The compiler is the safety net.
Trait Implementations§
Source§impl Clone for SessionStatus
impl Clone for SessionStatus
impl Copy for SessionStatus
Source§impl Debug for SessionStatus
impl Debug for SessionStatus
Source§impl Default for SessionStatus
impl Default for SessionStatus
Source§impl<'de> Deserialize<'de> for SessionStatus
impl<'de> Deserialize<'de> for SessionStatus
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SessionStatus
impl Display for SessionStatus
impl Eq for SessionStatus
Source§impl PartialEq for SessionStatus
impl PartialEq for SessionStatus
Source§impl Serialize for SessionStatus
impl Serialize for SessionStatus
impl StructuralPartialEq for SessionStatus
Auto Trait Implementations§
impl Freeze for SessionStatus
impl RefUnwindSafe for SessionStatus
impl Send for SessionStatus
impl Sync for SessionStatus
impl Unpin for SessionStatus
impl UnsafeUnpin for SessionStatus
impl UnwindSafe for SessionStatus
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.