fix: prevent notifications leaking into other terminals#23
Open
kitlangton wants to merge 2 commits into
Open
Conversation
|
Hi @kitlangton Also, just a friendly suggestion, if possible, please mention the version and basic details on the descriptions, such as: |
harryalbert
requested changes
Jun 5, 2026
Contributor
harryalbert
left a comment
There was a problem hiding this comment.
Thanks for submitting this @kitlangton! Overall seems reasonable.
Could you bump the version (see this PR for an example of where to bump)? I want to make this process more automated, but in the meantime we have to version bump manually so that we can actually release a new version once this is merged
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.
What happened
I launched Zed from a Warp shell, then ran OpenCode in Zed's integrated terminal.
Zed correctly identified itself with
TERM_PROGRAM=zed, but it also inheritedWARP_CLI_AGENT_PROTOCOL_VERSION=1from Warp. The plugin checked only the inherited Warp variable, assumed the current terminal was Warp, and wrote a Warp-specific OSC 777 notification directly to/dev/tty.Because the current terminal was actually Zed, the notification payload appeared as raw text over the OpenCode TUI. The output was especially large because the notification was for a patch permission and contained the escaped diff.
flowchart LR A[Warp launches Zed] --> B[Zed inherits Warp protocol variable] B --> C[OpenCode loads Warp plugin] C --> D[Plugin writes OSC 777 to /dev/tty] D --> E[Zed renders payload over OpenCode TUI]How this fixes it
Before writing an OSC 777 notification, the plugin now checks whether the current terminal explicitly identifies itself as something other than Warp. If it does, the notification is skipped.
flowchart LR A[Notification ready] --> B{TERM_PROGRAM} B -->|WarpTerminal or unset| C[Send OSC 777] B -->|Another terminal, such as Zed| D[Skip notification]The check stays at the
/dev/ttyoutput boundary, so no other plugin behavior changes. LeavingTERM_PROGRAMunset remains supported for Warp-managed SSH sessions.Verification
bun run testbun run typecheckbun run buildRegression coverage includes Zed with inherited Warp variables, a normal Warp terminal, and an SSH-style environment with no
TERM_PROGRAM.