Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add network calls list to AI session threads API - #27425

Merged
SasSwart merged 5 commits into
mainfrom
aigov-464
Aug 3, 2026
Merged

feat: add network calls list to AI session threads API#27425
SasSwart merged 5 commits into
mainfrom
aigov-464

Conversation

@SasSwart

@SasSwart SasSwart commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

The AI session threads API returned only a network call summary (total/blocked counts + top domains). This adds the per-call list so the session detail can render individual Agent Firewall network calls.

ListAIBridgeSessionNetworkCalls reuses the same sequence-number windowing as the existing summary and includes all protocols. The list is exposed as network_call_logs on the threads response and is capped server-side at 100 rows. The summary (network_calls.total/blocked) remains authoritative for whole-session totals: the list length and its blocked count equal the summary only when a session has at most 100 calls, and are truncated beyond that.

PR map (merge strictly bottom-up)

This change is a 4-PR stack. Each PR depends on all the ones below it, so merge in this exact order:

  1. feat: add network calls summary to AI session threads API #27417 — backend network summary
  2. feat: show network request summary on AI session detail card #27418 — frontend summary rows
  3. feat: add network calls list to AI session threads API #27425 — backend per-call list network_call_logs
  4. feat(site): show network calls list on AI session detail #27426 — frontend network-calls panel

Refs AIGOV-464

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown

AIGOV-464

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@mtojek mtojek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @SasSwart, is this ready for review?

  1. I see some file conflicts.
  2. It looks like this PR isn't just coder/docs, so may need an engeneer's eyes too.

SasSwart added a commit that referenced this pull request Jul 30, 2026
Backend for the AI session network summary. Exposes total/blocked
network calls and top destination domains on the session threads
endpoint (`GET /api/v2/ai-gateway/sessions/{id}`).

Total and blocked reuse the existing Agent Firewall aggregation from the
sessions list query, so the numbers match the sessions table. Top
domains are a new server-side aggregation
(`GetAIBridgeSessionTopDomains`) over boundary logs, using the same
interception-window correlation. There is no network-error state,
matching the current data model.

Frontend consuming these fields is in a separate stacked PR.

### PR map (merge strictly bottom-up)

This change is a 4-PR stack. Each PR depends on all the ones below it,
so merge in this exact order:

1. #27417 — backend network summary (base `main`)
2. #27418 — frontend summary rows (base #27417)
3. #27425 — backend per-call list `network_call_logs` (base #27418)
4. #27426 — frontend network-calls panel (base #27425)

Refs AIGOV-463

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Cian Johnston <[email protected]>
@SasSwart

Copy link
Copy Markdown
Contributor Author

@mtojek It's ready. The conflicts are because I need to rebase onto main after merging the bottom of the stack. It does need an engineer's eyes. Cian has been reviewing lower down in the stack. I'll request his review here as well.

Base automatically changed from aigov-463-frontend to main July 30, 2026 11:23
SasSwart added a commit that referenced this pull request Jul 30, 2026
Frontend for the AI session network summary. Adds Network calls, Blocked
network requests, and Top domains rows to the Session summary card on
the individual AI session detail page, driven by the network fields on
the session threads response.

Renders "Disabled" when network monitoring was not active and "No
activity" when there were no calls. Covered by Storybook stories for
each state.

### PR map (merge strictly bottom-up)

This change is a 4-PR stack. Each PR depends on all the ones below it,
so merge in this exact order:

1. #27417 — backend network summary
2. #27418 — frontend summary rows
3. #27425 — backend per-call list `network_call_logs`
4. #27426 — frontend network-calls panel

Refs AIGOV-463

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Cian Johnston <[email protected]>
SasSwart and others added 3 commits July 30, 2026 11:55
The threads API returned only a network call summary. Add a per-call list
so the session detail can render individual Agent Firewall network calls.
ListAIBridgeSessionNetworkCalls reuses the same sequence-number windowing as
the summary and includes all protocols, so the list length and blocked count
match the summary counts.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…sdk params

Extend the windowing tests to assert the per-call list agrees with the summary:
len(NetworkCallLogs) == Total, blocked count == summary Blocked, correct
sequence ordering, and no cross-session bleed when two AI sessions share a
firewall session. Add a truncation test seeding 105 calls that asserts the list
caps at 100 while the summary Total stays authoritative.

Refactor db2sdk.AIBridgeSessionThreads to take a named-field params struct,
removing the transposable adjacent TopDomains/NetworkCalls positional args.

Refs AIGOV-464

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@SasSwart
SasSwart requested a review from mtojek August 3, 2026 08:52
@SasSwart

SasSwart commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@mtojek would you mind having a look? Cian is out today. This API needs pagination to be effective, but Cian and I agreed to patch that in post release alongside a few other refinements.

@mtojek mtojek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed some time to process the database query, but LGTM 👍

Comment thread codersdk/aibridge.go
// list than NetworkCalls.Total means the list was truncated. Empty when the
// session did not pass through Agent Firewall.
NetworkCallLogs []AgentFirewallLog `json:"network_call_logs,omitempty"`
Threads []AIBridgeThread `json:"threads"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Threads will be always present, right? no need for omitempty ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no omitempty on threads? Only on NetworkCallLogs, which is absent in the case where agent firewall wasn't used.

@SasSwart
SasSwart merged commit 8886a57 into main Aug 3, 2026
32 checks passed
@SasSwart
SasSwart deleted the aigov-464 branch August 3, 2026 09:34
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants