You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Jcode cannot be stopped while retrying after rate limit is hit #826
When using a model that has reached its rate limit, JCode continuously retries the request indefinitely. During this state, the application becomes effectively impossible to stop, interruption is ignored, and the retry loop continues.
Steps to Reproduce
Configure a model/API with a low rate limit.
Send requests until the rate limit is reached.
Observe the retry behavior.
Attempt to stop the current operation.
Expected Behavior
Retry logic should either:
stop after a configurable number of attempts, or
wait according to the provider's Retry-After header.
Instructing Stop should immediately cancel all pending retries and terminate the request.
Actual Behavior
The application keeps retrying indefinitely after receiving the rate limit error.
The Stop instruction has no effect while retries are occurring.
The only way to recover is to forcibly terminate the application/process.
Additional Information
I've attached a screenshot showing the retry loop and the inability to stop the process.
I'd like to work on this issue. I spent some time reproducing the behavior locally and tracing the retry flow through the TUI, and I believe I've identified the root cause.
What I found
The retry loop correctly schedules retries after a rate-limit response, but /cancel was only treated as an interrupt for an active in-flight request (is_processing). During the waiting period before the next retry, the application wasn't considered "processing", so the pending retry state remained armed and the retry loop continued.
Additionally, there was no final cancellation guard immediately before dispatching the next retry, allowing a queued retry to be resent even if cancellation had just been requested.
Fix implemented
My changes address both parts:
/cancel (and /stop) now also recognize a pending rate-limit retry as an interruptible state.
Cancelling clears the pending retry state before another resend can occur.
Added a final guard before begin_remote_send(...) so a cancelled retry is never dispatched, even if cancellation happens immediately before the retry fires.
Verification
I tested this locally by intentionally using a rate-limited model and reproducing the issue multiple times.
Verified behavior:
✅ Rate-limit retry loop is reproduced.
✅ /cancel immediately stops the pending retry.
✅ No further automatic retries occur after cancellation (verified by waiting several minutes).
✅ New prompts can be submitted normally after cancelling.
✅ cargo fmt passes.
✅ Project builds successfully with cargo build.
The remaining failing tests in my environment are existing unrelated failures and do not touch the TUI retry/cancel path.
If there are no objections, I'd be happy to open a PR with the fix right away. I'd really appreciate a review and, if everything looks good, a merge.
Fixed on agent/triage-2026-08-07 in commit dc57dc6ca. /cancel and /stop now clear a pending rate-limit retry instead of allowing the retry loop to continue. The focused cancellation regression test passes.
--- — Jcode agent (automated triage), on behalf of @1jehuang
Activity
bevinkatti commentedon Aug 7, 2026
Hi @maintainers,
I'd like to work on this issue. I spent some time reproducing the behavior locally and tracing the retry flow through the TUI, and I believe I've identified the root cause.
What I found
The retry loop correctly schedules retries after a rate-limit response, but
/cancelwas only treated as an interrupt for an active in-flight request (is_processing). During the waiting period before the next retry, the application wasn't considered "processing", so the pending retry state remained armed and the retry loop continued.Additionally, there was no final cancellation guard immediately before dispatching the next retry, allowing a queued retry to be resent even if cancellation had just been requested.
Fix implemented
My changes address both parts:
/cancel(and/stop) now also recognize a pending rate-limit retry as an interruptible state.begin_remote_send(...)so a cancelled retry is never dispatched, even if cancellation happens immediately before the retry fires.Verification
I tested this locally by intentionally using a rate-limited model and reproducing the issue multiple times.
Verified behavior:
/cancelimmediately stops the pending retry.cargo fmtpasses.cargo build.The remaining failing tests in my environment are existing unrelated failures and do not touch the TUI retry/cancel path.
If there are no objections, I'd be happy to open a PR with the fix right away. I'd really appreciate a review and, if everything looks good, a merge.
Thanks!
1jehuang commentedon Aug 8, 2026
Fixed on
agent/triage-2026-08-07in commitdc57dc6ca./canceland/stopnow clear a pending rate-limit retry instead of allowing the retry loop to continue. The focused cancellation regression test passes.--- — Jcode agent (automated triage), on behalf of @1jehuang
1jehuang commentedon Aug 8, 2026
The validated fix is now available for review in #841 on a clean branch based on the public default branch.
--- — Jcode agent (automated triage), on behalf of @1jehuang
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)
chore: sync fork with upstream jcode (fresh merge onto current master) (
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)
fix: unblock SDK 1.2.0 runtime refresh (1jehuang#842)