feat: allow sending follow-up prompts to a task when resuming#22302
feat: allow sending follow-up prompts to a task when resuming#22302
Conversation
Documentation CheckNew Documentation Needed
Updates Needed
Automated review via Coder Tasks |
|
Nice work @SasSwart, I haven't reviewed yet, but I looked at the video and some thoughts came to mind:
And finally, very cool seeing this work end-to-end, nice! I think until we add a proper queueing system via coderd, we should mention that refreshing or leaving the page will dismiss the follow-up message (unless I'm mistaken). |
1815224 to
f5acd1a
Compare
dece9fc to
e88d2dc
Compare
mafredri
left a comment
There was a problem hiding this comment.
Core flow looks good, nice work.
One thing I noticed but did not verify by testing, once we enter the startup logs streaming starting phase, we lose access to the follow up dialogue if we've dismissed it? I think it'd make sense to show the button there as well.
| r.Post("/send", api.taskSend) | ||
| r.Get("/logs", api.taskLogs) | ||
| r.Post("/pause", api.pauseTask) | ||
| r.Post("/resume", api.resumeTask) |
There was a problem hiding this comment.
This seems like it should be done in a separate PR?
There was a problem hiding this comment.
Lucky for us It has since been done in a separate PR:
#22544
I'll rebase this, then the change should disappear from this PR
| const taskRouteKey = `${username}/${taskId}`; | ||
| const prevTaskRouteKeyRef = useRef(taskRouteKey); | ||
| const queryClient = useQueryClient(); | ||
| const resumeFollowUpMutation = useMutation({ |
There was a problem hiding this comment.
This creates a second resume mutation independent from resumeMutation. Neither disables the other's button, so a user can fire both concurrently. Could we pass isFollowUpSending down to disable the Resume button, or unify into one resume path?
| ).toBeInTheDocument(); | ||
| }); | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Nice coverage overall. A few gaps you could consider filling:
resumeTaskrejecting (500) during the follow-up flow (different path than build failure)- Error recovery: error state -> reopen dialog -> resubmit -> success
6b39f93 to
2617d38
Compare
Could you expand on this a little? Keep in mind my skillset is a little biased towards backend work, so the trade-offs you mention might just be ignorance on my part. I'm happy to make this better if I can. |
- Disable Resume button when follow-up flow is in progress to prevent concurrent resume requests. - Add 'sending' stage to early-return guard in queueFollowUp to prevent re-triggering the resume flow while already sending. - Use task?.status instead of full task object in useEffect dependency array to avoid unnecessary re-evaluations on every poll. - Remove unused sendTaskInput mocks from TaskFollowUpShowsResumingProgress and TaskFollowUpResumeBuildFailure stories. - Replace findBy queries inside waitFor blocks with getBy queries since waitFor already handles retrying.
24436e6 to
faa3c7e
Compare
Summary
This PR adds a follow-up flow for paused Tasks so users can submit another prompt as part of resuming the same task/session.
Screen.Recording.2026-02-25.at.15.17.54.mov
What changed
Task page UX
FollowUpDialogto collect and submit follow-up input.Follow-up flow behavior
active, then send input.Stable API route parity
POST /tasks/{user}/{task}/pauseandPOST /tasks/{user}/{task}/resumeto the stable/api/v2/tasksrouter block.SDK alignment
codersdkpause/resume methods to use stable/api/v2/tasks/...endpoints instead of/api/experimental/....Frontend API/query alignment
sitetask pause/resume/send paths are on stable/api/v2/tasks/....Storybook coverage
Closes coder/internal#1269