Conversation
📏 PR Size: 523 lines changed (size/L)Please note: this PR exceeds the 400 LOC soft limit.
|
133d591 to
76d431d
Compare
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 20, 2026
## Context Fixes ZED-59M We could end panicking because of a double lease in message editor. This could happen when pasting text and this line was executed: `PromptCompletion::try_parse(line, offset_to_line, &self.source.supported_modes(cx))` Since self.source is the Entity<MessageEditor> in this case, we will try to read message editor while it's being updated. I took this as an opportunity to refactor `prompt_capabilities` and `available_commands` which were both passed around as Rc<RefCell<...>>. Now we have a single struct called `SessionCapabilities` which maintains both and we pass that around wrapped in an `Arc<RwLock<...>>` (`SharedSessionCapabilities`) ## Self-Review Checklist <!-- Check before requesting review: --> - [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: - Fixed a crash when pasting text into the prompt editor in the agent panel
toshmukhamedov
pushed a commit
to toshmukhamedov/zed
that referenced
this pull request
Mar 20, 2026
## Context Fixes ZED-59M We could end panicking because of a double lease in message editor. This could happen when pasting text and this line was executed: `PromptCompletion::try_parse(line, offset_to_line, &self.source.supported_modes(cx))` Since self.source is the Entity<MessageEditor> in this case, we will try to read message editor while it's being updated. I took this as an opportunity to refactor `prompt_capabilities` and `available_commands` which were both passed around as Rc<RefCell<...>>. Now we have a single struct called `SessionCapabilities` which maintains both and we pass that around wrapped in an `Arc<RwLock<...>>` (`SharedSessionCapabilities`) ## Self-Review Checklist <!-- Check before requesting review: --> - [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: - Fixed a crash when pasting text into the prompt editor in the agent panel
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 23, 2026
## Context Fixes ZED-59M We could end panicking because of a double lease in message editor. This could happen when pasting text and this line was executed: `PromptCompletion::try_parse(line, offset_to_line, &self.source.supported_modes(cx))` Since self.source is the Entity<MessageEditor> in this case, we will try to read message editor while it's being updated. I took this as an opportunity to refactor `prompt_capabilities` and `available_commands` which were both passed around as Rc<RefCell<...>>. Now we have a single struct called `SessionCapabilities` which maintains both and we pass that around wrapped in an `Arc<RwLock<...>>` (`SharedSessionCapabilities`) ## Self-Review Checklist <!-- Check before requesting review: --> - [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: - Fixed a crash when pasting text into the prompt editor in the agent panel
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.
Context
Fixes ZED-59M
We could end panicking because of a double lease in message editor. This could happen when pasting text and this line was executed:
PromptCompletion::try_parse(line, offset_to_line, &self.source.supported_modes(cx))Since self.source is the Entity in this case, we will try to read message editor while it's being updated.
I took this as an opportunity to refactor
prompt_capabilitiesandavailable_commandswhich were both passed around as Rc<RefCell<...>>. Now we have a single struct calledSessionCapabilitieswhich maintains both and we pass that around wrapped in anArc<RwLock<...>>(SharedSessionCapabilities)Self-Review Checklist
Release Notes: