Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(coderd): add task prompt modification endpoint#20811

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 12 commits intomainfromdanielle-change-task-prompt-backend
Nov 25, 2025

Conversation

@DanielleMaywood
Copy link
Contributor

@DanielleMaywoodDanielleMaywood commentedNov 18, 2025
edited
Loading

This PR adds the backend implementation for modifying task prompts. Part ofcoder/internal#1084

Changes

  • NewUpdateTaskPrompt database query to update task prompts
  • New PATCH/api/v2/tasks/{task}/prompt endpoint

Notes

This is part 1 of a 2-part PR stack. The frontend UI will be added in a follow-up PR based on this branch (#20812).


🤖 PR was written by Claude Sonnet 4.5 Thinking usingCoder Mux and reviewed by a human 👩

chatgpt-codex-connector[bot] reacted with thumbs up emoji
This adds a new PATCH endpoint to modify the prompt of an existing taskand restart its build. This is the backend implementation including:- New UpdateTaskPrompt database query- New PATCH /api/v2/tasks/{task}/prompt endpoint- Authorization checks for task modification- Database changes to support prompt updates- Generated API documentation and TypeScript types
@DanielleMaywoodDanielleMaywood marked this pull request as draftNovember 18, 2025 00:02
@DanielleMaywoodDanielleMaywood changed the titlefeat(tasks): add task prompt modification endpointfeat(coderd): add task prompt modification endpointNov 18, 2025
Copy link

@chatgpt-codex-connectorchatgpt-codex-connectorbot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewNovember 18, 2025 10:33
return
}

ifreq.Prompt=="" {
Copy link
Member

Choose a reason for hiding this comment

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

I could see this as a use-case, set the prompt to empty for e.g. next start.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Can remove this then

mafredri reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate that use-case? 🤔 I'm not clear on what the agent would do with an empty prompt on next start

Copy link
Member

@mafredrimafredriNov 18, 2025
edited
Loading

Choose a reason for hiding this comment

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

It looks like you need to fill something into the prompt in the UI too, so I’m fine with leaving the check.@ssncferreira my thought was that you might want to start up the task in idle state so that you can interact with agentapi directly, e.g. upload attachments, etc. But you can just as well type ”do nothing” as prompt to achieve that so aligning with UI is fine.

// @Tags Experimental
// @Param user path string true "Username, user ID, or 'me' for the authenticated user"
// @Param task path string true "Task ID" format(uuid)
// @Param request body codersdk.UpdateTaskPromptRequest true "Update task prompt request"
Copy link
Member

Choose a reason for hiding this comment

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

Our terminology is becoming a bit inconsistent here, first you create a task withinput, but then updateprompt which replaces the input/prompt.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Would you prefer renamingprompt toinput here? Happy to do so

Copy link
Member

Choose a reason for hiding this comment

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

Let's go with input to stay consistent 👍🏻

return
}

ifreq.Prompt=="" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate that use-case? 🤔 I'm not clear on what the agent would do with an empty prompt on next start

// Block updates if:
// 1. Job is actively running (pending, running, canceling)
// 2. Workspace is running (job succeeded with start transition)
ifjob.JobStatus==database.ProvisionerJobStatusPending||
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we disallowing prompt update on job pending? In this state, the provisioner hasn't even picked up the workspace build job yet, so it should be safe to update the prompt, correct?

Copy link
Contributor

@ssncferreirassncferreira left a comment

Choose a reason for hiding this comment

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

LGTM ✅
Just some nits, but nothing blocking 🙂

})
}

iftask.Status==database.TaskStatusInitializing||task.Status==database.TaskStatusActive {
Copy link
Contributor

Choose a reason for hiding this comment

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

So this leaves us with: "pending,paused,unknown,error"...should we allow changes onunknown anderror?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'm still happy with removing this entirely but this allows us to change onUnknown andError. The task status is consideredError when you cancel the workspace build, which is what needs to be done to stop it before it starts executing.

As for unknown, I'm on the fence and can be convinced either way 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.

Error could also mean the app is unhealthy. I guess a bigger question is. If a workspace is initializing or active,how is this API intended to be used? Do we cancel the current transition, run a stop transition on the workspace, update the prompt, then start it again?

In this scenario, one could see paused as the only acceptable state where prompt can be updated?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh should I also run a stop transition after the cancel? 👀 My plan was to just cancel the transition (hence why I allow changing on error), update the prompt, and run a start transition again.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@mafredri I've updated the PR and it only allows updating the input when the task is paused.

Copy link
Member

Choose a reason for hiding this comment

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

@DanielleMaywood it's safest to run a stop transition because otherwise there isn't a guarantee the workspace will be in a valid state afterwards.

I think there's another issue related to this that I can't find right now, but the discussion here should give at least some context:#8266



-- name: UpdateTaskPrompt :one
UPDATE
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I understand that the task status is computed from the viewtasks_with_status, so this might not be trivial, but should we change the query to only update the task's prompt if the task is in an allowed status? Otherwise, maybe just adding a comment that we should only update a task's prompt if it is in status 'pending', 'paused', 'unknown', or 'error' (i.e., NOT 'initializing' or 'active').

@ssncferreira
Copy link
Contributor

Also, just a note on the Chromatic CI failed test:OrganizationSidebarView. This was already fixed by#20808

DanielleMaywood reacted with thumbs up emoji

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

The main blocker is still thetask.Status check IMO, it's feels like somewhat arbitrary enforcement due to some states having multiple potential causes. Likeerror could be failed build or unhealthy app (potentially running task, just agentapi failing health check).

Some minor additional feedback inline.

})
}

iftask.Status==database.TaskStatusInitializing||task.Status==database.TaskStatusActive {
Copy link
Member

Choose a reason for hiding this comment

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

Error could also mean the app is unhealthy. I guess a bigger question is. If a workspace is initializing or active,how is this API intended to be used? Do we cancel the current transition, run a stop transition on the workspace, update the prompt, then start it again?

In this scenario, one could see paused as the only acceptable state where prompt can be updated?

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

:shipit:

@DanielleMaywoodDanielleMaywood merged commit82f525b intomainNov 25, 2025
35 checks passed
@DanielleMaywoodDanielleMaywood deleted the danielle-change-task-prompt-backend branchNovember 25, 2025 11:13
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsNov 25, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@mafredrimafredrimafredri approved these changes

@chatgpt-codex-connectorchatgpt-codex-connector[bot]chatgpt-codex-connector[bot] left review comments

@ssncferreirassncferreirassncferreira approved these changes

Assignees

@DanielleMaywoodDanielleMaywood

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@DanielleMaywood@ssncferreira@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp