Skip to content

Commit 81a99ce

Browse files
shanselmanCopilot
andcommitted
Fix canvas navigate dispatcher timeout
Route canvas.navigate through the same dispatcher timeout guard used by canvas.eval and canvas.snapshot so stalled UI dispatch cannot hang MCP tool calls indefinitely. Co-authored-by: Copilot <[email protected]>
1 parent 3f1ecab commit 81a99ce

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/OpenClaw.Tray.WinUI/Services/NodeService.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,8 +1154,10 @@ private async Task<string> OnCanvasNavigate(string url)
11541154
}
11551155

11561156
var tcs = new TaskCompletionSource<string>(TaskCreationOptions.RunContinuationsAsynchronously);
1157+
var cts = new CancellationTokenSource();
11571158
if (!_dispatcherQueue.TryEnqueue(() =>
11581159
{
1160+
if (cts.IsCancellationRequested) return;
11591161
try
11601162
{
11611163
CloseA2UICanvasWindow();
@@ -1177,7 +1179,7 @@ private async Task<string> OnCanvasNavigate(string url)
11771179
tcs.TrySetException(new InvalidOperationException("Failed to dispatch canvas.navigate to UI thread"));
11781180
}
11791181

1180-
return await tcs.Task.ConfigureAwait(false);
1182+
return await WaitWithTimeout(tcs.Task, cts, "canvas.navigate");
11811183
}
11821184

11831185
/// <summary>

0 commit comments

Comments
 (0)