# agent: Inline worktree info fetching to remove expects in agent_panel \(\#54006\) · gitcafe/zed

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

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

Visibility: public

Requested revision: bf25cb1835ae03c26c778646e01bc634ae690a59

Requested commit: bf25cb1835ae03c26c778646e01bc634ae690a59

Commit: bf25cb1835ae03c26c778646e01bc634ae690a59

Tree: 5769698dd1f408353b04ebf5833da8c30b14a9b0

Author: Anthony Eid

Committer: GitHub

## Message

```
agent: Inline worktree info fetching to remove expects in agent_panel (#54006)

The `worktree_receivers` and `worktree_directory_setting` were pre
computed as `Option`s before the async block, then unwrapped with
`expect` inside the match arm that always had them set. Move the
fetching directly into the `WorktreeCreationArgs::New` arm so the values
are never optional, replacing the panicking expects with error
propagation via `?`.

The expects were guaranteed to never panic because the `Some` codepath
used the same branching logic of the unwrap codepath later on. This
change is just for future maintainability though.

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 or Added/Fixed/Improved ...
```

## Parents

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

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