Skip to content

Let Amalthea know when Ark drops a comm #1116

@lionel-

Description

@lionel-

Currently when the frontend refreshes, the UI tear down happens so fast that the frontend doesn't get a chance to send comm close messages for comms that are destructed. Then the new frontend instance opens new comms (except for help and plots).

In the case of the UI comm, we replace the existing comm on the Ark side and drop it, but we don't tell anyone about it. The primary symptom of that is that Amalthea keeps bumping the comm count on refresh (see log messages in posit-dev/positron#1126).

One way to fix this is for the frontend to reuse existing comms, like we do for help and plots (see posit-dev/positron#1126 (comment)).

But we should have a reasonable closing procedure in any case. Two ways to go about it:

  1. Tell Amalthea the comm is closed via an event (there's one for this already). This doesn't propagate to the frontend.
  2. Send a proper comm_close that propagates all the way to the frontend.

(2) feels a little better to me architecturally, even though the frontend will not be able to match the comm close id to a known comm. After all it's the frontend's fault for not sending comm_close messages, and we should still properly close the comm from the backend since it was not closed from the frontend. Presumably the frontend will silently drop that notification with a log message, without showing a user visible toast (to verify).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions