anthropics / anthropics/claude-code

Auto-continue at usage limit never arms when the limit kills only background subagents

Aperta
#89,263 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
area:agents area:core bug platform:linux
Lingua principale
Python
Stelle
145k
Fork
23.1k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

**What happened**

Two background agents died with `Agent terminated early due to an API error: You've hit your session limit · resets 12am`. The main thread was idle ("Waiting for 1 background agent to finish") and had no in-flight request. At the reset, nothing resumed — no auto-continue, no "press enter to continue" notice.

**Expected**

Since 2.1.234, auto-continue at usage limit is on by default. I expected the session to pick up after the reset. Instead the work was simply lost until I noticed hours later.

**Why (from the 2.1.241 bundle)**

Arming has exactly one entry point: the main REPL stream handler, on an assistant message with `isApiErrorMessage && error === "rate_limit" && quotaLimits`. The quota-rejected subscriber that handles re-arms also requires an active turn claim and returns early unless the rejection origin is `main_thread`. So a quota rejection that only lands on subagents can never arm — and if the main thread happens to be idle at that moment, the whole episode is silently dropped.

**Why it matters**

For delegation-heavy workflows most tokens are spent in subagents, which is exactly the case the feature doesn't cover. The workaround is to keep a prompt queued so the main thread also takes a rejection, which isn't discoverable.

**Suggestion**

Treat a subagent quota rejection as an arming trigger when the main thread is idle. At minimum, arm the "press enter to continue" (stale) path so the session isn't silently abandoned. Ideally the continuation prompt should also name the agents that were killed mid-work, so the main loop relaunches them rather than guessing at "continue".

Version: 2.1.241 · Linux

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by tracing the main REPL stream handler and the quota-rejected subscriber described in the 2.1.241 bundle, then compare rejection handling for the main thread and background subagents. Reproduce a session where only subagents hit the usage limit while the main thread is idle. Done means the session arms an auto-continue or stale prompt instead of silently dropping the rejection.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.