Skip to content

refactor: use typed AI Gateway actor identity - #30258

Merged
pawbana merged 4 commits into
mainfrom
pawel/issue-29726-actor
Oct 5, 2026
Merged

pawbana merged 4 commits into
mainfrom
pawel/issue-29726-actor

Conversation

@pawbana

@pawbana pawbana commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Adds typed AI Gateway actor identity, including the API key ID used by recording.

Recorders now read the authenticated API key ID from each call context instead of capturing request identity at construction time. This allows one recorder to be reused safely across sequential and concurrent requests. Includes context helper coverage and recorder regression tests.

Generated by Coder Agents on behalf of @pawbana.

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

👍

Base automatically changed from pawel/issue-29726-recorder to main October 2, 2026 14:18
@pawbana
pawbana force-pushed the pawel/issue-29726-actor branch from c8668a7 to a0f50fb Compare October 2, 2026 20:38
@pawbana
pawbana requested a review from SasSwart October 5, 2026 08:06
Comment thread aibridge/context/context.go Outdated
ID uuid.UUID
APIKeyID string
Username string
// Email is only used when forwarding configured actor headers. It must not

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No explanation justifying this (GDPR?) nor protections are in place. Maybe we should make this unexported in that case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added here: #29930
My understanding of the linked issue is that this is just how feature should work, not necessarily about privacy / GDRP.
Changes to comment are due to AI being overzealous. Shortened it a bit.


// APIKeyIDFromContext returns the actor's API-key ID, or ErrMissingAPIKeyID if
// the actor is absent or its API-key ID is empty.
func APIKeyIDFromContext(ctx context.Context) (string, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: feels incongruous with other FromContext funcs since it returns an error.

@pawbana
pawbana enabled auto-merge (squash) October 5, 2026 13:53
@pawbana
pawbana merged commit ffc7dad into main Oct 5, 2026
29 checks passed
@pawbana
pawbana deleted the pawel/issue-29726-actor branch October 5, 2026 14:00
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 5, 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