# Persist terminal tempdirs by thread \(\#57878\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b141288fb046fe2fd24901792bdfa3feb055731c

Requested commit: b141288fb046fe2fd24901792bdfa3feb055731c

Commit: b141288fb046fe2fd24901792bdfa3feb055731c

Tree: 1ca3cf3dd41a581aa59f0f9e6def5ccbc7dcb673

Author: Richard Feldman

Committer: GitHub

## Message

```
Persist terminal tempdirs by thread (#57878)

Summary:
- Store a lazily-created sandboxed terminal temp directory on each agent
thread.
- Persist the tempdir path and remove it when deleting archived threads.
- Update sandbox prompt wording to describe per-thread tempdir reuse.

Tests:
- cargo fmt --package agent --package agent_ui --package zed
- cargo test -p agent db::tests::test_sandboxed_terminal_temp_dir --
--nocapture
- cargo test -p agent
db::tests::test_delete_thread_removes_sandboxed_terminal_temp_dir --
--nocapture
- cargo check -p agent_ui -p zed

Release Notes:

- Improved agent terminal sandboxing to preserve temporary files across
commands in the same thread

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
Co-authored-by: Martin Ye <martin@zed.dev>
```

## Parents

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

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