Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
- Last reviewed commit: 6cde0e580f94be8e8c3f3abbda30d382009dbfeb
- Latest commit, not reviewed: 8838afc5a114000b87733eb3372ebefc4b337269
Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.
Use the checkboxes below for quick actions:
- ▶️ Resume reviews
- 🔍 Trigger review
No actionable comments were generated in the recent review.
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
414285bf-7db0-402e-bdd0-afc938589031
📥 Commits
Reviewing files that changed from the base of the PR and between 23cbc0743f8983d66b927fcea1ba17bd95892d09 and 6cde0e580f94be8e8c3f3abbda30d382009dbfeb.
📒 Files selected for processing: 3
apps/server/src/orchestration-v2/Orchestrator.tsapps/server/src/orchestration-v2/UsageLimitRecovery.tsapps/server/src/orchestration-v2/runtimeLayer.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Walkthrough
Usage-limit auto-resume now applies a 120-second margin after the later of the reset time and run completion or request time. Candidate selection and continuation checks share recovery timing and stale-reset rules. Runtime tests cover retry boundaries, rearming, cancellation, and stopping.
Changes: Usage-limit auto-resume
Layer / File(s) Summary Recovery timing and candidate eligibility
apps/server/src/orchestration-v2/UsageLimitRecovery.ts,apps/server/src/orchestration-v2/ProjectionStore.ts,apps/server/src/orchestration-v2/ProjectionStore.test.tsShared helpers calculate recovery deadlines and tracked run completion times. SQL and in-memory candidate selection use the shared deadline and stale-reset checks. Candidates include the recovery completion timestamp. Continuation checks and recovery boundaries
apps/server/src/orchestration-v2/Orchestrator.ts,apps/server/src/orchestration-v2/UsageLimitRecoveryWorker.ts,apps/server/src/orchestration-v2/runtimeLayer.test.tsOrchestrator and worker checks use shared timing and stale-reset rules. Manual continuation clears matching automatic recovery metadata. Runtime tests cover resume margins, repeated refusals, rearming, cancellation, replay consistency, and stop behavior. Priority: External image Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
mermaid1 sequenceDiagram 2 participant ProjectionStore 3 participant UsageLimitRecovery 4 participant Orchestrator 5 participant UsageLimitRecoveryWorker 6 ProjectionStore->>UsageLimitRecovery: calculate recovery due time 7 UsageLimitRecovery-->>ProjectionStore: return candidate timing 8 UsageLimitRecoveryWorker->>UsageLimitRecovery: validate stale reset and due time 9 Orchestrator->>UsageLimitRecovery: validate recovery metadata and due time 10 Orchestrator-->>Orchestrator: clear matching metadata on manual continuation Possibly related issues
- pingdotgg/t3code#22851 — The issue concerns a refused message during armed usage-limit recovery. This PR changes refusal and retry state, but does not hold and replace the user message.
Suggested reviewers:
yash-singh1
Merge Risk: External image Minimal · previous review 6cde0
Usage-limit auto-resume now waits a safety margin after the reset, retries once after a refusal, and stays stopped after the cap. Stop can no longer be undone by re-enabling auto-resume, so no merge-blocking risk remains.
Architecture risk: External image Low · up to 0603d
The change affects 1 system.
Changed systems:
apps/serverArchitecture concerns No architecture-level concerns identified.
Review details
Systems and components
- observed — apps/server (service) was modified; 7 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in apps/server/src/orchestration-v2/ProjectionStore.test.ts: The recovery-due assertion now uses a timestamp two minutes after the reset time rather than the reset time itself.
- observed — Modified behavior in apps/server/src/orchestration-v2/ProjectionStore.test.ts: Pending runtime requests and a snooze lasting three minutes after reset are each asserted to exclude the thread from limit-recovery candidates, even when evaluated two minutes after reset.
- observed — Modified behavior in apps/server/src/orchestration-v2/ProjectionStore.test.ts: The final recovery-candidate check now uses the two-minutes-after-reset timestamp while disabling automatic resume; the thread remains ineligible.
- observed — Modified behavior in apps/server/src/orchestration-v2/UsageLimitRecovery.ts: Added recovery timing utilities, including a 120-second resume margin, calculation of the later reset/completion timestamp, and lookup of the tracked recovery run’s completion or request time.
Pre-merge checks: Passed 4
Check name Status Explanation Title check Passed The title clearly and concisely describes the main server change: allowing one auto-resume retry after a usage-limit refusal. Description check Passed The description covers the problem, implementation, scope approval, cancellation behavior, limitations, focused verification, test results, tooling checks, and agent attribution. It follows the requir… Linked Issues check Passed Issue [ #22026] requires delayed usage-limit auto-resume and a later retry after a same-reset refusal.UsageLimitRecovery.dueMsapplies a 120-second margin after the later ofresetAtand run comple…Out of Scope Changes check Passed The changes stay within the server usage-limit recovery path for issue [ #22026].UsageLimitRecovery,UsageLimitRecoveryWorker,ProjectionStore, andOrchestratorimplement the recovery behavior…Full details: Description check
Explanation
The description covers the problem, implementation, scope approval, cancellation behavior, limitations, focused verification, test results, tooling checks, and agent attribution. It follows the required template and directly matches the reported changes.
Full details: Linked Issues check
Explanation
Issue [
#22026] requires delayed usage-limit auto-resume and a later retry after a same-reset refusal.UsageLimitRecovery.dueMsapplies a 120-second margin after the later ofresetAtand run completion. The worker, projection candidate query, andOrchestratoruse this timing.staleResetAllowedpermits one persisted stale-reset re-arm and rejects a second one. The changes also cover manual continuation, Stop, auto-resume setting changes, cancellation, early delivery, and replay consistency. The added orchestration tests cover these requirements.
Full details: Out of Scope Changes check
Explanation
The changes stay within the server usage-limit recovery path for issue [
#22026].UsageLimitRecovery,UsageLimitRecoveryWorker,ProjectionStore, andOrchestratorimplement the recovery behavior. The test changes verify timing, retry limits, cancellation, setting changes, Stop, and projection replay. The test-layer change supports these tests. No unrelated UI or feature changes are shown.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.