feat(api): forward GITLAB_DUO_SESSION_ID as X-Gitlab-Duo-Session-Id header
Summary
- Reads
GITLAB_DUO_SESSION_IDenvironment variable inNewClientFromConfig - When set, injects
X-Gitlab-Duo-Session-IdHTTP header on every outgoing API request - No behavior change when the env var is unset
This allows GitLab Duo agents that invoke glab to have their CLI actions traced back to the originating agent session.
Closes #8328 (closed)
Test plan
-
go test ./internal/api/...passes (newTestNewClientFromConfig_DuoSessionIDcovers both the injection and no-op paths) - Manual:
GITLAB_DUO_SESSION_ID=test-session glab api projects— confirmX-Gitlab-Duo-Session-Id: test-sessionappears in request headers (e.g. viaGLAB_DEBUG_HTTP=true)