-
Notifications
You must be signed in to change notification settings - Fork 979
fix(coderd): filter out non-task workspaces in api.tasksList #19559
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
Conversation
coderd/aitasks.go
Outdated
filtered = append(filtered, ws) | ||
} | ||
} | ||
tasks, err := api.tasksFromWorkspaces(ctx, filtered) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it’s worth finding a proper fix for this as filtering here breaks pagination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could always add the filter has-ai-task:true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already do that 🤔
I suspect this is the root cause
So we're potentially returning workspaces that do not yet have |
@DanielleMaywood that does indeed look like it would be the culprit. We definitely need to improve how tasks are detected so there can't be any flip-flopping between states. |
Honestly I think the 'correct' fix here is to have tasks defined separately to workspaces. |
I definitely agree. I don't think that excludes an interim fix, though. For now we could relax the "ai task" constraint to match that of the query. I.e. in
|
83eb368
to
81fb1d5
Compare
Sounds good to me, it appears to work locally also:
|
Quick fix for following issue in CLI:
This occurs in a short time window directly after creating a new task.
I took a stab at writing a test for this, but ran out of time. I'm not entirely sure what causes non-AI-task workspaces to be returned in the query but I suspect it's when a workspace build is pending or running.