Skip to content

Support deployment-scoped connection management - #526

Merged
nlivie merged 5 commits into
mainfrom
gngangomtiem/deployment-connections
Nov 18, 2026
Merged

nlivie merged 5 commits into
mainfrom
gngangomtiem/deployment-connections

Conversation

@nlivie

@nlivie nlivie commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Manage agent connections across multiple deployments and environments. Switch between deployment and workspace connections without reattaching the agent or changing where sync operations(Pull, Push, and Preview) operate.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 10:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The deployment path can reject usable environments without trying the fallback lookup, and cancelling a slow connector lookup can leave the webview controls disabled.

2 open issues
What changed in this PR

Adds deployment-scoped connection management to the Copilot Studio VS Code extension, allowing users to configure connections across environments without changing the workspace’s Pull, Push, or Preview target.

Changes:

  • Discovers deployments from hosting configuration and adds a deployment selector with pending-edit protection.
  • Routes connection listing and binding updates to the selected environment, while keeping new reference declarations local.
  • Adds controller, webview, and backend tests, plus clearer HTTP error reporting.
File Description
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​utils/​httpRequestError.ts Separates user-facing HTTP messages from diagnostics.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​types.ts Updates connection request and response contracts.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​helpers/​dom.ts Adds lightweight DOM test helpers.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​helpers/​deploymentFixtures.ts Provides deployment configuration fixtures.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​helpers/​connectionManagerView.ts Adds a connection webview test harness.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​deploymentSelectorHtml.test.ts Tests standalone selector behavior.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​deploymentContext.test.ts Tests deployment matching and environment names.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​dataverseClient.test.ts Tests Dataverse error reporting.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​connectionManagerHtml.test.ts Tests selection, loading, keyboard controls, and pending edits.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​connectionManager.test.ts Tests target isolation, refresh, failures, and stale-write protection.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​bapClient.test.ts Tests environment service error messages.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​tests/​host/​agentHostingConfig.test.ts Tests hosting configuration discovery and parsing.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​deployments/​deploymentSelectorHtml.ts Adds reusable deployment selector markup and behavior.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​deployments/​deploymentContext.ts Matches deployments to workspaces and resolves display names.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​deployments/​agentHostingConfig.ts Discovers and validates hosting configuration.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​constants.ts Adds deployment-loading telemetry events.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​connections/​connectionManagerHtml.ts Integrates deployment selection and scoped connection controls.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​connections/​connectionManager.ts Coordinates target selection, loading, and guarded binding updates.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​connections/​connectionCatalog.ts Passes target schema names through connection requests.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​clients/​dataverseClient.ts Uses structured HTTP errors.
src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​clients/​bapClient.ts Adds environment name lookup and structured HTTP errors.
src/​LanguageServers/​PowerPlatformLS/​UnitTests/​PowerPlatformLS.UnitTests/​Impl.PullAgent/​Methods/​ReattachAgentHandlerTests.cs Updates test doubles for connection service changes.
src/​LanguageServers/​PowerPlatformLS/​UnitTests/​PowerPlatformLS.UnitTests/​Impl.PullAgent/​Methods/​CreateConnectionReferenceHandlerTests.cs Verifies local-only reference creation.
src/​LanguageServers/​PowerPlatformLS/​UnitTests/​PowerPlatformLS.UnitTests/​Impl.PullAgent/​Methods/​ConnectionHelperTests.cs Tests agent identity resolution in selected environments.
src/​LanguageServers/​PowerPlatformLS/​UnitTests/​PowerPlatformLS.UnitTests/​Impl.PullAgent/​Methods/​ApplyConnectionBindingsHandlerTests.cs Supplies the new operation-context dependency.
src/​LanguageServers/​PowerPlatformLS/​Impl.PullAgent/​ListAgentConnectionsRequest.cs Adds the target agent schema field.
src/​LanguageServers/​PowerPlatformLS/​Impl.PullAgent/​ListAgentConnectionsHandler.cs Routes deployment-specific connection reads.
src/​LanguageServers/​PowerPlatformLS/​Impl.PullAgent/​CreateConnectionReferenceResponse.cs Removes remote connection views from creation responses.
src/​LanguageServers/​PowerPlatformLS/​Impl.PullAgent/​CreateConnectionReferenceHandler.cs Creates local declarations without remote provisioning or cache writes.
src/​LanguageServers/​PowerPlatformLS/​Impl.PullAgent/​ConnectionHelper.cs Resolves deployment agent identity by schema name.
src/​LanguageServers/​PowerPlatformLS/​Impl.PullAgent/​ApplyConnectionBindingsRequest.cs Adds the target agent schema field.
src/​LanguageServers/​PowerPlatformLS/​Impl.PullAgent/​ApplyConnectionBindingsHandler.cs Routes deployment-specific binding updates.
src/​CopilotStudio.Sync/​WorkspaceSynchronizer.cs Implements deployment connection reads and validated binding writes.
src/​CopilotStudio.Sync/​IConnectionManagementService.cs Defines deployment management and local reference creation contracts.
src/​CopilotStudio.Sync.UnitTests/​ConnectionManagementTests.cs Tests target validation, deferred provisioning, and workspace preservation.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 18, 2026 13:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved issues can leave connection controls disabled, prevent returning to workspace mode, and incorrectly report Copilot Studio as unavailable for mixed-case environment IDs.

1 open issue
2 previously missed issues

In code that hasn't changed since last review

Medium severity Restore controls after locked navigation completes

src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​connections/​connectionManager.ts:141

openUsage() holds the operation lock while awaiting file access and showTextDocument(), but leaves the connection controls enabled and sends no completion message. A Refresh or deployment switch during that await disables the webview, then gets silently dropped by the lock, leaving the controls disabled after navigation finishes. Mark navigation busy and restore the idle state when it completes, or queue competing requests instead of dropping them.

Medium severity Keep workspace action available without a unique deployment

src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​deployments/​deploymentSelectorHtml.ts:232

When multiple deployments target the workspace environment, currentDeploymentId is undefined, so every nonempty selection—including an Attached option—uses deployment mode. Hiding the workspace action then prevents users from restoring workspace usages, reference removal, and workflow controls without closing the panel. Show this action when there is no unique currentDeploymentId, and update its click guard at line 299 to permit returning in that case.

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 18, 2026 13:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Reattaching the same folder can leave cached connection state targeting the previous environment, allowing Apply and connection creation to affect the wrong environment while workflow actions use the new workspace.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

High severity Reattaching a folder leaves connection state bound to the old workspace

src/​vscode-extensions/​microsoft-powerplatformlang-extension/​client/​src/​connections/​connectionManager.ts:56

Reopening this panel after reattaching the same folder replaces workspace but leaves the cached connection target and displayed rows tied to the previous attachment. With no deployment selected, target validation returns immediately, so Apply and connection creation still use the old environment while workflow actions use the new workspace. Detect attachment changes and block actions until all target-derived state is reloaded, coordinating pending edits and any in-flight operation.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 18, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because malformed configuration errors may leak private agent or deployment names through telemetry despite existing redaction.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 18, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Public contract changes and cross-environment binding writes require human review and real-tenant validation of compatibility and tenant isolation beyond the supplied mocks and synthetic fixtures.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@nlivie
nlivie merged commit 8599640 into main Nov 18, 2026
5 checks passed
@nlivie
nlivie deleted the gngangomtiem/deployment-connections branch November 18, 2026 16:48
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.

3 participants