From 93edb1b74d2e76b6b3312dfe501f8352d1f216e8 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 20 Aug 2026 09:17:21 -0400 Subject: [PATCH] fix(WRK-33): observe the discarded command-task wrapper's fault TryStartCommandTask discarded ObserveCommandTaskAsync's task without a fault-observing continuation -- the one gap in the NEXT-04 discipline applied everywhere else in this file. ObserveCommandTaskAsync only swallows OperationCanceledException, so any other exception escaping ProcessCommandAsync's own catch path would fault the discarded wrapper and surface only as a finalizer-time unobserved-task exception. Wrap it with the existing ObserveFaultWhenever helper, same as every other discarded task in this file. --- src/ZB.MOM.WW.MxGateway.Worker/Ipc/WorkerPipeSession.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ZB.MOM.WW.MxGateway.Worker/Ipc/WorkerPipeSession.cs b/src/ZB.MOM.WW.MxGateway.Worker/Ipc/WorkerPipeSession.cs index a92fa0b..d61287c 100644 --- a/src/ZB.MOM.WW.MxGateway.Worker/Ipc/WorkerPipeSession.cs +++ b/src/ZB.MOM.WW.MxGateway.Worker/Ipc/WorkerPipeSession.cs @@ -1232,7 +1232,14 @@ public sealed class WorkerPipeSession _activeCommandTasks.Add(commandTask); } - _ = ObserveCommandTaskAsync(commandTask); + // WRK-33: every other discarded task in this file is wrapped with ObserveFaultWhenever + // (NEXT-04 discipline) so a fault reaching the finalizer unobserved is impossible. This + // wrapper task was the one exception — ObserveCommandTaskAsync only swallows + // OperationCanceledException, so any other exception escaping ProcessCommandAsync's own + // catch path (e.g. a future edit, or a failure past TryWriteFaultAsync's narrow filter) + // would fault the discarded task with no observer. Close the gap the same way the rest of + // the file does. + ObserveFaultWhenever(ObserveCommandTaskAsync(commandTask)); } private async Task ObserveCommandTaskAsync(Task commandTask)