[Bug]: A Claude background wake during a usage limit is recorded as completed and drops the armed auto-resume #49627
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Turn on Settings → Resume after usage limits (
autoResumeLimitedThreads: true). - In a Claude thread, start two or more background tasks (for example two dynamic workflows or background subagents), then let the turn end.
- While those tasks are still running, let the account hit its 5-hour limit. The next wake turn fails: T3 shows "Claude usage limit reached. This turn is paused until the 5-hour limit resets in 3m" and arms auto-resume for that run.
- Before the reset, let another background task finish.
Expected behavior#
The thread stays usage-limited and auto-resumes at the reset.
Actual behavior#
When the second task finishes, Claude Code emits only a task_notification, a system/init and an empty session-task result. It does not call the model because the account is still limited, and it does not repeat the rejected rate_limit_event. The result looks like this:
{"type":"result","subtype":"success","is_error":false,"num_turns":0,"duration_api_ms":0,"result":"",
"origin":{"kind":"task-notification","producer":"session-task"},"model_usage_since_last_result":{},…}
T3 opens a provider-continuation run for that wake and finalizes it as completed: no error and no executed model. The thread's latest executed run is now a completed run, so getLimitRecoveryCandidates / limitRecoveryCommand no longer treat the thread as limited. Nothing runs at the reset, and there's no banner or notice. thread.limitRecovery still says {"runId": <the failed run>, "autoResume": true} hours later.
Timeline from one occurrence (UTC, Claude Code 5-hour window resetting at 07:40:00):
| time | event |
|---|---|
| 07:37:35 | rate_limit_event status: rejected, rateLimitType: five_hour, resetsAt 07:40:00 |
| 07:37:37 | wake turn result is_error: true, api_error_status: 429 → run 10 failed usage_limit, resetAt 07:40:00 |
| 07:37:50 | limit-arm:…:ordinal:10:… → limitRecovery {runId: run 10, autoResume: true} |
| 07:37:54 | another workflow finishes → task_notification, system/init, then the empty num_turns: 0 result above |
| 07:37:55 | run 11 (provider continuation) completed, no error item, no executed model |
| 07:40:00 | reset passes and nothing is dispatched |
| ~12h later | the user types "continue" by hand |
The run-10 provider log, statev2.sqlite run rows, turn items and effect outbox all agree. No limit-resume: effect was ever enqueued.
Impact#
Major degradation or frequent failure. Long unattended Claude sessions that use background workflows or subagents are exactly the ones likely to hit the limit with more than one task in flight, and they silently stop instead of resuming.
Version or commit#
0.1.12-nightly.20261121.5051 (desktop, macOS). The same logic is on main at 0432c3e7fc.
Environment#
macOS desktop app, Claude provider (Claude Code CLI, subscription account, 5-hour window), auto-resume on.
Workaround#
Type "continue" in the thread once the limit has reset.
Related#
- #41583: a subagent finishing while the parent is limited drops a manually armed auto-resume. That's the same trigger class, but there the wake reaches the provider and fails again. Here the Claude wake never reaches the model and is recorded as completed.
- #40229 (closed): the same symptom for Antigravity, where a quota hit after a background-task wake was recorded as
completedand never auto-resumed.
tanstack-source added labelsbug
sahil7886(GitHub profile, opens in a new tab) linked this to #49628
Sign in to join this conversation.