Skip to content

trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c - #1071

Closed
trunk-io[bot] wants to merge 2 commits into
mainfrom
trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c
Closed

trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c#1071
trunk-io[bot] wants to merge 2 commits into
mainfrom
trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c

Conversation

@trunk-io

@trunk-io trunk-io Bot commented Sep 11, 2026

Copy link
Copy Markdown
Trunk Merge Pull Request Banner

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.

rigel-mintaka and others added 2 commits September 10, 2026 02:17
…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>
@github-actions

Copy link
Copy Markdown

Compass engineering docs preview: https://trunk-merge-pr-1065-25d1b69f.compass-eng-docs.pages.dev

Deployed from trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c at 7befc95.

@trunk-io trunk-io Bot closed this Sep 11, 2026
@trunk-io
trunk-io Bot deleted the trunk-merge/pr-1065/25d1b69f-82a9-4663-9a17-24b9fc99727c branch September 11, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant