# ai: Preserve \`draft_prompt\` when creating a new agent threads \(\#53250\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b473ead8a3e10f52bd6fb3d3ee4a1fb6691e4907

Requested commit: b473ead8a3e10f52bd6fb3d3ee4a1fb6691e4907

Commit: b473ead8a3e10f52bd6fb3d3ee4a1fb6691e4907

Tree: c461e7e29eae5c6dd1aeb4ba18e51a88d672908f

Author: Amaan

Committer: GitHub

## Message

```
ai: Preserve `draft_prompt` when creating a new agent threads (#53250)

- added a shared helper `take_active_draft_initial_content` to resolve
initial content
- `draft_prompt` is copied over to a new thread and is persisted in old
thread with this behavior


Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] no Unsafe blocks 
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes #38028 

Release Notes:

- persist draft messages in ai thread when a new thread is created so we
dont use any messages or draft prompts mistakenly

Question: 
need some guidance on how to persist a thread when the `draft_prompt` is
present but the message is unsent because currently having a draft
prompt in the agent input box and thenmaking a new agent thread copies
the prompt over to the new thread(changes from this pr) but on going
back to the old thread new thread is destroyed
```

## Parents

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

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