# debugger: Fix restart only working once per session \(\#51247\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/314b7e55fb3fb2d8277a38217a64d335668ef473)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 314b7e55fb3fb2d8277a38217a64d335668ef473

Requested commit: 314b7e55fb3fb2d8277a38217a64d335668ef473

Commit: 314b7e55fb3fb2d8277a38217a64d335668ef473

Tree: b24e3d07a62ce8bab2d5a184d36d9f1fdca387fa

Author: Nelson Campos

Committer: GitHub

## Message

```
debugger: Fix restart only working once per session (#51247)

`Session::restart_task` is set to `Some` when a restart is initiated but
never cleared back to `None`. The guard at the top of `restart()` checks
`self.restart_task.is_some()` and returns early, so only the first
restart attempt succeeds.

This primarily affects debug adapters that advertise
`supportsRestartRequest` dynamically via a `CapabilitiesEvent` after
launch, such as the Flutter debug adapter.

Related: https://github.com/zed-extensions/dart/issues/45

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
(N/A — no UI changes)

Release Notes:

- debugger: Fixed debug session restart only working once when the
adapter supports DAP restart requests.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
```

## Parents

- [e0881e38f91b87623795208615ca466415d1970e](https://git.cafe/gitcafe/zed/commit/e0881e38f91b87623795208615ca466415d1970e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/314b7e55fb3fb2d8277a38217a64d335668ef473?format=markdown)
