Repository navigation
feat: resolve the chat organization for Coder Agents AI Gateway requests - #31584
Merged
Merged
Conversation
ssncferreira
force-pushed
the
ssncf/aigateway-chat-org
branch
2 times, most recently
from
November 2, 2026 09:40
596bca6 to
bff1632
Compare
ssncferreira
force-pushed
the
ssncf/aigateway-chat-org
branch
4 times, most recently
from
November 2, 2026 10:17
83c9267 to
f7e8428
Compare
ssncferreira
force-pushed
the
ssncf/aigateway-chat-org
branch
9 times, most recently
from
November 2, 2026 12:51
4849d33 to
fe85c08
Compare
ssncferreira
force-pushed
the
ssncf/aigateway-chat-org
branch
7 times, most recently
from
November 2, 2026 13:23
04417e7 to
5fac079
Compare
ssncferreira
marked this pull request as ready for review
November 2, 2026 13:25
mtojek
approved these changes
Nov 2, 2026
SasSwart
approved these changes
Nov 3, 2026
| // Mutually exclusive with key_id. | ||
| string key = 1; | ||
| // key_id authenticates a request without the secret. Used for delegated | ||
| // calls from in-process callers (e.g., chatd) that have already |
Collaborator
There was a problem hiding this comment.
Just noticed that this comment (presumably from my previous PR) is inaccurate. This is not your problem to solve, I'm just pointing it out.
ssncferreira
force-pushed
the
ssncf/aigateway-chat-org
branch
from
November 3, 2026 11:31
5fac079 to
783011a
Compare
ssncferreira
force-pushed
the
ssncf/aigateway-chat-org
branch
from
November 3, 2026 16:08
783011a to
05aaa1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves Coder Agents requests to the chat's organization instead of the organization of the user's effective group, so budgets and cost follow the chat's organization. coderd checks that the user is still a member of that organization and that it isn't deleted, and rejects the request otherwise.
Changes
delegated_organization_idtoIsAuthorizedRequest, part of aibridged API v1.6, which is not released yet.IsAuthorizedaccepts the delegated organization only on delegated (key_id) requests, and rejects it otherwise.chatd, after checking membership. The membership check is shared with the workspace path.TestAuthorization_DelegatedOrgResolution, extendTestServeHTTP_ResolvedOrganizationwith a delegated chat request, and makeTestIntegrationResolvedOrganizationtable-driven, with a case per organization source and a delegated request with a workspace.Closes AIGOV-713
Note
Generated by Coder Agents on behalf of @ssncferreira.