fix: ChildResultBroker.wait drops a delivered result on a cancel race #458
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#458
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code-quality audit (P2).
internal/mcp/child_results.go:91-98.Why it matters
If the child's result and
ctx.Done()become ready in the same scheduling window,selectpicks uniformly at random. When it takes the result branch, the post-check throws the payload away — and the waiter has already been removed fromb.waiters, so the result is unrecoverable. The parent session loses a completed child's output and reports a timeout instead. Rare, non-deterministic, and unreproducible from the log.The
ctx.Err()pre-check before theselectis correct and should stay; only the post-receive check is wrong.Suggested fix
Delete the post-receive
ctx.Err()check. A result in hand beats a cancellation that arrived at the same instant.Acceptance criteria
waitreturns a received result even whenctxis already done.main.Effort: S.