# agent: Fix summarization model being cleared by unrelated registry events \(\#52080\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 0f1e8a6e3dd6f8922d5c9d4d0cd9cb9bd1969cfb

Requested commit: 0f1e8a6e3dd6f8922d5c9d4d0cd9cb9bd1969cfb

Commit: 0f1e8a6e3dd6f8922d5c9d4d0cd9cb9bd1969cfb

Tree: 55711c2ebfac115e1db682379f1d37bf1e178ba5

Author: Ben Brandt

Committer: GitHub

## Message

```
agent: Fix summarization model being cleared by unrelated registry events (#52080)

## Context

We were seeing lots of pending title generation, which should only
happen if we don't have a summarization model.

`handle_models_updated_event` unconditionally overwrote the thread's
summarization model on every registry event, even with `None`. 

We should only setting if explicitly changed by the user or we haven't
set it yet, and only if we actually have one.

It is hard to reproduce this issue.. but I don't think this code was
right in the first place anyway.


## Self-Review Checklist

- [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
```

## Parents

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

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