Repository navigation
entrypoint: don't cache a call that threw - #137
Merged
Merged
Conversation
The dispatcher of an entrypoint module exited 0 when the function threw, replying with the error on stdout for the entrypoint to raise. The exec therefore succeeded and was cached under the call digest: dagql keeps no result for the failed call, so the next evaluation ran the entrypoint again, its exec answered from the cache, and the same error came back without the function running. A flaky failure stuck until the exec was pruned. The dispatcher now exits 2 after an error reply, so the exec fails and is not cached. A failed exec keeps the tail of its stdout in its error, so the entrypoint rescues it and raises the message from the reply there, or the exec's own error when there is none. The message is capped to fit that tail, keeping the traceparents it cuts. runtimes:entrypoint-failure-reruns-check calls a function that throws a new nonce twice, on node, bun and deno; before this it got the same nonce back. Signed-off-by: Alex Suraci <[email protected]>
Review follow-ups to the previous commit. The call's container is synced before the dispatcher's exec, outside the rescue, so a failed install keeps its own error and values instead of only the message a re-raise keeps on engines before dagger/dagger#15161. The error reply is cut to the bytes it can take in the failed exec's 100 KiB stdout tail, measured on the encoded reply, rather than to 16 Ki characters, so a long ASCII report is no longer cut short. The comments say what tells a function's failure from the dispatcher's: the reply, not the exit code. Signed-off-by: Alex Suraci <[email protected]>
sipsma
approved these changes
Nov 13, 2026
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.
Fixes #136.
When a function in an entrypoint module throws, the failure is no longer cached and replayed.
The dispatcher used to exit 0 after writing an
{ error }reply. That made the exec a cached success under the call digest, so every later evaluation of the failed call got the same error back without running the function. The dispatcher now exits 2 after an error reply, so the exec fails and isn't cached. This matches what the Go, Java and Python entrypoints do, and what the builtin runtime always did.Changes
dispatch_v2.ts.gtpl):process.exitCode = 2when the function threw.[traceparent:…]markers from the cut part.main.dang.gtpl):err.extensions.stdout, and raises its message. When there is no reply, for example when the dispatcher crashed, it re-raises the exec's own error.{ error }reply on an exec that succeeded anyway is still raised.design/module-entrypoint.mdand the comments now describe this protocol.Tests
runtimes:entrypoint-failure-reruns-check. The node, bun and deno fixtures gainnonceFailure(), which throws a fresh UUID. The check calls it twice in one session and requires the nonces to differ.process.exitCode.e2e:generate/entrypoint-reports-errors-checkande2e:version/core-from-bundle-checkassert the new recipe shape.engine-e2e/checks-check, with 129 checks.engine-e2e/generatewrites no changes.Not covered
console.log, likely still lands in the reply channel. Review flagged this and I haven't reproduced it. If so, a function that logs and then throws gets the bare exit-code error, and one that logs and returns fails to decode. That would have been true before this change too, and needs its own fix.