pub enum TaskResultStatus {
Pending,
Success,
Partial,
Failed,
Cancelled,
DeadlineExceeded,
}Expand description
Pass/fail classification of a run, wider than a boolean.
Why: “did it work” has more than two useful answers. A run that exhausted
its turn budget after writing a real, on-disk deliverable is NOT a failure
— trusty-code’s own CLI has spelled that ExitCode::Partial (6) since
#2265, and collapsing it into Failed is exactly how a caller ends up
discarding working code (see crate::run_task::report::ExitCode’s docs).
What: Pending for a run that has not reached a terminal state yet;
Success/Partial/Failed/Cancelled/DeadlineExceeded for the
terminal ones. The wire form is snake_case, matching SessionStatus’s
own convention.
Test: tests::status_maps_every_session_status,
tests::partial_exit_code_is_its_own_status_not_a_failure,
tests::status_serialises_snake_case.
Variants§
Pending
The run has not reached a terminal state yet.
Success
The run reached a natural stop without error.
Partial
The run stopped early but produced a deliverable — resumable, not dead.
Failed
The run errored.
Cancelled
The run was cancelled by a caller.
DeadlineExceeded
The run’s wall-clock deadline elapsed first.
Implementations§
Source§impl TaskResultStatus
impl TaskResultStatus
Sourcepub fn from_session_status(status: SessionStatus) -> Self
pub fn from_session_status(status: SessionStatus) -> Self
Classify a daemon-side SessionStatus.
Why: the daemon’s own producer (crate::task::executor) knows the
session’s terminal status and nothing about process exit codes; this is
its one mapping point.
What: Created/Running are not terminal, so they report Pending.
TurnCapExceeded reports Partial — the same “not done, not dead”
reading crate::cli_client::render::exit_code_for_status already gives
it.
Test: tests::status_maps_every_session_status.
Sourcepub fn from_exit_kind(exit: ExitCode) -> Self
pub fn from_exit_kind(exit: ExitCode) -> Self
Classify a typed ExitCode.
Why: ExitCode is the ONE definition of what a run’s outcome means in
this crate; this match is exhaustive over it, so adding a variant there
fails to compile here until somebody decides what it classifies as.
A catch-all would have let Partial be absorbed silently — the exact
shape of #3888.
What: NoChanges is a SUCCESS — the run completed, it simply changed
nothing. Partial keeps its own status rather than collapsing into
Failed, because it means real work is on disk (see that variant’s own
docs).
Test: tests::every_exit_code_variant_classifies_deliberately.
Sourcepub fn from_exit_code(code: Option<i32>) -> Self
pub fn from_exit_code(code: Option<i32>) -> Self
Classify a tcode child process’s numeric exit code (#4351).
Why: a caller that shells out to tcode run-task (see
trusty_agents::tools::pm_bridge_backend::ProcessPmBridge) reads the
child’s exit status, not a SessionStatus. Without this mapping the
only honest reading of “non-zero” is “failed”, which silently throws
away the Partial distinction the exit code exists to draw.
What: routes the number through ExitCode::from_code and then
Self::from_exit_kind, so the numbers live in ExitCode alone and
renumbering a variant there carries this mapping with it. A number that
enum does not define — and a signal-killed child, which reports no code
at all — fails closed as Failed.
Test: tests::partial_exit_code_is_its_own_status_not_a_failure,
tests::exit_code_mapping_reads_the_numbers_from_the_enum,
tests::an_undefined_exit_number_fails_closed.
Trait Implementations§
Source§impl Clone for TaskResultStatus
impl Clone for TaskResultStatus
impl Copy for TaskResultStatus
Source§impl Debug for TaskResultStatus
impl Debug for TaskResultStatus
Source§impl<'de> Deserialize<'de> for TaskResultStatus
impl<'de> Deserialize<'de> for TaskResultStatus
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>,
impl Eq for TaskResultStatus
Source§impl PartialEq for TaskResultStatus
impl PartialEq for TaskResultStatus
Source§impl Serialize for TaskResultStatus
impl Serialize for TaskResultStatus
impl StructuralPartialEq for TaskResultStatus
Auto Trait Implementations§
impl Freeze for TaskResultStatus
impl RefUnwindSafe for TaskResultStatus
impl Send for TaskResultStatus
impl Sync for TaskResultStatus
impl Unpin for TaskResultStatus
impl UnsafeUnpin for TaskResultStatus
impl UnwindSafe for TaskResultStatus
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more