Skip to content

rate_limits

rate_limits

Clear rate limits command for Marianne CLI.

Provides mzt clear-rate-limits to manually clear stale rate limits on one or all instruments. Useful when a backend's rate limit has expired but the conductor still caches it, or when an operator wants to force a retry after a rate limit event.

Classes

Functions

clear_rate_limits

clear_rate_limits(instrument=Option(None, '--instrument', '-i', help='Clear rate limit for a specific instrument only (e.g. claude-cli)'), json_output=Option(False, '--json', '-j', help='Output result as JSON'))

Clear stale rate limits on instruments.

When a backend rate limit expires but the conductor still has it cached, sheets may stay blocked unnecessarily. This command clears the cached limit so dispatch resumes immediately.

Clears both the rate limit coordinator (used by the scheduler) and the baton's per-instrument state (used by the dispatch loop).

Examples:

mzt clear-rate-limits # Clear all mzt clear-rate-limits -i claude-cli # Clear one instrument mzt clear-rate-limits --json # JSON output

Source code in src/marianne/cli/commands/rate_limits.py
def clear_rate_limits(
    instrument: str | None = typer.Option(
        None,
        "--instrument",
        "-i",
        help="Clear rate limit for a specific instrument only (e.g. claude-cli)",
    ),
    json_output: bool = typer.Option(
        False,
        "--json",
        "-j",
        help="Output result as JSON",
    ),
) -> None:
    """Clear stale rate limits on instruments.

    When a backend rate limit expires but the conductor still has it cached,
    sheets may stay blocked unnecessarily. This command clears the cached
    limit so dispatch resumes immediately.

    Clears both the rate limit coordinator (used by the scheduler) and
    the baton's per-instrument state (used by the dispatch loop).

    Examples:
        mzt clear-rate-limits                    # Clear all
        mzt clear-rate-limits -i claude-cli      # Clear one instrument
        mzt clear-rate-limits --json             # JSON output
    """
    asyncio.run(_clear_rate_limits(instrument=instrument, json_output=json_output))