From e4403ff010456602816baffc57347a8e2af3bea6 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Sat, 25 Apr 2026 19:27:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=20RCS=20=E6=8C=89=20m?= =?UTF-8?q?achineName=20=E5=A4=8D=E7=94=A8=20agent=20=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多个同名 acp-link 实例注册到 RCS 时,REST 注册阶段按 machineName 去重导致不同实例共享同一条记录。改为每次注册都创建独立记录, 重连恢复由 WS identify 阶段按 environment_id 精确匹配。 Co-Authored-By: Claude Opus 4.7 --- packages/remote-control-server/src/store.ts | 33 --------------------- 1 file changed, 33 deletions(-) diff --git a/packages/remote-control-server/src/store.ts b/packages/remote-control-server/src/store.ts index c52cd9b59..76e03d526 100644 --- a/packages/remote-control-server/src/store.ts +++ b/packages/remote-control-server/src/store.ts @@ -98,22 +98,6 @@ export function storeDeleteToken(token: string): boolean { // ---------- Environment ---------- -/** Find an active or offline environment by machineName (optionally filtered by workerType). - * Includes "offline" so ACP agents can be reused on reconnect. */ -export function storeFindEnvironmentByMachineName( - machineName: string, - workerType?: string, -): EnvironmentRecord | undefined { - for (const rec of environments.values()) { - if (rec.machineName === machineName && (rec.status === "active" || rec.status === "offline")) { - if (!workerType || rec.workerType === workerType) { - return rec; - } - } - } - return undefined; -} - export function storeCreateEnvironment(req: { secret: string; machineName?: string; @@ -126,23 +110,6 @@ export function storeCreateEnvironment(req: { username?: string; capabilities?: Record; }): EnvironmentRecord { - // ACP: reuse existing active record by machineName - if (req.workerType === "acp" && req.machineName) { - const existing = storeFindEnvironmentByMachineName(req.machineName, "acp"); - if (existing) { - Object.assign(existing, { - status: "active", - lastPollAt: new Date(), - updatedAt: new Date(), - maxSessions: req.maxSessions ?? existing.maxSessions, - bridgeId: req.bridgeId ?? existing.bridgeId, - capabilities: req.capabilities ?? existing.capabilities, - username: req.username ?? existing.username, - }); - return existing; - } - } - const id = `env_${uuid().replace(/-/g, "")}`; const now = new Date(); const record: EnvironmentRecord = {