Repository navigation
Honor explicit abandonment in the in-process test host - #814
Open
wangbill (YunchuWang) wants to merge 2 commits into
Open
wangbill (YunchuWang) wants to merge 2 commits into
wangbill (YunchuWang) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A delayed stream-write failure can override an already-acknowledged completion and incorrectly requeue completed work.
1 open finding
What changed in this PR
Adds receiver-side support for the explicit abandonment introduced by #467, using per-delivery completion tokens to prevent stale settlements.
Changes:
- Cancels and requeues explicitly abandoned work.
- Coordinates completion, partial responses, snapshots, and abandonment by delivery token.
- Adds direct-server and localhost integration coverage plus documentation.
| File | Description |
|---|---|
src/InProcessTestHost/Sidecar/Grpc/TaskHubGrpcServer.cs |
Implements token-based delivery ownership and abandonment. |
src/InProcessTestHost/README.md |
Documents abandonment semantics and migration requirements. |
test/InProcessTestHost.Tests/WorkItemAbandonmentTests.cs |
Tests settlement, concurrency, and cleanup behavior. |
test/InProcessTestHost.Tests/WorkItemAbandonmentIntegrationTests.cs |
Tests end-to-end redelivery through gRPC. |
test/InProcessTestHost.Tests/WorkerHistorySnapshotTests.cs |
Updates snapshot tests for completion tokens. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
4 of 15 tasks
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
wangbill (YunchuWang)
force-pushed
the
yunchuwang-test-host-explicit-abandonment
branch
from
October 13, 2026 19:36
ec083b7 to
2d5d184
Compare
kaibocai (kaibocai)
previously approved these changes
Oct 13, 2026
Dispose the compatible SDK host even if asynchronous stopping fails. Keep both existing cancellation sources alive for the full server session and dispose them through cleanup-scope aliases, following the completion-test pattern. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b1e0a4ae-0f35-4308-9ceb-e920bdbb9dab
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?
Why is this change needed?
Issues / work items
Project checklist
release_notes.mdWorkItem.completionTokenin abandonment requests. Use a replacement delivery's new token; do not reuse a settled token.AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Automated tests
$evidenceis the session-local artifact directory outside the repository.dotnet test test\InProcessTestHost.Tests\InProcessTestHost.Tests.csproj --configuration Release --filter "FullyQualifiedName~WorkItemCompletionTests|FullyQualifiedName~WorkerHistorySnapshotTests" --verbosity quiet --logger "trx;LogFileName=baseline-completion-history.trx" --results-directory "$evidence\baseline-completion-history"dotnet test test\InProcessTestHost.Tests\InProcessTestHost.Tests.csproj --configuration Release --no-build --no-restore --filter "FullyQualifiedName~AbandonWorkItem_CancelsPendingExecutionAsync|FullyQualifiedName~WorkItemAbandonmentIntegrationTests" --verbosity normal --logger "trx;LogFileName=abandonment-red.trx" --results-directory "$evidence\abandonment-red"dotnet test test\InProcessTestHost.Tests\InProcessTestHost.Tests.csproj --configuration Release --no-restore --filter "FullyQualifiedName~WorkItemCompletionTests|FullyQualifiedName~WorkItemAbandonment|FullyQualifiedName~WorkerHistorySnapshotTests" --verbosity quiet --logger "trx;LogFileName=focused-green.trx" --results-directory "$evidence\focused-green"dotnet test test\InProcessTestHost.Tests\InProcessTestHost.Tests.csproj --configuration Release --no-build --no-restore --verbosity quiet --logger "trx;LogFileName=owning-suite.trx" --results-directory "$evidence\owning-suite"dotnet test test\Grpc.IntegrationTests\Grpc.IntegrationTests.csproj --configuration Release --filter "FullyQualifiedName~AutochunkTests" --verbosity quiet --logger "trx;LogFileName=autochunk.trx" --results-directory "$evidence\autochunk"ChunkedResponse_FailsWithoutSchedulingFragmentActionsAsync; SDK chunk rejection remains terminal Failed with no fragment activities executed.dotnet build src\InProcessTestHost\InProcessTestHost.csproj --configuration Release --no-restore --verbosity quietnet6.0,net8.0, andnet10.0: 0 errors; 143 existing warnings across the build graph.git diff --check origin/main...HEADDependencies were restored only after the initial no-restore commands reported missing assets. Hosted CI results are not claimed. Full-solution tests, DTS emulator tests, and real Azure tests were not run locally.
Manual validation (only if runtime/behavior changed)
Notes for reviewers
Breaking Change
Type: behavioral (direct test-host abandonment request validation and settlement timing).
Impact: Both Abandon RPCs now require a nonempty token for an active delivery of the corresponding kind. Missing tokens return
InvalidArgument; unknown, wrong-kind, or already settled tokens returnNotFound. Invalid requests do not consume an active delivery. A valid abandonment cancels that delivery's host-side wait and enables retry. Successful completion and abandonment compete under the existing ownership lock; only one can settle the delivery.Migration: Echo the received
WorkItem.completionTokenin abandonment requests, preserving its exact casing. A redelivery has a new token. Completion-token migration and unsupported-chunk handling are already documented in #815, not introduced here.Terminate.GetWorkItemsis not implicit abandonment. No timeout, heartbeat, lease, entity, production DTS, worker-policy, storage, or hub-lifecycle change is included.NotSupportedExceptiondetails while returningInvalidArgument. A subsequent SDK abandonment of that settled token returnsNotFoundand cannot undo that result or requeue it. Replay history streaming remains supported separately.+24/-2lines). The remaining changes are their tests/docs and removal of the obsolete acknowledgement-only regression.