The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): clarify primary SSH reuse failures
Jaime Marques14d16c2578f5
diff --git a/apps/desktop/electron/connection-registry.test.ts b/apps/desktop/electron/connection-registry.test.tsindex 4204c936c8f..a89fc52315e 100644--- a/apps/desktop/electron/connection-registry.test.ts+++ b/apps/desktop/electron/connection-registry.test.ts@@ -60,6 +60,42 @@ test('labelSlug kebab-cases and never returns empty for non-empty input', () =>assert.equal(labelSlug('!!!'), 'connection')})+test('registry SSH fingerprint failures name the connection and ssh -G step', async () => {+ const registry = migrateV1ToRegistry({+ mode: 'ssh',+ remote: { mode: 'ssh', host: 'build-host', user: 'alice' },+ profiles: {}+ })++ const source = registry.connections.find(connection => connection.id === registry.primary)!++ const cause = new Error('spawn ssh ENOENT')++ source.label = 'Build box'++ await assert.rejects(+ reuseMatchingPrimarySshBackend({+ connectionId: registry.primary,+ effectiveFingerprint: async () => {+ throw cause+ },+ ensurePrimary: async () => ({ mode: 'remote', remoteKind: 'ssh' }),+ profile: 'default',+ registry,+ source+ }),+ error => {+ assert.equal(+ (error as Error).message,+ `Could not resolve effective SSH config for connection "Build box" (${source.id}) via ssh -G: spawn ssh ENOENT`+ )+ assert.equal((error as Error).cause, cause)++ return true+ }+ )+})+test('matching primary/default SSH route reuses the existing descriptor once', async () => {const registry = migrateV1ToRegistry({mode: 'ssh',diff --git a/apps/desktop/electron/connection-registry.ts b/apps/desktop/electron/connection-registry.tsindex 92058749fef..919366ecaa7 100644--- a/apps/desktop/electron/connection-registry.ts+++ b/apps/desktop/electron/connection-registry.ts@@ -344,9 +344,13 @@ export interface ReuseMatchingPrimarySshBackendOptions {}/**- * Reuse the already-booted v1 window SSH backend only when its actual dialing- * identity matches the registry primary. Guards run before either async- * dependency so secondary profiles and sources never bootstrap the primary.+ * Reuse the v1 window SSH backend only when its actual dialing identity matches+ * the registry primary. Resolving that descriptor may boot the primary; a+ * mismatch returns null without reusing it so the caller continues with its+ * separately scoped registry backend. A matching descriptor is returned+ * unchanged and the caller may re-stamp routing fields such as profile and+ * connectionId. Guards run before either async dependency so secondary+ * profiles and sources never bootstrap the primary.*/export async function reuseMatchingPrimarySshBackend({connectionId,@@ -363,7 +367,19 @@ export async function reuseMatchingPrimarySshBackend({return null}- const sourceFingerprint = String(await effectiveFingerprint(source)).trim()+ let sourceFingerprint++ try {+ sourceFingerprint = String(await effectiveFingerprint(source)).trim()+ } catch (cause) {+ const detail = cause instanceof Error ? cause.message : String(cause)++ throw new Error(+ `Could not resolve effective SSH config for connection "${source.label}" (${source.id}) via ssh -G: ${detail}`,+ { cause }+ )+ }+const descriptor = await ensurePrimary()const activeSsh = descriptor.mode === 'remote' && descriptor.remoteKind === 'ssh' ? descriptor.ssh : nullconst rootProfile = (value: unknown) => String(value || '').trim() || 'default'diff --git a/apps/desktop/electron/primary-backend-startup.test.ts b/apps/desktop/electron/primary-backend-startup.test.tsindex fb3d488c5b1..72cb072e60b 100644--- a/apps/desktop/electron/primary-backend-startup.test.ts+++ b/apps/desktop/electron/primary-backend-startup.test.ts@@ -70,6 +70,7 @@ test('primary remote descriptor preserves the effective SSH dialing identity', ()assert.equal(connection.ssh, ssh)+ assert.equal(connection.ssh?.effectiveConfigFingerprint, 'effective-config')})test('primary remote descriptor keeps legacy unregistered routes unqualified', () => {diff --git a/contributors/emails/[email protected] b/contributors/emails/[email protected]new file mode 100644index 00000000000..7eab3ad6d9e--- /dev/null+++ b/contributors/emails/[email protected]@@ -0,0 +1 @@+MrTheSoulz