0019: frontend: Clean up desktop IPC listeners - #7277
Conversation
Use the exact cleanup callback returned by the preload bridge so wrapped plugin response listeners are always released. Co-authored-by: René Dudfield <renedudfield@microsoft.com>
Cover command validation, IPC payloads, and routing before listener changes.
Cover listener outcomes and public requests before changing cleanup.
Exercise the real preload boundary so desktop cleanup stays covered.
Release renderer IPC subscriptions when their command exits so completed commands do not accumulate listeners. Co-authored-by: René Dudfield <renedudfield@microsoft.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: illume The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Prevents desktop IPC listener leaks after commands and plugin operations complete.
Changes:
- Unsubscribes
runCommandlisteners on matching command exit. - Uses preload-provided cleanup callbacks in
PluginManager. - Adds unit and Electron E2E coverage.
CI build, lint, docs, Storybook, and pluginctl checks passed; remaining checks are still running and the PR is draft.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
frontend/src/components/App/runCommand.ts |
Cleans up command listeners. |
frontend/src/components/App/runCommand.test.ts |
Tests event routing and cleanup. |
frontend/src/components/App/pluginManager.ts |
Uses exact unsubscribe callbacks. |
frontend/src/components/App/pluginManager.test.ts |
Tests response and cleanup paths. |
app/e2e-tests/tests/listenerCleanup.spec.ts |
Verifies preload unsubscribe behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
runCommandIPC subscriptions when the matching command exitsPluginManagercompletion pathsSource
This upstreams patch 0019 from Azure/aks-desktop#823:
Azure/aks-desktop#823
The original downstream change was Azure/aks-desktop#394:
Azure/aks-desktop#394
Original combined commit:
e4798768d9995204e2ad32da138b11f094640828PR 823 split that change into these reviewable patch commits:
48e4e03806152cf2aa527147e9a4105150b6b082forrunCommandeeba14bd5891ad62b791d001883ce66810d527d3forPluginManagerThe functional commits retain Tejhan Diallo as author and preserve the original
March 12, 2026 author and commit date. René Dudfield is included as co-author.
Improvements over the existing change
runCommandandPluginManagercommitsTesting
npx vitest run src/components/App/runCommand.test.ts src/components/App/pluginManager.test.ts --coverage.enabled --coverage.provider=istanbul --coverage.reporter=text --coverage.include=src/components/App/runCommand.ts --coverage.include=src/components/App/pluginManager.tsrunCommand.tspluginManager.tsnpm run tscPLAYWRIGHT_TEST_MODE=app playwright test tests/listenerCleanup.spec.tsScreenshots
Not applicable. This change only affects IPC listener lifecycle and has no visual
change.
Assisted by copilot.