Skip to content

Fixes an IntelliJ UI freeze when switching between external ACP agent…#1213

Merged
carlrobertoh merged 1 commit intocarlrobertoh:masterfrom
Ju8z:master
Apr 20, 2026
Merged

Fixes an IntelliJ UI freeze when switching between external ACP agent…#1213
carlrobertoh merged 1 commit intocarlrobertoh:masterfrom
Ju8z:master

Conversation

@Ju8z
Copy link
Copy Markdown
Contributor

@Ju8z Ju8z commented Apr 20, 2026

…s such as OpenCode and Codex in the ProxyAI agent runtime selector.

Problem:
closeSession() was called synchronously from the runtime selector action path. Closing an active ACP session can block while closing stdio transport streams. In practice this can park the Swing UI thread in AcpProtocolCore.close() / StdioTransport.close(), leaving IntelliJ black-screened until the child ACP
process is killed externally.

A freeze report captured the EDT stuck under:

  • AgentModelComboBoxAction.actionPerformed
  • ExternalAcpAgentService.closeSession
  • AcpProcessState.close
  • AcpProtocolCore.close
  • StdioTransport.close
  • FileDescriptor.close0

Changes:

  • Close removed ACP process states asynchronously on the service IO scope.
  • Remove the session setup mutex immediately after removing the state.
  • Stop the child ACP process before closing the protocol.
  • Force-kill the child process if it does not exit shortly after destroy().
  • Log cleanup failures instead of propagating them back through the UI action path.

Test-Locally

  • Reproduced locally with OpenCode -> Codex switching causing IntelliJ to freeze.
  • Verified the same close-order patch locally stopped the freeze by letting the ACP process terminate before protocol cleanup.

…s such as OpenCode and Codex in the ProxyAI agent runtime selector.

Problem:
  `closeSession()` was called synchronously from the runtime selector action path. Closing an active ACP session can block while closing stdio transport streams. In practice this can park the Swing UI thread in `AcpProtocolCore.close()` / `StdioTransport.close()`, leaving IntelliJ black-screened until the child ACP
  process is killed externally.

  A freeze report captured the EDT stuck under:
  - `AgentModelComboBoxAction.actionPerformed`
  - `ExternalAcpAgentService.closeSession`
  - `AcpProcessState.close`
  - `AcpProtocolCore.close`
  - `StdioTransport.close`
  - `FileDescriptor.close0`

 Changes:
  - Close removed ACP process states asynchronously on the service IO scope.
  - Remove the session setup mutex immediately after removing the state.
  - Stop the child ACP process before closing the protocol.
  - Force-kill the child process if it does not exit shortly after `destroy()`.
  - Log cleanup failures instead of propagating them back through the UI action path.

  Test-Locally
  - Reproduced locally with OpenCode -> Codex switching causing IntelliJ to freeze.
  - Verified the same close-order patch locally stopped the freeze by letting the ACP process terminate before protocol cleanup.
@carlrobertoh carlrobertoh merged commit 38ed8c9 into carlrobertoh:master Apr 20, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants