mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: surface agent firewall correlation in AI Bridge sessions API (#26416)
Add `agent_firewall_session_id` and `agent_firewall_sequence_number`
fields to `AIBridgeThread` in the `GET
/api/v2/aibridge/sessions/{session_id}` response. These fields link each
thread to its agent firewall confinement session so the frontend can
discover the boundary session and compute sequence ranges for
interleaving firewall events within the thread timeline.
The database columns already exist on `aibridge_interceptions`
(migration 000520) and are already selected by
`ListAIBridgeSessionThreads`. This PR surfaces them through the SDK type
and the `db2sdk` conversion.
Depends on #24814
**Naming note:** The RFC uses `boundary_session_id` /
`boundary_sequence_number`, but the codebase standardized on
`agent_firewall_*` naming in the DB migration. The API fields follow the
existing convention.
</details>
> [!NOTE]
> This PR was authored by Coder Agents.
This commit is contained in:
Generated
+9
@@ -15141,6 +15141,15 @@ const docTemplate = `{
|
||||
"codersdk.AIBridgeThread": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_firewall_sequence_number": {
|
||||
"description": "AgentFirewallSequenceNumber is the firewall sequence number from\nthe root interception. Used to determine the position of this\nLLM request in the firewall event stream. Nil when the request\ndid not pass through the agent firewall.",
|
||||
"type": "integer"
|
||||
},
|
||||
"agent_firewall_session_id": {
|
||||
"description": "AgentFirewallSessionID links this thread to an agent firewall\nconfinement session. Nil when the request did not pass through\nthe agent firewall.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"agentic_actions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
Generated
+9
@@ -13489,6 +13489,15 @@
|
||||
"codersdk.AIBridgeThread": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_firewall_sequence_number": {
|
||||
"description": "AgentFirewallSequenceNumber is the firewall sequence number from\nthe root interception. Used to determine the position of this\nLLM request in the firewall event stream. Nil when the request\ndid not pass through the agent firewall.",
|
||||
"type": "integer"
|
||||
},
|
||||
"agent_firewall_session_id": {
|
||||
"description": "AgentFirewallSessionID links this thread to an agent firewall\nconfinement session. Nil when the request did not pass through\nthe agent firewall.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"agentic_actions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
@@ -1274,6 +1274,14 @@ func buildAIBridgeThread(
|
||||
if prompts := promptsByInterception[rootIntc.ID]; len(prompts) > 0 {
|
||||
thread.Prompt = &prompts[0].Prompt
|
||||
}
|
||||
if rootIntc.AgentFirewallSessionID.Valid {
|
||||
id := rootIntc.AgentFirewallSessionID.UUID
|
||||
thread.AgentFirewallSessionID = &id
|
||||
}
|
||||
if rootIntc.AgentFirewallSequenceNumber.Valid {
|
||||
n := rootIntc.AgentFirewallSequenceNumber.Int32
|
||||
thread.AgentFirewallSequenceNumber = &n
|
||||
}
|
||||
}
|
||||
|
||||
// Compute thread time bounds from interceptions.
|
||||
|
||||
Reference in New Issue
Block a user