DYN-10716: Disable Autodesk Assistant when IDSDK is not initialized - #17251
DYN-10716: Disable Autodesk Assistant when IDSDK is not initialized#17251eamiri wants to merge 5 commits into
Conversation
Extend DisableExtensionWhenNoNetworkMode to also block the Autodesk Assistant and MCP View extensions when IDSDK is not present. Previously, opening the Assistant without Autodesk Identity installed produced four sequential error dialogs. Now the extensions are silently skipped at startup, matching the existing NoNetworkMode behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10716
There was a problem hiding this comment.
Pull request overview
This PR prevents the Autodesk Assistant and MCP View extensions from being started/loaded when Autodesk Identity (IDSDK) isn’t available, avoiding the cascading “Create Assistant / RegisterCallbackInterface / GetAssistantURL / OnPushMcpServers” error dialogs in that scenario.
Changes:
- Updated
DynamoView.DisableExtensionWhenNoNetworkMode(...)to additionally block the Autodesk Assistant and MCP View extensions whenAuthenticationManager.IsIDSDKInitialized()is false (while keeping NoNetworkMode gating). - Added UI tests that exercise the new IDSDK-not-initialized gating path for both extension IDs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs | Adds two tests covering “disable extension when IDSDK is not initialized”. |
| src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs | Extends extension gating logic to disable Autodesk Assistant/MCP when IDSDK isn’t initialized, in addition to NoNetworkMode. |
Comments suppressed due to low confidence (1)
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:170
- This test is environment-dependent if IDSDK can initialize successfully (e.g., on developer machines with Autodesk Identity/IDSDK installed). Add an
Assume.That(...)guard to skip when IDSDK initialization succeeds so the suite remains deterministic.
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
| }); | ||
|
|
…nitialized Replace the previous approach (blocking extension startup entirely) with one that lets the extension load its sidebar tab normally, then sets IsEnabled=false on the tab when IDSDK is not present. This keeps the button visible but unclickable, preventing the cascade of four native error dialogs without completely removing the AA/MCP UI from the sidebar. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:117
- The new test assumes IDSDK is not available on the machine running the suite (it expects
IsIDSDKInitialized()to be false). If a developer or CI agent has IDSDK installed/configured such thatIDSDKManager.Initialize()succeeds, this test will fail even though the product behavior is correct. Consider making the test deterministic by skipping when IDSDK is actually initialized, or by restructuring to avoid relying on native IDSDK availability.
// IDSDKManager.IsIDSDKInitialized returns false when the native IDSDK library
// is not installed (e.g. test environments, VMs without Autodesk Identity).
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:161
- This test name suggests IDSDK is initialized, but the Arrange step actually relies on
AuthProviderbeing null (which makesAuthenticationManager.IsIDSDKInitialized()return true by default). Renaming the test to reflect the actual condition will make intent clearer and avoid confusion when reading failures.
public void AssistantAndMcpTabsAreNotDisabledWhenIDSDKIsInitialized()
src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs:3427
- PR description says
DisableExtensionWhenNoNetworkModewas extended to also gate Autodesk Assistant/MCP onIsIDSDKInitialized(), but the code change here instead introducesDisableExtensionTabsWhenIDSDKNotInitialized()and leavesDisableExtensionWhenNoNetworkModeunchanged (NoNetworkMode-only). Please either update the PR description to match the implemented approach, or adjust the code to match the described behavior if extension-load gating was intended.
/// <summary>
/// Disables (but keeps visible) the Autodesk Assistant and MCP sidebar tabs when IDSDK is
/// not initialized, preventing the cascade of native error dialogs that occur when the user
/// opens the Assistant without Autodesk Identity installed.
/// </summary>
internal void DisableExtensionTabsWhenIDSDKNotInitialized()
{
if (dynamoViewModel.Model.AuthenticationManager.IsIDSDKInitialized())
return;
Hook DisableExtensionTabsWhenIDSDKNotInitialized into OnCollectionChanged so it fires whenever a tab is added to SideBarTabItems, not only during initial extension load. This covers the case where the AA extension removes and re-adds its tab in response to a workspace open, which previously left the tab re-enabled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs:3441
- This duplicates the IDSDK check logic that already exists in DynamoViewModel.IsIDSDKInitialized(showWarning, owner). Using the view-model helper (with showWarning:false) keeps the behavior consistent with other UI entry points and avoids future drift. Also consider avoiding repeated log spam by only logging when the tab transitions from enabled → disabled.
internal void DisableExtensionTabsWhenIDSDKNotInitialized()
{
if (dynamoViewModel.Model.AuthenticationManager.IsIDSDKInitialized())
return;
foreach (var extensionId in new[] { AutodeskAssistantExtensionId, McpViewExtensionId })
{
var tab = dynamoViewModel.SideBarTabItems.OfType<TabItem>()
.SingleOrDefault(t => string.Equals(t.Uid, extensionId, StringComparison.OrdinalIgnoreCase));
if (tab != null)
{
tab.IsEnabled = false;
Log($"Extension tab {tab.Header} disabled because IDSDK is not initialized");
}
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:125
- These tests assume IDSDK is not available on the machine running the tests. If Autodesk Identity/IDSDK is installed (and can initialize), AuthenticationManager.IsIDSDKInitialized() will return true and this test will fail. Consider skipping the test when IDSDK is actually available, so the suite is deterministic across dev machines and CI.
// IDSDKManager.IsIDSDKInitialized returns false when the native IDSDK library
// is not installed (e.g. test environments, VMs without Autodesk Identity).
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = Dynamo.Scheduler.TaskProcessMode.Synchronous,
NoNetworkMode = false,
AuthProvider = new IDSDKManager()
});
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:177
- Same as the previous test: this relies on IDSDK failing to initialize (native library missing). On machines where IDSDK can initialize, this will fail. Add a guard to skip when IDSDK is available to keep the suite stable.
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = Dynamo.Scheduler.TaskProcessMode.Synchronous,
NoNetworkMode = false,
AuthProvider = new IDSDKManager()
});
src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs:1025
- DisableExtensionTabsWhenIDSDKNotInitialized() is now invoked for every tab add, which can repeatedly trigger IDSDK initialization attempts (and related logging/overhead) even when unrelated tabs are added. Consider only calling it when the newly added TabItem(s) are for Autodesk Assistant or MCP.
This issue also appears on line 3428 of the same file.
if (e.Action == NotifyCollectionChangedAction.Add)
{
DisableExtensionTabsWhenIDSDKNotInitialized();
}
…Mode Extensions can call AddToExtensionsSideBar() through late code paths (e.g. IExtensionStorageAccess.WorkspaceOpened) that bypass the guard in DynamoLoadedViewExtensionHandler. Adding the NoNetworkMode check at the top of AddOrFocusExtensionControl closes this gap for both the Autodesk Assistant and MCP extensions, matching the same fix already applied to the IDSDK-not-initialized case via OnCollectionChanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (3)
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:127
- This test relies on the machine not having Autodesk Identity/IDSDK available so that IDSDKManager.IsIDSDKInitialized returns false. If IDSDK is installed and initializes successfully, the tab will remain enabled and the test will fail nondeterministically across environments. Add an explicit Assume/Ignore based on AuthenticationManager.IsIDSDKInitialized() to make the test environment-independent.
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = Dynamo.Scheduler.TaskProcessMode.Synchronous,
NoNetworkMode = false,
AuthProvider = new IDSDKManager()
});
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:179
- Same as the previous IDSDK-uninitialized test: this test will fail on machines where IDSDK initializes successfully. Add an Assume/Ignore after model start so the test is deterministic across dev/CI environments.
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = Dynamo.Scheduler.TaskProcessMode.Synchronous,
NoNetworkMode = false,
AuthProvider = new IDSDKManager()
});
src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs:1028
- OnCollectionChanged calls DisableExtensionTabsWhenIDSDKNotInitialized() for every sidebar tab add, which can repeatedly trigger IDSDKManager.Initialize() attempts (and console logging) even when unrelated tabs are added. It’s cheaper and avoids log spam to only run this when the newly added item(s) are the Assistant/MCP tab(s).
if (e.Action == NotifyCollectionChangedAction.Add)
{
DisableExtensionTabsWhenIDSDKNotInitialized();
}
| var tab = dynamoViewModel.SideBarTabItems.OfType<TabItem>() | ||
| .SingleOrDefault(t => string.Equals(t.Uid, extensionId, StringComparison.OrdinalIgnoreCase)); | ||
| if (tab != null) | ||
| { | ||
| tab.IsEnabled = false; | ||
| Log($"Extension tab {tab.Header} disabled because IDSDK is not initialized"); | ||
| } |
| Log(ext.Name + ": " + exc.Message); | ||
| } | ||
| } | ||
| DisableExtensionTabsWhenIDSDKNotInitialized(); |
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (5)
src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs:3444
- DisableExtensionTabsWhenIDSDKNotInitialized uses SingleOrDefault to find a matching TabItem by Uid. If the sidebar collection ever contains duplicates for the same extension ID (e.g., during re-add/remove races or extension bugs), SingleOrDefault will throw and crash the UI. Prefer iterating all matches (or at least FirstOrDefault) to make this defensive.
var tab = dynamoViewModel.SideBarTabItems.OfType<TabItem>()
.SingleOrDefault(t => string.Equals(t.Uid, extensionId, StringComparison.OrdinalIgnoreCase));
if (tab != null)
{
tab.IsEnabled = false;
Log($"Extension tab {tab.Header} disabled because IDSDK is not initialized");
}
src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs:3434
- PR description says the IDSDK-not-initialized behavior is implemented by extending DisableExtensionWhenNoNetworkMode to block the Autodesk Assistant and MCP extensions from loading. In this diff, DisableExtensionWhenNoNetworkMode is unchanged (still only NoNetworkMode), and the new logic only disables existing sidebar tabs after they’re added/loaded. Please either update the PR description to match the implementation, or move the IDSDK gating into the same "block extension" path (e.g., the DisableExtensionWhenNoNetworkMode guard sites / AddOrFocusExtensionControl) if the intent is to prevent extension open/reopen rather than just disabling the tab UI.
/// <summary>
/// Disables (but keeps visible) the Autodesk Assistant and MCP sidebar tabs when IDSDK is
/// not initialized, preventing the cascade of native error dialogs that occur when the user
/// opens the Assistant without Autodesk Identity installed.
/// </summary>
internal void DisableExtensionTabsWhenIDSDKNotInitialized()
{
if (dynamoViewModel.Model.AuthenticationManager.IsIDSDKInitialized())
return;
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:128
- These tests assume IDSDK cannot initialize (missing native IDSDK / missing client config). On machines where Autodesk Identity + IDSDK config is present, IDSDKManager.IsIDSDKInitialized can return true and this test will fail even though Dynamo behavior is correct. Consider guarding with an Assume.That(...) so the test is skipped/inconclusive when IDSDK is actually available.
// IDSDKManager.IsIDSDKInitialized returns false when the native IDSDK library
// is not installed (e.g. test environments, VMs without Autodesk Identity).
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = Dynamo.Scheduler.TaskProcessMode.Synchronous,
NoNetworkMode = false,
AuthProvider = new IDSDKManager()
});
test/DynamoCoreWpfTests/DynamoViewNoNetworkModeTests.cs:180
- Same environment-dependence applies here: if IDSDK initializes successfully on a developer machine/agent, the "uninitialized" assertions will fail even though the product behavior is correct. Consider adding an Assume.That(...) after model start (as in the prior test) to skip when IDSDK is available.
modelWithUninitializedIDSDK = DynamoModel.Start(new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = Dynamo.Scheduler.TaskProcessMode.Synchronous,
NoNetworkMode = false,
AuthProvider = new IDSDKManager()
});
src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs:542
- AddOrFocusExtensionControl now returns false when the extension is blocked by NoNetworkMode, but the XML doc comment says false only means the control already existed. This return value is consumed by ViewLoadedParams.AddToExtensionsSideBar to log "ExtensionAlreadyPresent", so a blocked extension will now produce a misleading log entry (in addition to the NoNetworkMode log). Consider returning a richer result (enum/exception) or updating the caller’s logging semantics so blocked vs already-present are distinguishable.
/// <summary>
/// Adds an extension control or if it already exists it makes sure it is focused.
/// The control may be added as a window or a tab in the extension bar depending on settings.
/// </summary>
/// <param name="viewExtension">View extension adding the content</param>
/// <param name="content">Control being added</param>
/// <returns>True if the control was added, false if it already existed</returns>
internal bool AddOrFocusExtensionControl(IViewExtension viewExtension, UIElement content)
{
if (DisableExtensionWhenNoNetworkMode(viewExtension.UniqueId, viewExtension.Name, "opened"))
return false;
jasonstratton
left a comment
There was a problem hiding this comment.
There are a couple of changes I would like to see, but the definite blocker is around the ReOpen call, which would load and open the extension and disable it later. ... Unless I misunderstood what the actual fix was supposed to be. I think the AA tab should not be visible and the button to show it is disabled.
The PR body says it extends DisableExtensionWhenNoNetworkMode and lists tests (AutodeskAssistantExtensionIsDisabled...) that don't exist; the code actually adds a new DisableExtensionTabsWhenIDSDKNotInitialized method with different test names.
| } | ||
|
|
||
| ext.Loaded(loadedParams); | ||
| ReOpenSavedExtensionOnDynamoStartup(ext); |
There was a problem hiding this comment.
The Extension is Loaded and ReOpened here if it was open in a previous session, even though it is disabled below with DisableExtensionTabsWhenIDSDKNotInitialized()
I think it might need a similar if-continue statement like the NoNetworkMode check above in order to prevent the extension from being loaded
There was a problem hiding this comment.
Oh, as a nuance, if the extension tab is not ReOpened, there is nothing to disable below. ... But I think the AA button needs to be disabled?
| foreach (var extensionId in new[] { AutodeskAssistantExtensionId, McpViewExtensionId }) | ||
| { | ||
| var tab = dynamoViewModel.SideBarTabItems.OfType<TabItem>() | ||
| .SingleOrDefault(t => string.Equals(t.Uid, extensionId, StringComparison.OrdinalIgnoreCase)); |
There was a problem hiding this comment.
SingleOrDefault() throws InvalidOperationException if two tabs ever share a Uid ... rare, but possible when re-adding a tab. Better to be safe and not assume uniqueness. An exception here can crash the UI.
| Assert.IsFalse(shouldDisable); | ||
| } | ||
|
|
||
| [Test] |
There was a problem hiding this comment.
These tests assume the IDSDK is unavailable, but on a test machine or a dev machine, it might be installed and fail.
Add Assume.That(!...IsIDSDKInitialized()) or Assert.Ignore
| internal bool AddOrFocusExtensionControl(IViewExtension viewExtension, UIElement content) | ||
| { | ||
| if (DisableExtensionWhenNoNetworkMode(viewExtension.UniqueId, viewExtension.Name, "opened")) | ||
| return false; |
There was a problem hiding this comment.
Returns false when the extension is blocked, but returning false is actually an indication that the extension is already present and the caller AddToExtensionsSideBar treats it as such and will log ExtensionAlreadyPresent for a blocked extension. ... This might require a switch from a bool to an enum. It is an internal method and would not be a breaking change.
| } | ||
|
|
||
| [Test] | ||
| public void AssistantTabCannotBeAddedViaSideBarWhenNoNetworkModeIsEnabled() |
There was a problem hiding this comment.
Is this testing NoNetworkMode?



