# agent_ui: Use root thread helpers consistently \(\#54070\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4c611e297eb2430f3b49efbd5bf816bfa29c601d

Requested commit: 4c611e297eb2430f3b49efbd5bf816bfa29c601d

Commit: 4c611e297eb2430f3b49efbd5bf816bfa29c601d

Tree: 9f81e00ec32ddba96d5e32bb2c09f735cbf2897d

Author: Ben Brandt

Committer: GitHub

## Message

```
agent_ui: Use root thread helpers consistently (#54070)

Replace call sites that treated the active thread as the root thread
with the dedicated `root_thread_view` and `root_thread` helpers, and
simplify `ConversationView` lookups to avoid passing `cx` when it is
not needed.

Also emit token limit telemetry when usage crosses warning or exceeded
thresholds, while avoiding duplicate events for the same session state.

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

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
```

## Parents

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

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