From 6f13d324e4f83f0f52be34aa7a974e8300c2923c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 22 Mar 2026 13:00:11 -0400 Subject: [PATCH] fix: handle single-connector case in matching heuristic and CEO prompt - matchConnector returns honest reason when only one connector is ready - CEO prompt detects single-connector scenario and tells CEO to use it for all agents - Removes misleading 'Best match' language when there's no actual choice --- src/main/connector-matching.ts | 5 ++++- src/main/prompt-builder.ts | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/connector-matching.ts b/src/main/connector-matching.ts index 226cd5e6..2e8d2e65 100644 --- a/src/main/connector-matching.ts +++ b/src/main/connector-matching.ts @@ -140,10 +140,13 @@ export function matchConnector(input: ConnectorMatchInput): ConnectorMatchResult // recommended should always be set if readySet.size > 0, but guard if (recommended) { + const onlyOneReady = readySet.size === 1; return { recommendedConnectorId: recommended, fallbackConnectorId: fallback, - reason: `Best match for ${taskType} tasks: ${CONNECTOR_STRENGTHS[recommended]}`, + reason: onlyOneReady + ? `Only available connector: ${recommended}. Assign to all agents.` + : `Best match for ${taskType} tasks: ${CONNECTOR_STRENGTHS[recommended]}`, }; } } diff --git a/src/main/prompt-builder.ts b/src/main/prompt-builder.ts index 524a1930..6d36f968 100644 --- a/src/main/prompt-builder.ts +++ b/src/main/prompt-builder.ts @@ -928,7 +928,19 @@ IMPORTANT: Wait for the Board to approve before starting business operations. return `- **${c.label}** (\`${c.id}\`): ${strengths} [STATUS: ${c.status}]`; }); - sections.push(`# Available Connectors for Hiring + const readyConnectors = ctx.allConnectors.filter((c) => c.status === "ready"); + const onlyOneConnector = readyConnectors.length === 1; + + if (onlyOneConnector) { + const sole = readyConnectors[0]; + sections.push(`# Available Connectors for Hiring +You have ONE available connector: +${connectorLines.join("\n")} + +Since only **${sole.label}** (\`${sole.id}\`) is ready, assign it to ALL agents you create. Do not worry about matching connectors to roles — use this connector for every agent. +`); + } else { + sections.push(`# Available Connectors for Hiring When hiring agents, assign the best connector for their role: ${connectorLines.join("\n")} @@ -940,6 +952,7 @@ Connector Assignment Guide: - If preferred connector is not listed as "ready", use the next best available - NEVER assign a connector with status "not_installed" or "error" `); + } } } else if (hasPendingOrgApproval) { sections.push(`# Operating Instructions (CEO — Awaiting Org Approval)