diff --git a/openclaw-manager.js b/openclaw-manager.js index cb09178..1d0a9d0 100644 --- a/openclaw-manager.js +++ b/openclaw-manager.js @@ -3360,12 +3360,20 @@ function renderAgents() { // Build grouping: prefer explicit parentAgentId; fallback to telegram bot-root grouping. const byId = {}; (S.agents||[]).forEach(a=>{ byId[a.id]=a; }); - // infer parentAgentId for legacy telegram sub-agents if missing + // infer parentAgentId for sub-agents if missing const accountToRootId = {}; (S.agents||[]).forEach(a=>{ if(a.hasOwnBot && a.accountId) accountToRootId[a.accountId]=a.id; }); (S.agents||[]).forEach(a=>{ - if(!a.parentAgentId && !a.hasOwnBot && a.parentAccountId && accountToRootId[a.parentAccountId]){ + if(a.parentAgentId || a.hasOwnBot || a.id === 'main') return; // already resolved or is a root + // Case 1: legacy telegram sub-agent with parentAccountId + if(a.parentAccountId && accountToRootId[a.parentAccountId]){ a._inferParentAgentId = accountToRootId[a.parentAccountId]; + return; + } + // Case 2: orphan agent (no own bot, no parentAgentId, no binding-based inference) + // These are likely dynamically created sub-agents — default to 'main' + if(byId['main']){ + a._inferParentAgentId = 'main'; } }); diff --git a/package.json b/package.json index fc12c02..be48f82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openclaw-manager", - "version": "0.9.3", + "version": "0.9.4", "description": "A local web UI for managing OpenClaw AI agents \u2014 no npm install required", "main": "openclaw-manager.js", "scripts": {