Skip to content

Conversation

@mafredri
Copy link
Member

@mafredri mafredri commented Oct 27, 2025

Depends on coder/sqlc#1
Fixes coder/internal#979
Updates coder/internal#973

Notes:

  • The updated query here requires a patch sqlc, without the patch it incorrectly identifies ambigious columns.
    • queries/workspaces.sql:401:13: column reference "owner_id" is ambiguous (false positive)

@mafredri mafredri force-pushed the mafredri/fix-coderd-replace-ai-promp branch 4 times, most recently from 483371e to b3dd0e7 Compare October 28, 2025 14:47
@mafredri mafredri requested review from DanielleMaywood and johnstcn and removed request for DanielleMaywood October 28, 2025 14:47
@mafredri mafredri marked this pull request as ready for review October 28, 2025 14:47
-- Consider all tasks, deleting a task does not turn the
-- workspace into a non-task workspace.
tasks.workspace_id = workspaces.id
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Review: This here breaks with un-patched sqlc because it puts tasks.owner_id in global scope even though it's not selected.

Should we fork sqlc for now?

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with forking sqlc temporarily while an upstream bug is filed. I wonder if there's also the possibility of selecting id, workspace_id from tasks in a CTE and doing the join on that?

Copy link
Member

Choose a reason for hiding this comment

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

Can you drop the original bugged sql query? I'm curious to see what the failing/bugged query looked like.

Copy link
Member Author

@mafredri mafredri Oct 29, 2025

Choose a reason for hiding this comment

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

@Emyrk This edit IS the bugged query, but check the added testdata in coder/sqlc#1 to see more.

Comment on lines +50 to +57
}).
WithAgent().
WithTask(database.TaskTable{
Prompt: prompt,
}, nil).
Do()

return build.Task
Copy link
Member

Choose a reason for hiding this comment

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

❤️

Comment on lines -1024 to -1027
r.Route("/aitasks", func(r chi.Router) {
r.Use(apiKeyMiddleware)
r.Get("/prompts", api.aiTasksPrompts)
})
Copy link
Member

Choose a reason for hiding this comment

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

I'm potentially concerned about this given our "one minor release" backward compat guarantee. Maybe mark this endpoint deprecated instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Was this ever used by anything other than the frontend? Considering the route is experimental and you can't run an old coderd with a newer frontend, I imagined this should be fine.

Copy link
Member

Choose a reason for hiding this comment

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

Not that I'm aware, no. I guess we can remove it with the provisio that this was always under /api/experimental.

mafredri added a commit that referenced this pull request Oct 29, 2025
mafredri added a commit that referenced this pull request Oct 29, 2025
mafredri added a commit that referenced this pull request Oct 29, 2025
mafredri added a commit that referenced this pull request Oct 29, 2025
mafredri added a commit that referenced this pull request Oct 29, 2025
mafredri added a commit that referenced this pull request Oct 29, 2025
@mafredri mafredri force-pushed the mafredri/fix-coderd-replace-ai-promp branch from b3dd0e7 to e592af3 Compare October 29, 2025 16:48
@mafredri mafredri enabled auto-merge (squash) October 29, 2025 18:39
@mafredri mafredri merged commit 859e94d into main Oct 29, 2025
28 checks passed
@mafredri mafredri deleted the mafredri/fix-coderd-replace-ai-promp branch October 29, 2025 18:59
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 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.

chore: tasks: replace exising usage of hard-coded "AI Prompt" parameter with tasks.prompt

5 participants