Background acp connection discussion

Open
#10,935 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@mscolnick is already working on this.

Since Sep 21, 2026.

Assessment

This issue has not been assessed yet.

Description

Would you be open to separating acp connection lifetime from the agent panel visibility? I’d like to agree on it before preparing a PR.

Use case

We already have marimo pair, but acp is a bit broader and allows more use cases.

More generally, hiding the agent panel should not have to cause abandoning any acp in-flight request.
This concerns the existing in-editor acp experience only.

Current implementation

  • Both panel areas wrap their content in LazyActivity, switching it to hidden when the panel is closed or another panel is selected.
  • LazyActivity uses React Activity, whose hidden mode cleans up effects.
  • The installed [email protected] hook calls disconnect() in its effect cleanup, including when autoConnect is false. Managing connections manually in AgentPanel therefore does not prevent this nested cleanup.

So hiding the panel disconnects the client even though the notebook remains open. Whether the adapter also stops its work depends on the adapter.

Proposed boundary

For an active acp connection:

  • Closing the panel or switching to Variables/Files should not disconnect it. An in-flight response could continue updating its session state.
  • Reopening would show that same session without reconnecting or replaying the prompt.
  • Explicit Disconnect and actual notebook teardown would still release the client connection. Stop would retain its existing cancellation behavior.
  • Unopened agents would remain lazy; unrelated panels would keep their current Activity behavior.

I would avoid changing every panel to stay mounted. A possible implementation is a single acp connection owner outside the visibility-controlled subtree.

Permission requests must remain explicit: either pending permission should reopen the panel or show an indicator.

I can follow up with a controlled-transport browser reproduction and tests covering hide/show during streaming, cancellation, pending permissions, explicit disconnect, notebook teardown, and moving the AI panel between sidebar and developer areas without creating duplicate connection owners.

Related

  • open ACP proxy work in #10693
Dominant language
Python
Stars
22.9k
Forks
1.3k
Avg merge
1d 10h
Merged PRs (30d)
380

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from marimo-team/marimo

All issues in marimo-team/marimo

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.