Files
coder/coderd/database/migrations/000520_aibridge_agent_firewall_session.up.sql
T
Sas Swart e1c7e61eb9 feat(coderd): add Agent Firewall correlation columns to aibridge_interceptions (#24817)
Add `agent_firewall_session_id` (UUID NULL) and
`agent_firewall_sequence_number` (INT NULL) to `aibridge_interceptions`
with a partial index on `agent_firewall_session_id`. No FK to
`boundary_sessions` (soft reference, resolved at query time).
`RecordInterception` reads the new fields from the proto request (merged
in #25884) via `parseOptionalUUID` / `parseOptionalInt32` helpers.

> This PR was authored by Coder Agents.
2026-06-15 12:34:16 +02:00

16 lines
1021 B
SQL

-- No FK to agent firewall sessions: Bridge interceptions may be recorded
-- before the session row exists, since Agent Firewall log delivery is async.
-- agent_firewall_session_id is a soft reference resolved at query time.
ALTER TABLE aibridge_interceptions
ADD COLUMN agent_firewall_session_id UUID NULL,
ADD COLUMN agent_firewall_sequence_number INT NULL;
COMMENT ON COLUMN aibridge_interceptions.agent_firewall_session_id IS
'The Agent Firewall session ID, linking this Bridge interception to an Agent Firewall confinement session.';
COMMENT ON COLUMN aibridge_interceptions.agent_firewall_sequence_number IS
'The Agent Firewall sequence number from the request header. Used to determine exact ordering of network requests relative to Agent Firewall audit events. NULL when the request did not pass through Agent Firewall.';
CREATE INDEX idx_aibridge_interceptions_agent_firewall_session_id
ON aibridge_interceptions (agent_firewall_session_id)
WHERE agent_firewall_session_id IS NOT NULL;