From 4458ec1fd7c01ad93887aae9f0427aae503c9d9b Mon Sep 17 00:00:00 2001 From: 777genius Date: Thu, 28 May 2026 13:12:02 +0300 Subject: [PATCH] fix(opencode): wire junction diagnostics on dev --- ...entTeamsRuntimeProviderManagementCliClient.ts | 16 ++++++++++------ ...amsRuntimeProviderManagementCliClient.test.ts | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/features/runtime-provider-management/main/infrastructure/AgentTeamsRuntimeProviderManagementCliClient.ts b/src/features/runtime-provider-management/main/infrastructure/AgentTeamsRuntimeProviderManagementCliClient.ts index b37a61ee..9667402c 100644 --- a/src/features/runtime-provider-management/main/infrastructure/AgentTeamsRuntimeProviderManagementCliClient.ts +++ b/src/features/runtime-provider-management/main/infrastructure/AgentTeamsRuntimeProviderManagementCliClient.ts @@ -157,13 +157,17 @@ function sanitizeRuntimeProviderError(error: unknown): RuntimeProviderManagement ? (rawCode as RuntimeProviderManagementErrorDto['code']) : 'runtime-unhealthy'; const diagnostics = sanitizeRuntimeProviderDiagnostics(error.diagnostics); + const message = + sanitizeNullableRuntimeProviderText(error.message) ?? + 'Runtime provider management command failed'; return { code, - message: - sanitizeNullableRuntimeProviderText(error.message) ?? - 'Runtime provider management command failed', + message, recoverable: typeof error.recoverable === 'boolean' ? error.recoverable : true, - diagnostics: withRuntimeProviderErrorCode(code, diagnostics), + diagnostics: withRuntimeProviderErrorCode( + code, + diagnostics ?? buildOpenCodeProfileNodeModulesLinkDiagnostics(message) + ), }; } @@ -238,7 +242,7 @@ function buildOpenCodeProfileNodeModulesLinkDiagnostics( const summary = 'OpenCode managed profile node_modules link was blocked.'; const likelyCause = - 'Windows denied creating the managed OpenCode profile node_modules link. The runtime does not yet fall back to a junction or local profile directory on Windows — this is a known limitation.'; + 'Windows denied creating the managed OpenCode profile node_modules link. The app attempted automatic junction recovery when possible, but the link is still unavailable.'; return { summary, likelyCause, @@ -249,7 +253,7 @@ function buildOpenCodeProfileNodeModulesLinkDiagnostics( stderrPreview: message, stdoutPreview: null, hints: [ - 'The next runtime update will include automatic junction fallback for Windows.', + 'The app attempts automatic junction fallback for this Windows link failure before showing this error.', 'As a temporary workaround, enable Windows Developer Mode or run Agent Teams AI as Administrator.', 'After enabling Developer Mode, refresh the OpenCode provider catalog.', ], diff --git a/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts b/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts index 5da5ca8b..5ddd5a13 100644 --- a/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts +++ b/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts @@ -907,7 +907,7 @@ describe('AgentTeamsRuntimeProviderManagementCliClient', () => { expect(response.error?.diagnostics?.stderrPreview).toBe(runtimeMessage); expect(response.error?.diagnostics?.hints).toEqual( expect.arrayContaining([ - 'The next runtime update will include automatic junction fallback for Windows.', + 'The app attempts automatic junction fallback for this Windows link failure before showing this error.', 'As a temporary workaround, enable Windows Developer Mode or run Agent Teams AI as Administrator.', ]) );