agent: Reduce DB load in ThreadMetadataStore (#52313)

## Context

We now batch multiple db operations together if they happen very
frequently (similar to how we handle it in `thread_history.rs`)

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Gaauwe Rombouts <mail@grombouts.nl>
a667d9c718Bennet Bo Fenner committed on 3/25/2026, 8:09:22 AM· committed by GitHubparentd09cc53
4 files changedLine totals unavailable