-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Repo: coder/coder
Scope: Modify coder tasks send to automatically resume paused tasks before delivering message.
Changes:
- Attempt to send message to task
- If 409 response (task paused):
- Print "Task is paused. Resuming (this may take a moment)..."
- Call
POST /tasks/{task}/resumeendpoint - Poll task status until active or build fails (see Polling logic below)
- Show build progress via
cliui.WorkspaceBuild() - Retry send when task is active
- Print "Input sent." on success
Polling logic:
- Poll task status every 5 seconds
- Exit loop when
task.Status == "active"(workspace running, agent ready, AgentAPI responding) - Exit loop on terminal build failure (job status is failed/canceled)
Error handling:
- 409 on send, resume build fails: Print build failure details, exit with code 1
- 409 on send, resume succeeds, retry send fails: Print send error (network/AgentAPI issue), exit with code 1
- Non-409 send error: Print error, exit with code 1 (no resume attempted)
Files:
cli/task.gocli/task_test.go
Acceptance criteria:
- Send to active task works normally (no change in behavior)
- Send to paused task receives 409, triggers resume, waits for active, retries send
- Build progress displayed during resume via
cliui.WorkspaceBuild() - Polling exits when task.Status == "active" and send succeeds
- Terminal build failure stops polling and shows build error
- Retry send failure after successful resume shows send error (not resume error)
- All error messages are actionable and clear
Dependencies:
References:
- PRD: Start/Pause/Resume the Task Workspace
- RFC: Tasks: Start/Pause/Resume Lifecycle: CLI, Auto-Resume Option A