Expand description
Shared types and helpers for provider usage-limit detection and auto-resume.
When a provider’s CLI hits an upstream rate / usage / weekly limit, zag wants
to (a) detect the limit, (b) compute when it resets, (c) schedule a resume
attempt at that moment, and (d) record the lifecycle in the session log via
crate::session_log::LogEventKind::UsageLimitHit / UsageLimitResumed /
UsageLimitResumeFailed.
Each provider has its own detector module (e.g.
providers/claude/usage_limits.rs). All detectors return UsageLimit so
the scheduler in zag-orch can treat the four providers uniformly.
Structs§
- Usage
Limit - A successful detection of an upstream usage / rate limit.
- Usage
Limit Config - Top-level
[usage_limits]config block. Loaded fromzag.toml. - Usage
Limit Provider Override - Per-provider override. Any unset field falls back to the top-level value.
Enums§
Functions§
- compute_
resume_ at - Compute the moment zag should attempt to resume.
- log_
event_ hit - Build a
crate::session_log::LogEventKind::UsageLimitHitfrom a detectedUsageLimit. Single source of truth for the scheduled-resume path — every site that knows a resume timer is going to fire (relay, foreground auto-resume loop) calls this so the wire shape can never drift. - to_
log_ event_ hit - Build a
UsageLimitHitlog event for orphan log-only detections (e.g. the Codex TUI line parser) where no auto-resume scheduler is involved. Generates a fresh incident id; scheduling fields are left empty because nothing is scheduled.