# agent_ui: Show base name for duplicate file mentions in the Agent Panel \(\#59845\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 6e085b2fdc0ac54b006ce300aef1a6fb3cfb2692

Requested commit: 6e085b2fdc0ac54b006ce300aef1a6fb3cfb2692

Commit: 6e085b2fdc0ac54b006ce300aef1a6fb3cfb2692

Tree: 0ab3f75eb55766867084401967d872b3d5e4b9f5

Author: Yash Patodkar

Committer: GitHub

## Message

```
agent_ui: Show base name for duplicate file mentions in the Agent Panel (#59845)

# Objective

- Fixes #59654

When the same file was added as a mention more than once in the Agent
Panel,
the label would expand to the full absolute path instead of staying at
the
base filename.

Before

<img width="734" height="438" alt="Screenshot 2026-06-24 at 11 19 30 AM"
src="https://github.com/user-attachments/assets/94450eef-088a-49aa-97d3-80d6dd06925b"
/>

## Solution

The algorithm in `compute_disambiguation_details` treats two
entries with the same URI as a "collision" and tries to resolve it by
adding
more parent path components. Since the paths are identical it can never
succeed and keeps escalating to the full path.

Fix by deduplicating URIs via a `HashSet` before passing them to
`compute_disambiguation_details`, so identical mentions share a single
entry
and are never flagged as collisions.

## Testing

Reproduced by opening the Agent Panel, adding the same file as a mention
twice, and observing the label. Before: label showed the full absolute
path.
After: label stays at the base filename.

Tested on macOS.

After

<img width="638" height="215" alt="Screenshot 2026-06-24 at 11 20 09 AM"
src="https://github.com/user-attachments/assets/5acac2bd-d5a3-41c4-827c-84ccdc3a064d"
/>


## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability

---

Release Notes:

- Fixed duplicate file mentions in the Agent Panel showing the full
absolute
  path instead of the base filename.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
```

## Parents

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

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