From 5a710128007d0608f9574447467126cb71d55743 Mon Sep 17 00:00:00 2001 From: hanghang zhang Date: Fri, 22 May 2026 22:46:50 +0100 Subject: [PATCH] fix(triage): resolve claw_identifier via openclaw config (HF plugin's identifier) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit os.hostname() fallback is wrong in sim where container hostname (server.t2) doesn't match the HF agent row's claw_identifier (sim-t2). Add intermediate fallback that reads openclaw config plugins.harbor-forge.identifier — the same value the HF plugin uses for its outbound HF calls — keeping plugin and HF agent state aligned without a per-service-unit HF_CLAW_IDENTIFIER env override. Priority: 1. HF_CLAW_IDENTIFIER env (operator override) 2. openclaw config plugins.harbor-forge.identifier (NEW) 3. os.hostname() last-resort 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) --- src/inbound.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/inbound.ts b/src/inbound.ts index d089448..50502c1 100644 --- a/src/inbound.ts +++ b/src/inbound.ts @@ -129,7 +129,30 @@ export class FabricInbound { return cached.onCall; } const base = (process.env.HF_API_BASE_URL ?? '').trim() || 'https://monitor.hangman-lab.top'; - const claw = (process.env.HF_CLAW_IDENTIFIER ?? '').trim() || (await import('os')).hostname(); + // CLAW_IDENTIFIER resolution priority: + // 1. HF_CLAW_IDENTIFIER env (operator override) + // 2. openclaw config `plugins.harbor-forge.identifier` (what the HF + // plugin itself uses — keeps the two in sync without an extra + // env per service unit) + // 3. os.hostname() last-resort fallback (often wrong: e.g. sim + // container hostname is `server.t2` but HF agent row has + // `claw_identifier=sim-t2`; matching is mandatory for the HF + // backend's _require_agent() check) + let claw = (process.env.HF_CLAW_IDENTIFIER ?? '').trim(); + if (!claw) { + try { + const cfg = (this.cfg as { plugins?: { 'harbor-forge'?: { identifier?: string } } }); + const fromCfg = cfg?.plugins?.['harbor-forge']?.identifier; + if (fromCfg && typeof fromCfg === 'string' && fromCfg.trim()) { + claw = fromCfg.trim(); + } + } catch { + /* fall through to hostname */ + } + } + if (!claw) { + claw = (await import('os')).hostname(); + } let onCall = false; try { const url = `${base.replace(/\/$/, '')}/calendar/agent/status?agent_id=${encodeURIComponent(agentId)}`;