Repository navigation
keep every pending registration per task instead of replacing it - #137
Merged
Merged
Conversation
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
There was a problem hiding this comment.
🟡 Changes recommended
Tokenless completions can settle overlapping executions with another run’s result.
1 open finding
What changed in this PR
Keeps all pending registrations for each local task so overlapping executions are not stranded by newer registrations.
Changes:
- Replaces single-registration storage with a synchronized callback registry.
- Adds delivery, deregistration, concurrency, and executor regression tests.
- Updates the callback contract and enables backend race tests in CI.
| File | Description |
|---|---|
| backend/local/task.go | Retains and delivers to every same-key registration. |
| backend/local/task_test.go | Tests multiple registrations and concurrent use. |
| backend/local/executor_test.go | Tests overlapping executions with distinct completion tokens. |
| backend/backend.go | Documents delivery to all pending callbacks. |
| .github/workflows/pr-validation.yml | Runs backend tests with race detection. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
javier-aliaga
approved these changes
Oct 8, 2026
JoshVanL
requested changes
Oct 8, 2026
…tokenless completions, run all tests with -race Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
JoshVanL
approved these changes
Oct 9, 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.

The local tasks backend kept one completion registration per task (activity: instance ID + task ID, workflow: instance ID) and stored a new one with a plain
sync.Map.Store. A second registration for the same task replaced the first. Complete and cancel only reached the newer one, and the older one's deregister was a no-op, so the older execution stayed pending until the worker context ended.In Dapr this happens when a workflow instance is recreated under the same ID while an activity of the previous run is still executing on the same sidecar.
Stress tests showed sidecars holding about 90 such executions each (about 250 goroutines and 30 MB), released only at shutdown with
failed before receiving activity result. WithWithMaxParallelism, each stranded execution also held a worker slot forever.