Repository navigation
fix(agent): a running action reports to the stream that delivered it last (closes #483) - #507
Merged
Merged
Conversation
…last (closes #483) A redelivery of an action still running returned without attaching, and the action kept sending to the stream it started on. When that stream had ended, the control plane never heard the outcome until another reconnection. Running actions now keep their last update and their current delivery: a new delivery gets the last update at once and every later one, the outcome included. Signed-off-by: samuel mbabhazi <[email protected]>
|
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 55 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. |
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.
What changed
In
agent/internal/actions, each running action now holds a mutable delivery and its last update, in a newinflighttype:publish, which keeps the update and sends it to the current delivery.attach. It becomes the action's delivery and gets the last update at once. Every later update goes to it, the final one included. The earlier delivery hears nothing more.Cancelis unchanged.SPEC 3.4 now describes the behavior.
Why
Closes #483. The control plane redelivers unfinished actions on a new stream. A redelivery of an action still running returned without subscribing, and the action kept sending to the stream it started on. When that stream had ended, its updates were dropped, and the outcome reached the control plane only after one more reconnection, or never before the action expired.
How it was tested
TestDispatcherReattachesARunningActionToItsLatestDelivery(production dispatcher and SQLite journal). A step blocks, and the action is delivered twice more while it runs.RUNNINGat once. The last one getsSUCCEEDEDwith its result, and the replaced one gets nothing after it was replaced.TestRunnerReattachesARunningActionToTheReplacementStream(real gRPC through the test gateway, realRunner,Dispatcherand journal).RUNNINGarrives on connection 2, thenSUCCEEDEDwith its result, also on connection 2, over exactly two connections. The step ran once.go test -race ./agent/...passes, andgolangci-lint run ./agent/...reports 0 issues.Security considerations
No new input or action. An update still goes only to a stream of the same node, through the same runner. Replacing the delivery drops the reference to the ended session's send function, so a long series of reconnections keeps nothing behind.