Skip to main content

CapReading

Struct CapReading 

Source
pub struct CapReading {
    pub reset_minutes: Option<u16>,
    pub retrying: bool,
}
Expand description

What a session’s output says about a usage cap. Held in memory only: it is a reading of the current output tail, retaken on the next pass, so it clears itself once the operator continues the session and new output displaces the cap message (§8). Nothing about it reaches the database.

Fields§

§reset_minutes: Option<u16>

When the window reopens, as minutes past local midnight, if the message named a time. Best-effort by design: an unparsed time badges without one rather than suppressing the badge.

§retrying: bool

Whether the agent said it is retrying the rejected request rather than having ended its turn on it.

This is the one capped shape a nudge must not touch. The session is mid-turn: it holds the request itself and will resume when the retry lands, so stopping it to send continue kills a turn that needed no help — and the sweep stops its target unconditionally (§8), so there is nothing else between a misread and a killed turn. Both shapes otherwise read identically: blocked in the agent’s listing, supervisor alive, the same cap phrase in the output.

The risk this guards is not that a cap retries — Claude Code refuses to retry a usage-limit rejection at all (§8) — but that a retry reads as a cap. A rate limit that carries no usage-limit headers is retried, and the agent labels that retry with the API’s own message, which says “rate limit” in it: a signature this module matches, riding a session that is working perfectly well.

Implementations§

Source§

impl CapReading

Source

pub fn reset_label(&self) -> Option<String>

The reset time as a 24-hour 21:50, for the badge.

Source

pub fn reset_passed(&self, now_minutes: u16) -> bool

Whether the named reset has already gone by, given the local wall clock as minutes past midnight — and so whether this session is waiting on a human rather than on the clock. A retrying session is never either: it is waiting on its own request, and its reset time is when that request goes out, not when someone should intervene.

The agent names a bare clock time — 9:50pm, no date — so the occurrence meant is the one nearest now, in either direction. Taking the next one instead would be self-defeating: a minute after the window reopened, “the next 9:50pm” is tomorrow’s, and the badge would claim another 24 hours of waiting exactly when it should be saying the opposite. Half a day is the widest a bare clock time can be read unambiguously, and a cap window the operator is watching is never further off than that.

Trait Implementations§

Source§

impl Clone for CapReading

Source§

fn clone(&self) -> CapReading

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 CapReading

Source§

impl Debug for CapReading

Source§

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

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

impl Default for CapReading

Source§

fn default() -> CapReading

Returns the “default value” for a type. Read more
Source§

impl Eq for CapReading

Source§

impl PartialEq for CapReading

Source§

fn eq(&self, other: &CapReading) -> 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 CapReading

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.