[Bug] fix(coding-agent): auto-retry leaves isRetrying stuck when agent.continue() fails #1812
Replies: 1 comment
|
Investigated this report and produced a candidate fix, validated on a fork of this repository. Root cause, fix and validation from the working notes:
Diff: awhite0030/prime-agent@main...fix-auto-retry-busy-4282417193482550207 The change passes |
Uh oh!
There was an error while loading. Please reload this page.
Affected area
Coding agent and CLI
What happened?
After a transient provider error, auto-retry schedules
agent.continue()via a fire-and-forgetsetTimeoutand swallows all rejections with.catch(() => {}).If
continue()fails withAgentContinueError(busyornothing-to-continue) and no lateragent_endarrives,_retryPromiseis never resolved. The session stays atisRetrying === true, andwaitForRetry()/ headless idle waiters can hang untilabortRetry().Code:
packages/coding-agent/src/core/agent-session.tsin_handleRetryableError:setTimeout(() => {
this.agent.continue().catch(() => {});
}, 0);
Impact: auto-retry can leave the session permanently “retrying”, blocking idle settlement for ACP/print/headless callers. This is separate from post-compaction continuation (#1716 / #1583), which already reschedules on
busy.Steps to reproduce
_handleRetryableErrorruns and emitsauto_retry_start.agent.continue()reject withAgentContinueError(busyornothing-to-continue) — e.g. another run already active, or the last assistant was stripped so there is nothing to continue from.agent_end;session.isRetryingstaystrue;waitForRetry()does not settle untilabortRetry().(Can also be covered with a focused unit/regression harness that stubs
continue()to reject after the retry delay.)Expected behavior
busy: reschedulecontinue()(same idea as post-compaction), keep retry settlement owned.nothing-to-continue/ non-retryable failure: emitauto_retry_end(success: false), clear attempt state, call_resolveRetry()so waiters unblock._retryPromiseunresolved whencontinue()never starts a turn..catch(() => {}).Prime Agent version
bc0fa76 (main @ test(coding-agent): cover root sibling agent messaging #1698)
Environment
Reproduced by code inspection on current main; logic is OS-agnostic (TypeScript session retry path). Local check: Windows 10 + WSL, repo cloned from PrimeIntellect-ai/prime-agent.
Additional context
Related but out of scope:
No existing Bug reports Discussion found for this specific
isRetrying/_retryPromisehang.Suggested fix: await
continue(), branch onAgentContinueError.code, mirror post-compaction busy/reschedule + fail-closed settle.Happy to open a PR with a focused fix + regression test if a maintainer invites implementation.
All reactions