From 036fb4d4fabc253b541610b441a5a89f9c7e42f1 Mon Sep 17 00:00:00 2001 From: David Kaya Date: Sat, 28 Mar 2026 15:27:48 +0100 Subject: [PATCH] fix: stabilize cross-platform CI checks Use the repository's default Electron import pattern in the MCP OAuth service, make the attachment-path test platform-neutral, and ensure the hook runner cwd/env test drains stdin before asserting shell output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../AryxCopilotAgentMessageOptionsTests.cs | 5 +++-- sidecar/tests/Aryx.AgentHost.Tests/HookCommandRunnerTests.cs | 4 ++-- src/main/services/mcpOAuthService.ts | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sidecar/tests/Aryx.AgentHost.Tests/AryxCopilotAgentMessageOptionsTests.cs b/sidecar/tests/Aryx.AgentHost.Tests/AryxCopilotAgentMessageOptionsTests.cs index 3959020..cdada84 100644 --- a/sidecar/tests/Aryx.AgentHost.Tests/AryxCopilotAgentMessageOptionsTests.cs +++ b/sidecar/tests/Aryx.AgentHost.Tests/AryxCopilotAgentMessageOptionsTests.cs @@ -10,13 +10,14 @@ public sealed class AryxCopilotAgentMessageOptionsTests [Fact] public async Task ProcessMessageAttachmentsAsync_MapsProtocolAttachmentsAndMessageMode() { + string attachmentPath = Path.GetFullPath(Path.Combine(Path.GetTempPath(), "aryx-tests", "assets", "diagram.png")); ChatMessage message = new(ChatRole.User, "Please inspect these images."); message.Contents.Add(new AIContent { RawRepresentation = new ChatMessageAttachmentDto { Type = "file", - Path = @"C:\workspace\project\assets\diagram.png", + Path = attachmentPath, DisplayName = "diagram.png", }, }); @@ -47,7 +48,7 @@ public sealed class AryxCopilotAgentMessageOptionsTests first => { UserMessageDataAttachmentsItemFile file = Assert.IsType(first); - Assert.Equal(@"C:\workspace\project\assets\diagram.png", file.Path); + Assert.Equal(attachmentPath, file.Path); Assert.Equal("diagram.png", file.DisplayName); }, second => diff --git a/sidecar/tests/Aryx.AgentHost.Tests/HookCommandRunnerTests.cs b/sidecar/tests/Aryx.AgentHost.Tests/HookCommandRunnerTests.cs index 8f82cb7..183dcf9 100644 --- a/sidecar/tests/Aryx.AgentHost.Tests/HookCommandRunnerTests.cs +++ b/sidecar/tests/Aryx.AgentHost.Tests/HookCommandRunnerTests.cs @@ -71,8 +71,8 @@ public sealed class HookCommandRunnerTests string hooksDirectory = Directory.CreateDirectory(Path.Combine(project.Path, "scripts")).FullName; HookCommandDefinition hook = CreatePlatformHook( OperatingSystem.IsWindows() - ? "Write-Output ((Get-Location).Path + '|' + $env:HOOK_TEST_ENV)" - : "printf '%s|%s' \"$(pwd)\" \"$HOOK_TEST_ENV\"", + ? "$null = [Console]::In.ReadToEnd(); Write-Output ([Environment]::CurrentDirectory + '|' + $env:HOOK_TEST_ENV)" + : "cat >/dev/null; printf '%s|%s' \"$(pwd)\" \"$HOOK_TEST_ENV\"", cwd: "scripts", env: new Dictionary { diff --git a/src/main/services/mcpOAuthService.ts b/src/main/services/mcpOAuthService.ts index cac303a..50957c7 100644 --- a/src/main/services/mcpOAuthService.ts +++ b/src/main/services/mcpOAuthService.ts @@ -1,12 +1,14 @@ import { randomBytes, createHash } from 'node:crypto'; import { createServer, type Server, type IncomingMessage, type ServerResponse } from 'node:http'; -import { shell } from 'electron'; +import electron from 'electron'; import type { McpOauthStaticClientConfig } from '@shared/domain/mcpAuth'; import { storeToken, buildWellKnownUrl, buildWellKnownUrlFallback, type McpOAuthToken } from './mcpTokenStore'; +const { shell } = electron; + /* ── Public API ──────────────────────────────────────────────── */ export interface McpOAuthFlowOptions {