-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore "responses" that don't have 'result' or 'error' keys (#4712)
Speculative change to address #4663. As noted in that issue, this is mostly a workaround for an issue that exists in the Python kernel wherein comm messages emitted always have the parent ID of the most recent message to the shell (even if they are not a reply to that message). This can cause problems in Positron since it assumes that, after a message is sent, the next message with a matching `parent_id` is the reply to that message. The fix is to check a message for `result` or `error` keys before treating it as an RPC response. We can't do this for _all_ messages since many codepaths/comms do not use the JSON-RPC structure, but we do it for all formally defined Positron comms. This is admittedly a little janky. Some things that could make this better (but are higher risk than this change): - a more robust way of identifying Positron's JSON-RPC comm messages - having Positron supply its own ID with each request that must be returned in the reply body in order to deterministically pair requests and replies (i.e. don't rely on `parent_id` since it can be hard to control) - moving Positron comms off the shell socket (@lionel- has suggested e.g. moving them to the control socket to allow them to operate independently of the current shell command) ### QA Notes This change is small but it's a hot codepath -- almost every comm message goes through here. Sanity test the data explorer, and ipywidgets. They use this codepath but specifically do not want the new behavior added here.
- Loading branch information
Showing
3 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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