Repository navigation
Conversation
A lease heartbeat renewal can fail after DurableRuntime's tick()/process() has already returned, e.g. because the backend hiccuped or the lease was taken over. The old code called thread.interrupt() unconditionally, so a late heartbeat failure interrupted whatever the worker thread was running next instead of the finished invocation. Introduce a settled flag: once the invocation's finally block has run, the heartbeat's stop() only flips the stopped flag and never interrupts. While the invocation is still in flight, cancellation behavior is unchanged. Split out of agentscope-ai#4102 for independent review per maintainer feedback.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DurableRuntime'stick()/process()has already returned (backend hiccup, lease takeover). The old code calledthread.interrupt()unconditionally, so the late heartbeat interrupted whatever the worker thread was running next instead of the finished invocation.settledflag: once the invocation'sfinallyblock has run, the heartbeat'sstop()only flips the stopped flag and never interrupts. Cancellation behavior while the invocation is still in flight is unchanged.Test plan
lateHeartbeatFailureDoesNotInterruptTheCallerAfterTheInvocationReturnsasserts a late renewal failure leaves the caller's interrupt status clean and the turn SUCCEEDEDmvn -pl agentscope-durable/durable-runtime -am testpasses (36 tests, 0 failures)