fix(handler): attribute agent CLI actions to agent identity
When agents use the multica CLI during task execution, their comments, issue updates, and issue creations were attributed to the daemon's user (via JWT) instead of the agent. Pass MULTICA_AGENT_ID env var from the daemon, send X-Agent-ID header from the CLI client, and use it in handlers to set the correct author/actor identity.
This commit is contained in:
parent
663dec52b8
commit
a4c8bbb03c
5 changed files with 52 additions and 10 deletions
|
|
@ -21,6 +21,7 @@ type APIClient struct {
|
|||
BaseURL string
|
||||
WorkspaceID string
|
||||
Token string
|
||||
AgentID string // When set, requests are attributed to this agent instead of the user.
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +42,9 @@ func (c *APIClient) setHeaders(req *http.Request) {
|
|||
if c.WorkspaceID != "" {
|
||||
req.Header.Set("X-Workspace-ID", c.WorkspaceID)
|
||||
}
|
||||
if c.AgentID != "" {
|
||||
req.Header.Set("X-Agent-ID", c.AgentID)
|
||||
}
|
||||
}
|
||||
|
||||
// GetJSON performs a GET request and decodes the JSON response.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue