Skip to content

Commit 7e83f1c

Browse files
phiatclaude
andcommitted
Fix agent type names not applied in stream view
The watcher only overrode agent_name when item.AgentID was empty, but the parser already sets it from the JSONL agentId field. Now always applies agent type name when available, regardless of whether the parser pre-populated the agent ID. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 964f696 commit 7e83f1c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal/watcher/watcher.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,16 +1331,18 @@ func (w *Watcher) readFile(path string, sessionID string, agentID string, agentT
13311331
// Set session ID
13321332
item.SessionID = sessionID
13331333

1334-
// Set agent ID from context if not already set
1335-
if agentID != "" && item.AgentID == "" {
1336-
item.AgentID = agentID
1334+
// Set agent ID and name from context
1335+
if agentID != "" {
1336+
if item.AgentID == "" {
1337+
item.AgentID = agentID
1338+
}
13371339
if agentType != "" {
13381340
if idx := strings.LastIndex(agentType, ":"); idx >= 0 && idx < len(agentType)-1 {
13391341
item.AgentName = agentType[idx+1:]
13401342
} else {
13411343
item.AgentName = agentType
13421344
}
1343-
} else {
1345+
} else if item.AgentName == "" || strings.HasPrefix(item.AgentName, "Agent-") {
13441346
item.AgentName = fmt.Sprintf("Agent-%s", agentID[:min(AgentIDDisplayLength, len(agentID))])
13451347
}
13461348
}

0 commit comments

Comments
 (0)