coder / coder/internal

Tasks: Server-side input queue for auto-resume

Open
#1,272 0 comments 0 reactions 0 assignees View on GitHub
project/tasks
Dominant language
No language data
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

**Repo**: `coder/coder`

**Scope**: Allow `/send` to accept messages for paused tasks, queue them, and deliver asynchronously.

**Note**: Consider ACP (Agent Communication Protocol) impact before implementation. ACP standardization may influence message queue design and delivery mechanism.

**Changes**:
- Create `task_pending_inputs` table:
- `id` UUID PRIMARY KEY
- `task_id` UUID REFERENCES tasks(id)
- `content` TEXT NOT NULL
- `status` TEXT NOT NULL DEFAULT 'pending'
- `created_at` TIMESTAMPTZ NOT NULL
- `delivered_at` TIMESTAMPTZ
- `error` TEXT
- Modify `/send` to accept messages for paused tasks
- Return 202 Accepted with message ID for queued messages
- Background worker: trigger workspace start, poll for ready, deliver message, update status
- Handle failures (build fails, delivery fails) with appropriate status updates

**Benefits beyond auto-resume** (per RFC):
- Solves Terraform env var length limits for long prompts
- Unifies initial prompt + follow-up delivery path
- Enables prompt modification until task starts
- Enables prebuilds for tasks

**Files**:
- New migration for `task_pending_inputs` table
- `coderd/aitasks.go` (modified send handler)
- New background worker or integration with existing job system

**Acceptance criteria**:
- [ ] `/send` to paused task returns 202 and queues message
- [ ] Workspace automatically starts
- [ ] Message delivered when workspace ready
- [ ] Failure states handled gracefully with status tracking
- [ ] Direct API consumers no longer need orchestration logic

**Dependencies**:
- GA phase complete
- ACP (Agent Communication Protocol) evaluation (does not block, but may influence design)

**References**:
- [PRD: Start/Pause/Resume the Task Workspace](https://www.notion.so/coderhq/Start-Pause-Resume-the-Task-Workspace-2aad579be59280e5a15ef6bb6a93f246)
- [RFC: Tasks: Start/Pause/Resume Lifecycle](https://www.notion.so/coderhq/Tasks-Start-Pause-Resume-Lifecycle-2cdd579be592805a929fc36d0c82d65d): Auto-Resume Option B

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.