Let Amalthea know when Ark drops a comm
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 337
- Forks
- 32
- Avg merge
- 8d 17h
- Merged PRs (30d)
- 11
Description
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 https://github.com/posit-dev/positron/issues/1126).
One way to fix this is for the frontend to reuse existing comms, like we do for help and plots (see https://github.com/posit-dev/positron/issues/1126#issuecomment-2976857541).
But we should have a reasonable closing procedure in any case. Two ways to go about it:
- Tell Amalthea the comm is closed via an event (there's one for this already). This doesn't propagate to the frontend.
- Send a proper
comm_closethat 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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Ark-side UI comm replacement and drop path, then read the existing comm-closed event and comm_close handling. Use issue #1126 and its linked comment for the refresh behavior and expected frontend impact; done means a dropped comm no longer leaves Amalthea's comm count increasing after refresh.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100