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: boolWhether 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
impl CapReading
Sourcepub fn reset_label(&self) -> Option<String>
pub fn reset_label(&self) -> Option<String>
The reset time as a 24-hour 21:50, for the badge.
Sourcepub fn reset_passed(&self, now_minutes: u16) -> bool
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
impl Clone for CapReading
Source§fn clone(&self) -> CapReading
fn clone(&self) -> CapReading
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CapReading
Source§impl Debug for CapReading
impl Debug for CapReading
Source§impl Default for CapReading
impl Default for CapReading
Source§fn default() -> CapReading
fn default() -> CapReading
impl Eq for CapReading
Source§impl PartialEq for CapReading
impl PartialEq for CapReading
impl StructuralPartialEq for CapReading
Auto Trait Implementations§
impl Freeze for CapReading
impl RefUnwindSafe for CapReading
impl Send for CapReading
impl Sync for CapReading
impl Unpin for CapReading
impl UnsafeUnpin for CapReading
impl UnwindSafe for CapReading
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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.