Skip to main content

WireKind

Enum WireKind 

Source
pub enum WireKind {
Show 14 variants Unauthorized, ProtocolError, NotFound, Conflict, StdinClosed, TooLarge, RequestTimeout, NotBootstrapped, ServerError, InsufficientStorage, Transport, AuthTokenMint, ExecTimeout, OutputGap,
}
Expand description

The fine-grained taxonomy: one variant per condition the daemon or the transport distinguishes.

These are the errors.py exception classes, which is what the conformance suite asserts on. Several collapse onto one ErrorKind and that is the point — the collapse happens at the exit code, not at the raise site.

Variants§

§

Unauthorized

401: the presented bearer token is not the installed one. Fatal.

§

ProtocolError

400: malformed body, missing query key, bad mode, refused tar member.

Never 404. A 404 here reads as a missing file, which is exactly how one defect hid for a review round.

§

NotFound

404: a genuinely absent exec id, file, or directory.

§

Conflict

409: well-formed, but the target is in the wrong state.

§

StdinClosed

410: stdin already saw EOF, or the child stopped reading.

Distinct from WireKind::Conflict, which is “you did not ask for stdin” and is fixed at start time. This one is a lifecycle fact.

§

TooLarge

413: over a configured cap (body, tar members or bytes, stdin write).

§

RequestTimeout

408: the child did not drain its stdin pipe within the write timeout.

Retryable, and the daemon deliberately keeps its stdin handle open so a retry can succeed. Some bytes may already have landed; reconciling that is the caller’s problem, which is why it is a distinct variant.

§

NotBootstrapped

503: the run hook has not landed, so the control API is closed.

Not 404 and not a dropped connection. Retry: the platform is about to deliver the token.

§

ServerError

5xx other than 503 and 507: spawn failure, io failure, a panicking task.

§

InsufficientStorage

507: a write would take the target filesystem under the daemon’s disk reserve.

Not retryable, and that’s why the daemon answers 507 rather than 500 (crates/agentd/src/fs.rs): an identical retry against a full disk fails the same way, and a retry loop keyed on a 5xx would repeat it. The body names the free and reserved bytes. The remedy is freeing space, then retrying.

§

Transport

The request never produced a status: connection refused, reset, timeout.

Retryable because it says nothing about the daemon’s state. A VM that has just reached RUNNING commonly refuses a connection or two before the proxy path is wired up.

§

AuthTokenMint

CreateMicrovmAuthToken failed.

Retryable, and load-bearing rather than optimistic: proxy tokens expire at 60 minutes, so a long run will mint mid-flight, and a throttle at that moment must not kill a trial that is otherwise healthy.

§

ExecTimeout

A client-side wait or stream deadline elapsed. The exec is untouched.

§

OutputGap

Output bytes are gone for good — the replay ring evicted them, or this subscriber lagged the live channel.

Implementations§

Source§

impl WireKind

Source

pub const ALL: [WireKind; 14]

Every variant, so a test can assert the mapping is total.

Source

pub fn as_str(self) -> &'static str

The stable name the CLI puts in data.kind and the bindings use for the corresponding exception. Conformance tests compare these names.

Source

pub fn status(self) -> Option<u16>

The status that produces this variant, for the ones that come from one.

None for the four that have no status: two never got a response (WireKind::Transport, WireKind::AuthTokenMint) and two are client-side facts (WireKind::ExecTimeout, WireKind::OutputGap).

Source

pub fn from_status(status: u16) -> Option<WireKind>

The variant a response status means, or None for a status the daemon does not use to mean anything.

The table is explicit and there is deliberately no generic 4xx fallback. The daemon’s whole point is that 400 and 404 mean different things, and a fallback that mapped “some 4xx” to one variant would reintroduce the phantom-missing-file defect that hid in the Python client for a review round. 5xx does fall back — to WireKind::ServerError, which is what errors.py does — because every 5xx means the same thing to a caller: the daemon broke, try again. The two the daemon chooses on purpose keep their own variants: 503 is “come back in a moment”, and 507 is “free space first”.

Source

pub fn error_kind(self) -> ErrorKind

The exit-code class this collapses onto.

The ordering cli.py’s classify documents as “the contract” is a match here rather than a sequence of isinstance tests, which removes the way it could be got wrong: WireKind::Unauthorized is an HTTP error whose remedy is a credential rather than a wait, and in Python it had to be checked before the generic retryable test to avoid being swallowed by it. A match on a closed enum has no order to get wrong.

Trait Implementations§

Source§

impl Clone for WireKind

Source§

fn clone(&self) -> WireKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WireKind

Source§

impl Debug for WireKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for WireKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for WireKind

Source§

impl Hash for WireKind

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for WireKind

Source§

fn eq(&self, other: &WireKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WireKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more