fix: pass context with authorization to agentapi (#20959)

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.

---------

Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
Callum Styan
2025-11-26 14:53:16 -08:00
committed by GitHub
parent a6a8a060ea
commit d22d34e45b
3 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -69,7 +69,7 @@ type Options struct {
WorkspaceID uuid.UUID
OrganizationID uuid.UUID
Ctx context.Context
AuthenticatedCtx context.Context
Log slog.Logger
Clock quartz.Clock
Database database.Store
@@ -220,7 +220,7 @@ func New(opts Options, workspace database.Workspace) *API {
// Start background cache refresh loop to handle workspace changes
// like prebuild claims where owner_id and other fields may be modified in the DB.
go api.startCacheRefreshLoop(opts.Ctx)
go api.startCacheRefreshLoop(opts.AuthenticatedCtx)
return api
}