pub struct BgTaskSnapshot {
pub task_id: u32,
pub agent_name: String,
pub prompt: String,
pub age: Duration,
pub status: AgentStatus,
pub spawner: Option<u32>,
}Expand description
Snapshot of a pending bg-agent task — what /agents and the
ListBackgroundTasks LLM tool will render.
Cloned out of the registry under the lock so callers can format/display
without holding it. age is computed from started_at at snapshot time.
Fields§
§task_id: u32Monotonic id assigned at reserve() time. Stable for the
lifetime of the task; reused across snapshots.
agent_name: StringConfigured agent name (explore, verify, …).
prompt: StringThe prompt the parent delegated. Surfaced verbatim by
/agents -v; truncation is the renderer’s job.
age: DurationWall-clock duration since the task was attached. Computed at snapshot time, so successive snapshots of the same task report different ages.
status: AgentStatusLatest value from the task’s watch::Receiver<AgentStatus>.
spawner: Option<u32>Sub-agent task that spawned this bg-agent. None = top-level
(the user’s main conversation).
#996 Layer 2 / Model D: tracked so that when a sub-agent
exits, BgAgentRegistry::cancel_for_spawner can fire the
cancel token on every bg-agent it left behind. Mirrors
Claude Code’s agentId field on LocalShellTaskState
(prevents 10-day fake-logs.sh zombies).
We don’t use this for permission scoping — any caller with a
task_id can manage any task. Spawner is only a cleanup
hook (matching Claude Code’s flat-permissions design).
Trait Implementations§
Source§impl Clone for BgTaskSnapshot
impl Clone for BgTaskSnapshot
Source§fn clone(&self) -> BgTaskSnapshot
fn clone(&self) -> BgTaskSnapshot
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BgTaskSnapshot
impl Debug for BgTaskSnapshot
Source§impl PartialEq for BgTaskSnapshot
impl PartialEq for BgTaskSnapshot
impl Eq for BgTaskSnapshot
impl StructuralPartialEq for BgTaskSnapshot
Auto Trait Implementations§
impl Freeze for BgTaskSnapshot
impl RefUnwindSafe for BgTaskSnapshot
impl Send for BgTaskSnapshot
impl Sync for BgTaskSnapshot
impl Unpin for BgTaskSnapshot
impl UnsafeUnpin for BgTaskSnapshot
impl UnwindSafe for BgTaskSnapshot
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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