microsoft / microsoft/vscode

Automations: run stays in 'running' state when runner is interrupted by app shutdown

Open
#330,305 0 comments 0 reactions 1 assignee Claimed by @benvillalobos View on GitHub
automations
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

🤖 AI Assisted Bug Report

When an automation run is interrupted by app shutdown (or the runner is disposed mid-execution), the run status remains stuck at 'running' indefinitely. The view faithfully renders a spinner because the run never transitions to a terminal state.

**Steps to reproduce:**
1. Start an automation that triggers a session requiring user input (NeedsInput state)
2. Answer the input prompt so the session continues
3. If the app shuts down or the runner is interrupted before the session reaches Completed/Error, the run stays 'running' forever

**Expected:** The run transitions to 'failed' with an appropriate error message (e.g. 'interrupted by app shutdown').

**Actual:** The run stays in 'running' state. The view shows a blue spinner indefinitely. An error toast says 'interrupted by app shutdown' but the run status in the automation service is never updated.

**Root cause:** In automationRunner.ts, the runner awaits \waitForState(session.mainChat.status, ...)\ for a terminal status. If the runner is disposed or the cancellation token fires at a point where \_markCancelled\ is not reached (e.g. between the await and the catch), the run is never finalized.

**Possible fix:** Add a \ inally\ block or a dispose handler in the runner that ensures any active run is marked as failed if the runner is torn down without completing normally.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.