Repository navigation
Isolate in-process work-item completion by delivery token - #815
Merged
wangbill (YunchuWang) merged 4 commits intoOct 13, 2026
Merged
Conversation
Assign fresh completion tokens for both work-item kinds and coordinate validation, completion, and send-failure cleanup using per-delivery pending state. Preserve an accepted result when its pending send later fails. Retire test-host partial response accumulation and reject deprecated partial/chunked completion fields without settling the delivery. Keep replay history streaming and acknowledgement-only abandonment unchanged. Document direct gRPC migration and include completion/snapshot coverage plus compatible local integration expectations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5777cc4b-513e-47b7-a159-75ad5e8a7298
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Core concurrency and migration behavior are well covered; remaining feedback concerns non-blocking test naming.
1 open finding
What changed in this PR
Introduces delivery-scoped completion ownership for the in-process test host.
Changes:
- Adds atomic token-based completion and send-failure handling.
- Rejects deprecated chunked orchestrator responses.
- Expands race, snapshot, token, and integration coverage with migration documentation.
| File | Description |
|---|---|
src/InProcessTestHost/Sidecar/Grpc/TaskHubGrpcServer.cs |
Implements token-owned completion settlement. |
src/InProcessTestHost/README.md |
Documents behavioral break and migration. |
test/InProcessTestHost.Tests/WorkItemCompletionTests.cs |
Covers ownership and completion races. |
test/InProcessTestHost.Tests/WorkerHistorySnapshotTests.cs |
Verifies snapshot ownership and cleanup. |
test/Grpc.IntegrationTests/AutochunkTests.cs |
Updates integration coverage for full responses. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Document exact case-sensitive delivery-token echo while retaining case-insensitive instance IDs. Initialize activity results with a conditional expression, use disposal-path using declarations for the original readonly session cancellation sources, and add Async suffixes to the newly introduced integration tests. Keep these nonbehavioral review changes separate from unsupported-chunk settlement. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5777cc4b-513e-47b7-a159-75ad5e8a7298
Validate delivery token and identity before rejecting legacy chunk fields. Atomically settle a valid unsupported completion with one non-retriable Failed action while returning InvalidArgument to the sender. Discard fragment actions and use the existing commit path instead of stranding or requeueing the delivery. Add bounded real SDK/local-gRPC red-green coverage, malformed-request isolation, competing settlement and late-send-failure cases. Document terminal failure while leaving SDK, history streaming and general abandonment unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5777cc4b-513e-47b7-a159-75ad5e8a7298
kaibocai (kaibocai)
approved these changes
Oct 13, 2026
wangbill (YunchuWang)
deleted the
yunchuwang-test-host-completion-ownership
branch
October 13, 2026 19:17
wangbill (YunchuWang)
added a commit
that referenced
this pull request
Oct 13, 2026
Build on the per-delivery completion ownership merged in PR #815. Validate explicit activity and orchestrator abandonment tokens, atomically claim the matching pending delivery, and cancel its host-side result wait so the existing dispatcher releases and requeues the work. Keep completion, terminal unsupported-chunk failure, send-failure ownership, history snapshots, SDK, and protobuf behavior unchanged. Add focused cancellation, stale-delivery, competing-settlement, snapshot, and localhost SDK-redelivery coverage; retire the prerequisite's acknowledgement-only abandonment regression. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b1e0a4ae-0f35-4308-9ceb-e920bdbb9dab
This was referenced Oct 13, 2026
Open
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
What changed?
IsPartial = trueor any presentChunkIndex, including a final fragment, atomically settles its delivery with a single terminal Failed action and non-retriableNotSupportedExceptiondetails, while returningInvalidArgumentto the sender. Discard all fragment actions; invalid tokens or identities still leave valid deliveries untouched.Why is this change needed?
Breaking Change
Type: behavioral
Impact: Direct gRPC callers of the in-process test host must now echo the received delivery token exactly, including its casing. Missing tokens and mismatched identities return
InvalidArgument; unknown, wrong-kind, and settled tokens returnNotFound, without consuming valid deliveries. The test host also no longer accepts deprecated partial/chunked orchestrator completions: a valid matching chunk fails the orchestration terminally, releases its execution/snapshot resources through the existing commit path, and returnsInvalidArgumentto the sender. The SDK's existing oversized-response chunking implementation is unchanged and now encounters this explicit failure instead of leaving the orchestration pending.Migration: Copy
WorkItem.completionTokeninto every supportedActivityResponseorOrchestratorResponse, preserving the instance ID and activity task ID. Send all orchestrator actions in one response withIsPartialfalse andChunkIndexomitted, within the configured SDK/gRPC message-size limits. Normal whole-response SDK callers already echo the token. There is no binary/source API change, protobuf field renumbering, serializer change, or orchestrator replay change. Migration details are also documented insrc/InProcessTestHost/README.md.Issues / work items
Project checklist
release_notes.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
These personal review attestations are left for the human reviewer; automated evidence is recorded below.
Testing
Automated tests
dotnet test test\InProcessTestHost.Tests\InProcessTestHost.Tests.csproj --configuration Release --no-build --no-restore --filter "FullyQualifiedName~WorkItemCompletion|FullyQualifiedName~WorkerHistorySnapshot|FullyQualifiedName~HubLifecycle" --verbosity minimal- passed, 46/46, zero skipped.dotnet test test\InProcessTestHost.Tests\InProcessTestHost.Tests.csproj --configuration Release --no-build --no-restore --verbosity minimal- passed, 98/98, zero skipped.dotnet test test\Grpc.IntegrationTests\Grpc.IntegrationTests.csproj --configuration Release --no-build --no-restore --filter "FullyQualifiedName~AutochunkTests|FullyQualifiedName~LargePayloadTests|FullyQualifiedName~ClassSyntaxIntegrationTests" --verbosity minimal- passed, 29/29, zero skipped. This covers actual SDK chunk rejection/terminal failure, localhost completion, the preserved oversized-action failure, payload externalization/history streaming, and class-based/versioned SDK callers.dotnet build src\InProcessTestHost\InProcessTestHost.csproj --configuration Release --no-restore --verbosity minimal- passed for net6.0, net8.0, and net10.0, zero errors; existing analyzer warnings remain.git diff --check origin/main HEAD- passed.InvalidArgument, then successful Abandon acknowledgement, and timed out after 10 seconds; its bounded cleanup released the old delivery. Eight direct cases also failed, covering stranded snapshots, wrong-kind/unknown token precedence, competing settlement, and a rejected-chunk/late-send race. These now pass with terminal Failed results and isolated ownership.Manual validation (only if runtime/behavior changed)
StreamInstanceHistoryare identical to main, and no SDK/protobuf/dispatcher changes are included.Notes for reviewers