fix(opencode): wire junction diagnostics on dev

This commit is contained in:
777genius 2026-05-28 13:12:02 +03:00
parent 8abf4ea7dd
commit 4458ec1fd7
2 changed files with 11 additions and 7 deletions

View file

@ -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.',
],

View file

@ -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.',
])
);