Skip to content

fix(coderd/provisionerdserver): ensure that SidebarAppID is a known workspace app #19123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: cj/chore/provisionerdserver-no-disable-foreign-key-checks
Choose a base branch
from

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Aug 2, 2025

Relates to #18776

Applies a quick and dirty 'workaround' when the sidebar app ID references an unknown app ID for the build.

@johnstcn johnstcn self-assigned this Aug 2, 2025
@johnstcn johnstcn changed the title fix(coderd/provisionerdserver): ensure that SidebarAppID is a known w… fix(coderd/provisionerdserver): ensure that SidebarAppID is a known workspace app Aug 2, 2025
Copy link
Contributor

@hugodutka hugodutka left a comment

Choose a reason for hiding this comment

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

I reproduced the issue and can confirm that this fix allows the workspace build to complete. I'm concerned, though, that it hides the error from the user. We have a report from a user who ran into this during the start transition, and with this fix, the task will immediately disappear from the UI list after creation, which will be confusing. Still, I suppose that's better than leaving the workspace in a failed, stuck state.

@@ -1959,18 +1970,33 @@ func (s *server) completeWorkspaceBuildJob(ctx context.Context, job database.Pro
sidebarAppID = uuid.NullUUID{UUID: id, Valid: true}
}

// NOTE(Cian): If stopping a workspace build, we must ensure that the
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd also note that this is a hack to get around a fatal error triggered by the bug I described here: #18776 (comment)

// 'silently' not configured as an AI task except for a warning in the logs.
// Ideally, we should also accept an app slug as these are less likely to change.
if sidebarAppID.Valid && !slices.Contains(knownAppIDs, sidebarAppID.UUID.String()) {
s.Logger.Warn(ctx, "workspace build has unknown sidebar app ID",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd reference the issue in the log. A user has reported this problem also occurring during the start transition. With this fix, after a user spawns a task, they'll see it immediately disappear after creation and will wonder where it went. When they look at server logs, let's explain the problem and point them where to look next.

Suggested change
s.Logger.Warn(ctx, "workspace build has unknown sidebar app ID",
s.Logger.Error(ctx, "task creation failed. Workspace build has unknown sidebar app ID - this is a known issue. See https://github.com/coder/coder/issues/18776 for a workaround.",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants