Repository navigation
Description
Context
A production code-review run with CLI 0.4.3 and zai-coding-plan/glm-5.3 reached the provider’s five-hour rolling usage limit. The CLI treated that response as retryable, made ten retry attempts, and remained alive until the executor's two-hour deadline.
Problem / Goal
A provider response that says its usage limit will reset hours later cannot be recovered within a normal task-execution deadline. Retrying it keeps executions appearing to run while consuming capacity, then reports a timeout instead of the actionable provider limit.
Reproduction
- Configure a provider response that is marked retryable and says
Usage limit reached for 5 hourwith a reset time beyond the task deadline. - Run
aictrl run --format json. - Observe the current session retry loop accepts the long delay and retries until the outer executor timeout.
- Expected: classify this rolling usage-limit response as terminal, emit the normal structured failure lifecycle, and exit non-zero without sleeping/retrying.
Environment
- CLI:
@aictrl/cli0.4.3 - Provider/model: Z.ai GLM-5.3 Coding Plan
- Downstream executor deadline: two hours
Proposed Approach
In src/session/retry.ts, recognize provider usage-limit/reset responses as non-retryable before the retry delay is accepted. Preserve ordinary transient rate-limit retries, and keep the terminal session_error / invocation completion events and error text available to headless consumers.
Acceptance Criteria
- A response containing
Usage limit reachedand a future reset is not retried. - Headless JSON mode emits a structured terminal failure and exits non-zero for that response.
- Normal short-lived 429/rate-limit and overload retry behavior remains covered by regression tests.
- The error makes clear that the provider usage limit, rather than the executor deadline, caused the failure.
Out of Scope
- Changing retry policy for all provider errors.
- Product dashboard/heartbeat instrumentation (handled downstream).
- Retrying automatically after the provider reset time.
Roadmap Alignment
- Pillar: EXEC
- Priority: P1 — production reliability and operator diagnosis.
- Milestone: Enterprise Observability
References
- Related telemetry contract: Expose execution outcome and retry measurement inputs #110 (intentionally excludes retry-policy changes).
- Downstream handoff: aictrl-dev/aictrl#1509.
Activity
fix(session): parse Z.ai quota reset times as UTC+8 (#112)
Merge pull request #174 from aictrl-dev/fix/issue-112-usage-limit-fai…