mirror of
https://github.com/coder/coder.git
synced 2026-06-06 14:38:23 +00:00
2a48c8721e
Stale "pending" pubsub notifications from SendMessage can arrive at the worker control subscriber after close(controlArmed), causing a spurious ErrInterrupted that aborts the LLM call before the assistant message is committed. Remove ChatStatusPending from the cancel-trigger set in shouldCancelChatFromControlNotification. A "pending" notification reaching an active worker is always a stale echo: SendMessage (trigger), EditMessage (handled by persistStep ownership guard), or auto-promote (runs after processing). None warrant canceling the active run. Unskip TestSubscribeRelayEstablishedMidStream (CODAGT-353). The only stale notification that could cancel this test was "pending" from SendMessage, which the fix now ignores. Verified with a deterministic red/green/revert cycle using delayedPendingPubsub: 5/5 FAIL without fix (chat interrupted / Condition never satisfied), 5/5 PASS with fix, 5/5 FAIL on revert. Fixes CODAGT-383. Refs CODAGT-179, CODAGT-353.