feat: conditionally send aibridge actor headers (#21643)

Also passes along the authenticated username as actor metadata.

Closes https://github.com/coder/aibridge/issues/135
Depends on https://github.com/coder/aibridge/pull/142

**Replace aibridge tag with merge commit once
https://github.com/coder/aibridge/pull/142 lands.**

---------

Signed-off-by: Danny Kopping <danny@coder.com>
This commit is contained in:
Danny Kopping
2026-01-26 15:08:17 +00:00
committed by GitHub
parent bb186b8699
commit 7123518baa
19 changed files with 252 additions and 69 deletions
+1
View File
@@ -200,6 +200,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
},
"rate_limit": 0,
"retention": 0,
"send_actor_headers": true,
"structured_logging": true
}
},
+5
View File
@@ -405,6 +405,7 @@
},
"rate_limit": 0,
"retention": 0,
"send_actor_headers": true,
"structured_logging": true
}
```
@@ -426,6 +427,7 @@
| `openai` | [codersdk.AIBridgeOpenAIConfig](#codersdkaibridgeopenaiconfig) | false | | |
| `rate_limit` | integer | false | | |
| `retention` | integer | false | | |
| `send_actor_headers` | boolean | false | | |
| `structured_logging` | boolean | false | | |
## codersdk.AIBridgeInterception
@@ -771,6 +773,7 @@
},
"rate_limit": 0,
"retention": 0,
"send_actor_headers": true,
"structured_logging": true
}
}
@@ -2695,6 +2698,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
},
"rate_limit": 0,
"retention": 0,
"send_actor_headers": true,
"structured_logging": true
}
},
@@ -3248,6 +3252,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
},
"rate_limit": 0,
"retention": 0,
"send_actor_headers": true,
"structured_logging": true
}
},
+11
View File
@@ -1857,6 +1857,17 @@ Maximum number of AI Bridge requests per second per replica. Set to 0 to disable
Emit structured logs for AI Bridge interception records. Use this for exporting these records to external SIEM or observability systems.
### --aibridge-send-actor-headers
| | |
|-------------|-------------------------------------------------|
| Type | <code>bool</code> |
| Environment | <code>$CODER_AIBRIDGE_SEND_ACTOR_HEADERS</code> |
| YAML | <code>aibridge.send_actor_headers</code> |
| Default | <code>false</code> |
Once enabled, extra headers will be added to upstream requests to identify the user (actor) making requests to AI Bridge. This is only needed if you are using a proxy between AI Bridge and an upstream AI provider. This will send X-Ai-Bridge-Actor-Id (the ID of the user making the request) and X-Ai-Bridge-Actor-Metadata-Username (their username).
### --aibridge-circuit-breaker-enabled
| | |