Skip to content

Commit 41b9a74

Browse files
committed
fix(nodes): scope computer.act lifecycle catch-up release to the arming action
1 parent fa9ce5a commit 41b9a74

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎apps/macos/Sources/OpenClaw/ComputerActionService.swift‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,18 @@ final class ComputerActionService {
111111
let releaseGenerationAtStart = self.releaseGeneration
112112
let display = try await self.resolveDisplay(screenIndex: params.screenIndex)
113113
try await self.dispatch(params, display: display)
114-
// No suspension between dispatch arming the button and this check, so the
115-
// read of leftButtonDown/releaseGeneration is atomic on the actor.
116-
if self.leftButtonDown, self.releaseGeneration != releaseGenerationAtStart {
114+
// Catch-up release scoped to the left_mouse_down that armed the button:
115+
// that branch is synchronous with no await before the check, so
116+
// leftButtonDown here reflects THIS action's own arm, not a concurrent
117+
// invoke's. Restricting to leftMouseDown keeps a stale non-arming invoke
118+
// (scroll/type/move) that predates a lifecycle release from releasing a
119+
// button a newer action legitimately holds. If the generation moved while
120+
// this action was suspended, a lifecycle release ran before it armed, so
121+
// the release must win and the just-armed button is released.
122+
if params.action == .leftMouseDown,
123+
self.leftButtonDown,
124+
self.releaseGeneration != releaseGenerationAtStart
125+
{
117126
self.releaseHeldInput()
118127
}
119128
let cursor = self.automation.currentMouseLocation() ?? CGPoint.zero

0 commit comments

Comments
 (0)