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
8ad9d18b93Richard Feldman committed on 6/16/2026, 2:30:18 PM· committed by GitHubparent2408640
1 file changedLine totals unavailable