A compaction a rule sends to a model of its own isn't a turn of the
conversation: when it answers, gateway.go leaves the stick where it was
(`hit == nil || !hit.Compact` around answered), so the agent's next turn
stays with the account that had been answering it. When such a reply
breaks off mid-stream — its 200 sent, the vendor's error after — the
broke-off branch called unanswered whatever the request was, and the
stick was taken away: the agent's next turn, an ordinary one, went by
routing again instead of the account it had been talking to. The two
paths now say the same thing about a compaction.
The guard is the success path's own, around the same call site: a
request that isn't a compaction forgets its stick as it did.
TestCompactionBrokeOffKeepsTheStick: a group whose rule sends a
compaction to its own model, the first turn answered by that member,
then the compaction breaking off. The stick is kept. Without the guard
the test fails with "a compaction that broke off took the conversation
off the account that answers it"; the compaction's try is still told as
failed with its rest, as any broken-off reply is. The fixtures replay the
same conversation in the compaction (the agent's own history), which is
what puts it in the same conversation as the first turn.
Validation on Windows: go test ./internal/gateway -run
"TestCompaction|TestRuleCompact|TestLateStream|TestUnanswered|
TestAffinity" passes; the new test fails without the change. go vet
./internal/... and the darwin, GOOS/linux and GOOS/windows builds pass;
the gateway package under a temp HOME passes whole.