Purpose
DYN-10716: Fixes a UX problem where opening the Autodesk Assistant sidebar without Autodesk Identity (IDSDK) installed produced four sequential Windows error dialogs (
Create Assistant failed,RegisterCallbackInterface failed,GetAssistantURL failed,OnPushMcpServers failed), each requiring manual dismissal.Key changes:
DisableExtensionWhenNoNetworkModeinDynamoView.xaml.csto also block the Autodesk Assistant and MCP View extensions whenAuthenticationManager.IsIDSDKInitialized()returns false. The method now early-exits for unrecognized extensions, then gates onNoNetworkModeas before, and finally gates on IDSDK not being initialized — silently logging a message rather than letting the extension load and cascade into 4 error dialogs.AutodeskAssistantExtensionIsDisabledWhenIDSDKIsNotInitializedandMcpViewExtensionIsDisabledWhenIDSDKIsNotInitialized) that exercise the new path by injecting anIDSDKManageras theAuthProviderinto a testDynamoModel. In environments without the native IDSDK library installed,IDSDKManager.Initialize()fails gracefully andIsIDSDKInitializedreturns false, confirming the extension is blocked.No public API changes. No new nodes.
Declarations
Check these if you believe they are true
Release Notes
N/A
Reviewers
(FILL ME IN)
FYIs
The
Dynamo-AutodeskAssistantpackage repo maintainers may want to be aware of this change, as the root cause of the cascading errors originates in the nativeCreate Assistant/RegisterCallbackInterfacecalls in that repo.