Skip to content

feat(coderd): send the chat organization in Coder Agents AI Gateway requests - #31583

Merged
ssncferreira merged 1 commit into
mainfrom
ssncf/agents-chat-org
Nov 3, 2026
Merged

ssncferreira merged 1 commit into
mainfrom
ssncf/agents-chat-org

Conversation

@ssncferreira

@ssncferreira ssncferreira commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Every Coder Agents chat belongs to an organization, but its AI Gateway requests don't carry it. AI Gateway instead uses the organization of the user's cost control effective group, which can be a different one. So a chat in org A can have its budget and cost attributed to org B. This PR makes Coder Agents send the chat's organization with its delegated attribution, so AI Gateway can use the chat's organization for the whole request. AI Gateway starts using it in the next PR in this stack, so behaviour doesn't change here.

Changes

  • Add DelegatedOrganizationID to aibridge.Attribution, and fix the WorkspaceID comment, which applies to workspace session tokens too.
  • Set it from the chat in newModel when routing Coder Agents requests through AI Gateway.
  • Extend TestNewModelAttributionImmutablePerRequest to check the organization.

Related to AIGOV-713

Note

Generated by Coder Agents on behalf of @ssncferreira.

@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown

AIGOV-713

@ssncferreira
ssncferreira added this pull request to stack #31585 October 30, 2026 17:06
@ssncferreira
ssncferreira force-pushed the ssncf/agents-chat-org branch 5 times, most recently from 3dc9a1a to 146f85f Compare November 2, 2026 12:51
@ssncferreira
ssncferreira marked this pull request as ready for review November 2, 2026 13:23

@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.

LGTM!

@ssncferreira
ssncferreira force-pushed the ssncf/agents-chat-org branch from 146f85f to 80a107c Compare November 3, 2026 11:31
@ssncferreira
ssncferreira force-pushed the ssncf/agents-chat-org branch from 80a107c to e70bc66 Compare November 3, 2026 16:08
@ssncferreira
ssncferreira merged commit 8d5026c into main Nov 3, 2026
28 of 29 checks passed
@ssncferreira
ssncferreira deleted the ssncf/agents-chat-org branch November 3, 2026 16:39
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 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.

3 participants