trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c - #1071
Closed
trunk-io[bot] wants to merge 2 commits into
Closed
trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c#1071trunk-io[bot] wants to merge 2 commits into
trunk-io[bot] wants to merge 2 commits into
Conversation
…lf (RIG-3606) `TestPeerDMTaskingLoopEndToEnd` flaked in the merge queue and ejected an unrelated TypeScript-only PR from its batch. The fixture's teardown closed the Sessions request half while the fake runner could still be answering a command. connect-go fails a write to a closed request half with `write envelope: EOF` (CodeUnknown), which the serve loop reports as a dirty end — the assertion that fired. Every non-nil error the loop can report comes from a `stream.Send`; its only Receive site maps `io.EOF` to a clean nil, so the failure was never a Receive that missed an EOF. An abandoned wake is what puts a reply in flight: the delivery consumer calls `WakeAgent` synchronously, `freshStart` pushes `hub.Start`, and cancelling the consumer's context aborts the wake server-side while the fake runner is still writing its answer. Cleanup order was already correct (`t.Cleanup` is LIFO), but the consumer's `<-done` bounds only its own `Run` goroutine, never the fake runner's `serve` goroutine. Every reply now goes through a `send` helper holding `sendMu`, and teardown calls `stopSending` before `CloseRequest`. Taking the lock waits out a write already running; the `closing` latch bars any later one, so the request half is only ever closed with no Send in flight. A reply dropped after the latch reports success rather than an error, since a teardown artifact is not a loop fault. `sendMu` is deliberately separate from `mu`: a Send must not serialize against `commands()`/`startCount()`, which test goroutines poll in tight deadline loops. The `want a clean EOF` assertion keeps its teeth — `Receive` is untouched, so every genuine loop fault still reaches it. Verified red/green with a 150ms delay injected inside the guarded send: without `stopSending` the exact reported failure reproduces on the first run; with it, 5/5 pass. The fixture's users — DM e2e, offline-mention, forge-notify, resume, placement, spawn/despawn, wake, rollback-stop and singleflight suites — pass under CI's tag set with `-race`. Fixture-only; production asserts nothing about a runner's send loop. Refs RIG-3606 Co-authored-by: Matt Wilkinson <matt@rigel.build>
|
Compass engineering docs preview: https://trunk-merge-pr-1065-25d1b69f.compass-eng-docs.pages.dev Deployed from |
trunk-io
Bot
deleted the
trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c
branch
September 11, 2026 13:11
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.
This pull request was created and is being managed by Trunk Merge.
This pull request is based on the main branch at SHA d1f08e82080c00c9fd8a005202105d58fa1e7b09.
See more details here.
When CI completes, this pull request will be closed automatically.
Pull Requests Being Tested
This pull request is testing the changes from pull request 1065.