mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: tag chat-originating agent logs with chat_id (#25019)
Workspace-agent logs emitted while serving chatd-driven requests were not correlated with the originating chat, making agent logs hard to attribute to the corresponding/originating chat. This adds agent-side chat context middleware that parses `Coder-Chat-Id` once, enriches agent access logs and structured handler/background logs, and adds a chatd bridge log when chat headers are attached to an agent connection. Closes CODAGT-324
This commit is contained in:
@@ -905,6 +905,12 @@ func (c *turnWorkspaceContext) getWorkspaceConn(ctx context.Context) (workspaces
|
||||
})
|
||||
|
||||
c.mu.Unlock()
|
||||
c.server.logger.Debug(ctx, "set chat headers on agent conn",
|
||||
slog.F("chat_id", chatSnapshot.ID),
|
||||
slog.F("ancestor_chat_ids", ancestorIDs),
|
||||
slog.F("workspace_id", chatSnapshot.WorkspaceID.UUID),
|
||||
slog.F("agent_id", dialResult.AgentID),
|
||||
)
|
||||
return agentConn, nil
|
||||
}
|
||||
currentConn = c.conn
|
||||
|
||||
Reference in New Issue
Block a user