From 5f6dfcd2bf440e78bdee42abc09d78dcfa36da67 Mon Sep 17 00:00:00 2001 From: Vellum Assistant Date: Wed, 25 Feb 2026 01:30:20 -0500 Subject: [PATCH] fix: gate stale-start recorder cancel to avoid cross-session teardown Co-Authored-By: Claude --- .../vellum-assistant/ComputerUse/RecordingManager.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clients/macos/vellum-assistant/ComputerUse/RecordingManager.swift b/clients/macos/vellum-assistant/ComputerUse/RecordingManager.swift index 5db3977e1e1..816b316b61a 100644 --- a/clients/macos/vellum-assistant/ComputerUse/RecordingManager.swift +++ b/clients/macos/vellum-assistant/ComputerUse/RecordingManager.swift @@ -84,8 +84,13 @@ final class RecordingManager: ObservableObject { // Guard against stale completion: if stop() or forceStop() was called // while we were awaiting recorder.start(), don't override the state. guard state == .starting, ownerSessionId == sessionId else { - log.info("Recording start completed but state changed during await — cancelling stale recorder (state=\(String(describing: self.state)))") - recorder.cancelRecording() + log.info("Recording start completed but state changed during await — checking ownership before cancelling (state=\(String(describing: self.state)), owner=\(self.ownerSessionId ?? "nil"))") + // Only cancel if no other session has taken ownership of the recorder. + // If ownerSessionId points to a different session and the state is active, + // that session now owns the recorder — cancelling would tear down its recording. + if ownerSessionId == nil || !state.isActive { + recorder.cancelRecording() + } return false }