Repository navigation
fix: bound the timeout and release the agent - #22
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 5b35e19 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Cancelling only asked the SDK to stop and the runner kept waiting on the stream with no limit, so a run that ignored the request held the step until the job timeout. Wait a bounded grace period after cancelling, report the run as cancelled, and dispose the agent on every path so the local executor is released.
Add a run that ignores cancellation, and check that the agent is released after success, after a failed send, and when releasing it hangs.
The timeout now stops waiting ten seconds after the cancel request, and the agent is released when the run ends.
710b82c to
5b35e19
Compare
Description
The
timeoutinput only asked the SDK to cancel; after that the runner kept awaitingrun.stream()andrun.wait()with no bound, so a run that ignored the request held the step until the job'stimeout-minutes(six hours by default) while still consuming tokens. The runner now races the run against the deadline, requests cancellation, waits at most ten seconds for the SDK to settle, and otherwise reports the run ascancelledwith exit code 1. It also disposes the agent (Symbol.asyncDispose) on every path, bounded by its own fifteen-second limit, which releases the local executor the SDK started for the run.Stacked on #19.
Related Issues
None.
Checklist
.github/–only changes).github/–only community or template updates)Screenshots (if applicable)
N/A
Additional Notes
A run that finishes during the cancel grace period keeps its result and exit code 0, with a warning that it overran the timeout, so the previous behaviour for agents that do not support cancellation is preserved, just bounded. New tests cover a run that ignores cancellation, disposal after success, disposal after a failed
send, and a hanging dispose. Worth running the manual Smoke Test before release to confirm the process exits promptly once the agent is released.