Skip to main content

codetether_agent/session/tasks/event/
status.rs

1//! Session task lifecycle status.
2
3use serde::{Deserialize, Serialize};
4
5/// Lifecycle status for a session-governance task.
6///
7/// `SessionTaskStatus` is persisted inside task-log status transition events
8/// and later folded into the materialized session task list. The status controls
9/// whether a task is still considered actionable, how it is rendered in
10/// governance prompts, and whether later status events should be interpreted as
11/// progress, completion, cancellation, or a blocker.
12///
13/// Values serialize as `snake_case` so the append-only JSONL task log remains
14/// stable and readable across releases.
15#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
16#[serde(rename_all = "snake_case")]
17pub enum SessionTaskStatus {
18    /// The task has been recorded but work has not started.
19    Pending,
20    /// The task is actively being worked on.
21    InProgress,
22    /// The task completed successfully.
23    Done,
24    /// The task cannot currently proceed because of missing information,
25    /// unavailable dependencies, or another explicit blocker.
26    Blocked,
27    /// The task was intentionally abandoned, superseded, or closed without
28    /// successful completion.
29    Cancelled,
30}
31impl SessionTaskStatus {
32    /// Returns whether this status represents actionable work.
33    ///
34    /// Open tasks are the tasks that should still appear as active work in
35    /// session-governance rendering. A task is open while it is waiting to start
36    /// or actively in progress. Completed, blocked, and cancelled tasks are not
37    /// considered open by this helper.
38    ///
39    /// # Returns
40    ///
41    /// `true` for [`SessionTaskStatus::Pending`] and
42    /// [`SessionTaskStatus::InProgress`]; `false` for
43    /// [`SessionTaskStatus::Done`], [`SessionTaskStatus::Blocked`], and
44    /// [`SessionTaskStatus::Cancelled`].
45    pub fn is_open(&self) -> bool {
46        matches!(self, Self::Pending | Self::InProgress)
47    }
48}