Persist unsent draft prompt across Zed restarts#49541
Merged
Conversation
Contributor
Contributor
Author
|
We also need to make sure the rich text bits like |
Store the user's unsent message editor text in DbThread so it survives quitting and reloading Zed. The draft flows through Thread → AcpThread → AcpThreadView on load, and back via a debounced observer on the message editor for saves. Currently works for native Zed agents only; external ACP agents will pick this up once general ACP history persistence lands. Co-authored-by: Anthony Eid <anthony@zed.dev>
6bb860c to
54998b7
Compare
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
tahayvr
pushed a commit
to tahayvr/zed
that referenced
this pull request
Mar 4, 2026
Store the user's unsent message editor text in DbThread so it survives quitting and reloading Zed. The draft flows through Thread → AcpThread → AcpThreadView on load, and back via a debounced observer on the message editor for saves. Currently works for native Zed agents only; external ACP agents will pick this up once general ACP history persistence lands. ## Changes - **`DbThread`** / **`Thread`**: New `draft_prompt: Option<String>` field, included in `to_db()`/`from_db()` - **`AcpThread`**: Bridge field with getter/setter, populated during `register_session()` - **`NativeAgent::save_thread()`**: Copies draft from `AcpThread` → `Thread` before persisting - **`AcpThreadView`**: Restores draft into `MessageEditor` on load; syncs editor text → `AcpThread` via observer; debounced (500ms) Thread notify triggers DB save Co-authored-by: Anthony Eid <anthony@zed.dev> Co-authored-by: Mikayla Maki <mikayla@zed.dev>
wzulfikar
pushed a commit
to wzulfikar/zed
that referenced
this pull request
Mar 4, 2026
Store the user's unsent message editor text in DbThread so it survives quitting and reloading Zed. The draft flows through Thread → AcpThread → AcpThreadView on load, and back via a debounced observer on the message editor for saves. Currently works for native Zed agents only; external ACP agents will pick this up once general ACP history persistence lands. ## Changes - **`DbThread`** / **`Thread`**: New `draft_prompt: Option<String>` field, included in `to_db()`/`from_db()` - **`AcpThread`**: Bridge field with getter/setter, populated during `register_session()` - **`NativeAgent::save_thread()`**: Copies draft from `AcpThread` → `Thread` before persisting - **`AcpThreadView`**: Restores draft into `MessageEditor` on load; syncs editor text → `AcpThread` via observer; debounced (500ms) Thread notify triggers DB save Co-authored-by: Anthony Eid <anthony@zed.dev> Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Store the user's unsent message editor text in DbThread so it survives quitting and reloading Zed. The draft flows through Thread → AcpThread → AcpThreadView on load, and back via a debounced observer on the message editor for saves.
Currently works for native Zed agents only; external ACP agents will pick this up once general ACP history persistence lands.
Changes
DbThread/Thread: Newdraft_prompt: Option<String>field, included into_db()/from_db()AcpThread: Bridge field with getter/setter, populated duringregister_session()NativeAgent::save_thread(): Copies draft fromAcpThread→Threadbefore persistingAcpThreadView: Restores draft intoMessageEditoron load; syncs editor text →AcpThreadvia observer; debounced (500ms) Thread notify triggers DB saveRelease notes: