Skip to content

Warn before closing the window while any run is still active#1747

Open
iyernaveenr wants to merge 1 commit into
eigent-ai:mainfrom
iyernaveenr:naveen_r_iyer/fix-close-guard
Open

Warn before closing the window while any run is still active#1747
iyernaveenr wants to merge 1 commit into
eigent-ai:mainfrom
iyernaveenr:naveen_r_iyer/fix-close-guard

Conversation

@iyernaveenr

Copy link
Copy Markdown

Problem

Closing the window while agent runs are streaming kills them silently: the event streams are severed, the backend treats it as a client disconnect and aborts the in-flight work, cleaning up the task locks. The affected conversations are left permanently incomplete (dangling tool rows, progress stuck, no final answer, zero recorded tokens) with no warning at close time.

Root cause

A close warning exists, but it only checks the status of the active Project's current task. Runs streaming in other Projects -- exactly the situation when working with several Projects in parallel -- are invisible to it, so the window closes without the "a task is currently running" dialog.

Fix

Track whether any run in any Project still holds a live event stream (the set of active stream controllers is the ground truth for what a window close would sever), and show the existing close-notice dialog when either the active task is busy or any such run exists. Cancel keeps the app and the runs alive; confirming still quits, making an interrupted run an informed choice instead of a silent side effect.

Testing

Verified on Linux desktop: with a long-running task streaming in one Project and a different Project focused, closing the window now shows the running-task dialog (previously it closed silently and the backend logged a stream cancellation and aborted the run); Cancel left the runs untouched and they completed normally afterwards. With no runs active, the window closes immediately as before. tsc passes; lint and formatting are clean for the changed files.

Closing the window severs every run's event stream and the backend
aborts the in-flight work. The existing warning only checked the active
Project's current task, so runs streaming in other Projects were killed
silently. Consider every live run when deciding whether to show the
close warning, so quitting mid-run is always an informed choice.

Signed-off-by: Naveen R. Iyer <iyernaveenr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants