feat: add network calls column to AI sessions table (#27269)

Add a "Total/blocked network calls" column to the AIBridge sessions
table.

Update `ListAIBridgeSessions` query to calculate network called made and
blocked per session. See query plan
[here](https://explain.dalibo.com/plan/54355c90b165ggb4).

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sas Swart
2026-07-21 14:34:23 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent bce9ba3356
commit a9a1dcc65d
14 changed files with 353 additions and 23 deletions
+9
View File
@@ -1114,6 +1114,15 @@ func AIBridgeSession(row database.ListAIBridgeSessionsRow) codersdk.AIBridgeSess
CacheWriteInputTokens: row.CacheWriteInputTokens,
},
}
// NetworkCalls is only meaningful when the session passed through Agent
// Firewall. When it did not, leave it nil so the UI renders "Disabled"
// rather than a misleading zero count.
if row.FirewallActive {
session.NetworkCalls = &codersdk.AIBridgeSessionNetworkCallSummary{
Total: row.NetworkCallsTotal,
Blocked: row.NetworkCallsBlocked,
}
}
// Ensure non-nil slices for JSON serialization.
if session.Providers == nil {
session.Providers = []string{}