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:
Sas Swart
2026-06-22 15:17:37 +02:00
committed by GitHub
parent 335d6bda1b
commit adad5bdd49
8 changed files with 115 additions and 12 deletions
+8
View File
@@ -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.