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
+2
View File
@@ -191,6 +191,8 @@ curl -X GET http://coder-server:8080/api/v2/aibridge/sessions/{session_id} \
"started_at": "2019-08-24T14:15:22Z",
"threads": [
{
"agent_firewall_sequence_number": 0,
"agent_firewall_session_id": "3735294f-18b1-4e7a-a269-99c30f0b30e7",
"agentic_actions": [
{
"model": "string",
+18 -12
View File
@@ -654,6 +654,8 @@
"started_at": "2019-08-24T14:15:22Z",
"threads": [
{
"agent_firewall_sequence_number": 0,
"agent_firewall_session_id": "3735294f-18b1-4e7a-a269-99c30f0b30e7",
"agentic_actions": [
{
"model": "string",
@@ -791,6 +793,8 @@
```json
{
"agent_firewall_sequence_number": 0,
"agent_firewall_session_id": "3735294f-18b1-4e7a-a269-99c30f0b30e7",
"agentic_actions": [
{
"model": "string",
@@ -850,18 +854,20 @@
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------------|----------------------------------------------------------------------------------------|----------|--------------|-------------|
| `agentic_actions` | array of [codersdk.AIBridgeAgenticAction](#codersdkaibridgeagenticaction) | false | | |
| `credential_hint` | string | false | | |
| `credential_kind` | string | false | | |
| `ended_at` | string | false | | |
| `id` | string | false | | |
| `model` | string | false | | |
| `prompt` | string | false | | |
| `provider` | string | false | | |
| `started_at` | string | false | | |
| `token_usage` | [codersdk.AIBridgeSessionThreadsTokenUsage](#codersdkaibridgesessionthreadstokenusage) | false | | |
| Name | Type | Required | Restrictions | Description |
|----------------------------------|----------------------------------------------------------------------------------------|----------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `agent_firewall_sequence_number` | integer | false | | Agent firewall sequence number is the firewall sequence number from the root interception. Used to determine the position of this LLM request in the firewall event stream. Nil when the request did not pass through the agent firewall. |
| `agent_firewall_session_id` | string | false | | Agent firewall session ID links this thread to an agent firewall confinement session. Nil when the request did not pass through the agent firewall. |
| `agentic_actions` | array of [codersdk.AIBridgeAgenticAction](#codersdkaibridgeagenticaction) | false | | |
| `credential_hint` | string | false | | |
| `credential_kind` | string | false | | |
| `ended_at` | string | false | | |
| `id` | string | false | | |
| `model` | string | false | | |
| `prompt` | string | false | | |
| `provider` | string | false | | |
| `started_at` | string | false | | |
| `token_usage` | [codersdk.AIBridgeSessionThreadsTokenUsage](#codersdkaibridgesessionthreadstokenusage) | false | | |
## codersdk.AIBridgeToolCall