flaky seam: TestRelayForwarder_SupervisesRetryAndStops hangs stop() at random — the test double can swallow the child exit the supervisor reaps #1763
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1763
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?
Symptom
ci/ seam fails intermittently on main with no source change of its own:Seen in ci run https://git.matou.nz/Matou/idss/actions/runs/30961 (heal signature
6e2243f659e0). The exact-2.00s elapsed time is the test's owntime.After(2 * time.Second)bound ininternal/fleetwire/relay_test.go:111, sostop()genuinely never returned — this is a hang, not slowness.Reproduced
Fresh clone of main (
2fff29df), go 1.26.5:Fails roughly once per ~1000–1200 iterations (1 of 6 × 200-count runs).
GOMAXPROCS=1and the default (8) did not reproduce in 3200+ iterations — it needs two runnable Ps and a descheduling window, which is exactly what the loaded seam host provides (ci.yml documents the seam driving host load to 25/8, #1230 / matou-app#285).Root cause — the test double, not
relay.goThe only unbounded block on the shutdown path is the reap in
RelayForwarder.supervise(internal/fleetwire/relay.go):Every other select on that path has a
ctx.Done()arm, sostop()→cancel()→wg.Wait()can only hang here. It hangs iffexitednever receives afterkill().The fake starter in
relay_test.go:70-88can do exactly that:When
stop()cancels, both arms race. If this goroutine is descheduled long enough for the supervisor to observectx.Done()first and callkill()(closingdone), both cases are ready and Go picks uniformly — half the time it takes<-doneand returns without ever sending onex. The supervisor then blocks on<-exitedforever.So the fake violates the
relayStartercontract its own doc comment states — "returns a channel that delivers its exit" (relay.go:57-60). The productionexecRelayStarteralways delivers (cmd.Wait()sends on every exit path, including aStart()failure), so production is not affected: the live relay forwarder shuts down correctly. This is a test-double defect that red-lights main at random.Suggested fix
Make the fake honour the contract — always deliver an exit, whichever way the child dies:
exis buffered 1 and read at most once per launch, so this cannot block.Worth deciding alongside it (a judgement call for whoever picks this up, not required by the evidence): whether
supervise's bare<-exitedreap should carry a bound, so a production starter that ever failed to deliver would makestop()slow rather than permanently wedged. The reap's comment says it exists sostop()"does not race a live ssh" — a bounded wait keeps that guarantee for every realistic case.Acceptance
GOMAXPROCS=2 go test ./internal/fleetwire/ -run TestRelayForwarder_SupervisesRetryAndStops -count=5000is green.stop()cancels the retry loop and reaps the running child.Filed by the swarm healer (heal run
heal-Matou-idss-1790174324-1529982). Product-class fault — the healer did not touch the code.swarm-claim host=matou-dev-server-01 run=30959
(automated multi-host claim — lowest live claim id works this ticket)
swarm-claim host=matou-dev-server-01 run=31006
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #1763 — status
success⛔ close-report gates REFUSED this close — the following claims did not verify:
767d3d35is not reachable from origin/main (not landed)envelope
close-report for #1763 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope