Skip to content

[DevTools] Add a "Reconnect" button that re-attaches to a live VM Service after disconnection #9926

Description

@khusantoy

Use case

When a debug session's DevTools/Inspector connection drops — for example after the machine or simulator goes to sleep, a flaky network hiccup, or the DevTools tab being closed — the Inspector shows "Disconnected — Run a new debug session to reconnect." The only offered path is a full new debug session, even in cases where the underlying Dart VM Service is still alive and reachable.
Restarting the whole session is disruptive: it loses widget rebuild/inspector state, forces a fresh flutter run, and wastes time when the only thing that actually broke was the DevTools ↔ VM Service WebSocket, not the VM itself.

Proposal

Add a "Reconnect" action to the Inspector (and DevTools generally) that attempts to re-attach to the last-known VM Service URI before falling back to "run a new session."
Behavior:

On disconnect, retain the last VM Service URI (ws://127.0.0.1:PORT/TOKEN=/ws).
The "Reconnect" button calls vmServiceConnectUri(uri) with a short timeout and a getVM() liveness check.
If the connection succeeds → restore the Inspector session in place, no new flutter run needed.
If it fails (VM/token dead) → keep the current fallback message ("Run a new debug session to reconnect").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions