Skip to content

Conversation

@cstyan
Copy link
Contributor

@cstyan cstyan commented Nov 26, 2025

The agentapi context needs to be a context with some amount of authorization attached to it via the context so that the cache refresh routine can fetch the workspace from the db via GetWorkspaceForAgentID.

authorization attached to it via the context so that the cache refresh
routine can fetch the workspace from the db via GetWorkspaceForAgentID

Signed-off-by: Callum Styan <callumstyan@gmail.com>
OrganizationID: workspace.OrganizationID,

Ctx: api.ctx,
Ctx: ctx,
Copy link
Member

Choose a reason for hiding this comment

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

I think this context is only used in startCacheRefreshLoop?

If so, we can rename Ctx to like AuthenticatedCtx or something akin to that? So users of it know what it carries?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, it's not passed to any of the sub API's and afaict none of the other functions directly on the API use it either.

Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyan cstyan changed the title bug: pass context with authorization to agentapi fix: pass context with authorization to agentapi Nov 26, 2025
Signed-off-by: Callum Styan <callumstyan@gmail.com>
// This ensures that changes like prebuild claims (which modify owner_id, name, etc.)
// are eventually reflected in the cache without requiring agent reconnection.
func (a *API) refreshCachedWorkspace(ctx context.Context) {
a.opts.Log.Debug(ctx, "refreshing cached workspace", slog.F("test", "test"))
Copy link
Member

Choose a reason for hiding this comment

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

Accidental log? test:test

Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyan cstyan merged commit d22d34e into main Nov 26, 2025
30 checks passed
@cstyan cstyan deleted the callum/agentapi-cache-ctx branch November 26, 2025 22:53
@github-actions github-actions bot locked and limited conversation to collaborators Nov 26, 2025
@Emyrk Emyrk added the cherry-pick/v2.29 Needs to be cherry-picked to the 2.29 release branch label Nov 27, 2025
@cstyan cstyan removed the cherry-pick/v2.29 Needs to be cherry-picked to the 2.29 release branch label Dec 1, 2025
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