How the agent knows who's talking — and the manual chart bug that broke it for a day.
The problem
The agent sits behind oauth2-proxy. Users authenticate via GitHub SSO. But once authenticated, the agent had no idea who it was talking to — every request looked the same. Fixing that meant reading the identity headers oauth2-proxy injects on every authenticated request.
Headers oauth2-proxy injects
| Header | Value |
|---|---|
| X-Auth-Request-User | GitHub username (e.g. albegosu) |
| X-Auth-Request-Email | Primary email from GitHub |
| X-Auth-Request-Groups | Org membership groups the user belongs to |
| X-Forwarded-User | Same as X-Auth-Request-User, older name |
pass-user-headers: true is set in the oauth2-proxy config. Without it the headers are stripped before reaching the upstream app.Reading headers in the agent
Extracting caller identity
The agent now injects caller identity into the system prompt at the start of each conversation: You are talking to {username} ({email}). This changes how the agent personalises responses and which tools it offers.
The NetworkPolicy gap
oauth2-proxy and the agent run in the same namespace but in separate pods. Without a NetworkPolicy, any pod in the cluster could call the agent directly — bypassing auth entirely.
The manual chart bug
At some point oauth2-proxy was updated by running helm install directly instead of going through the GitOps pipeline. The new chart defaulted pass-user-headers to false.
Result: all identity headers were stripped. The agent started receiving empty usernames. No error — just empty strings that passed validation silently.
helm install manually in prod. All values need to live in the GitOps repo — not in your head.X-Auth-Request-User is a misconfiguration, not a valid caller.