# agent: Address review follow-ups for quit-time thread flush \(\#59079\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8ad9d18b9308e29b7e49ef572a62d880535b42df

Requested commit: 8ad9d18b9308e29b7e49ef572a62d880535b42df

Commit: 8ad9d18b9308e29b7e49ef572a62d880535b42df

Tree: 106f29fa8b91b39a3fc20450cd1c421de3b94b3e

Author: Richard Feldman

Committer: GitHub

## Message

```
agent: Address review follow-ups for quit-time thread flush (#59079)

Follow-up to #58962 addressing review feedback on the quit-time thread
flush.

The flush now builds its save payloads through the same helper as
`save_thread`, so the two write paths can't drift — in particular, the
flush now captures the current draft prompt the same way ordinary saves
do, instead of writing whatever stale draft was last serialized. It also
logs database connection errors instead of silently discarding them, and
runs the per-thread saves concurrently, since all quit observers share
gpui's 200ms `SHUTDOWN_TIMEOUT` and serial saves risked a partial flush.

The regression test now quits through the real `App::shutdown` path, so
the `on_app_quit` registration itself is exercised rather than just the
flush method, and it additionally covers draft-prompt capture and the
empty-thread skip.

Release Notes:

- N/A
```

## Parents

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

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