Skip to content

Tasks: Notification templates for pause/resume #1260

Closed
coder/coder
#22050

Description

@mafredri

Repo: coder/coder

Scope: Add notification templates so users are notified when their tasks pause or resume.

Changes:

  • Add TemplateTaskPaused UUID to coderd/notifications/events.go
  • Add TemplateTaskResumed UUID to coderd/notifications/events.go
  • Create notification template files with appropriate messaging
  • Trigger TemplateTaskPaused from pause code paths (auto and manual)
  • Trigger TemplateTaskResumed from resume code path

Template variables (suggested, follow existing notification patterns in coderd/notifications/templates/):

  • TaskName: Name of the task
  • TaskURL: Direct link to task page
  • WorkspaceName: Underlying workspace name
  • PauseReason: "idle timeout" or "manual" (for pause notification)
  • UserName: Task owner's username

Note: Review existing task notification templates (TemplateTaskWorking, TemplateTaskIdle, etc.) for consistent variable naming.

Trigger points:

  • Auto-pause: Lifecycle executor when stopping workspace with task_auto_pause reason
  • Manual pause: POST /tasks/{task}/pause endpoint handler
  • Resume: POST /tasks/{task}/resume endpoint handler

Files:

  • coderd/notifications/events.go
  • coderd/notifications/templates/ (new templates)
  • coderd/autobuild/lifecycle_executor.go (auto-pause trigger)
  • coderd/aitasks.go (manual pause/resume triggers)

Acceptance criteria:

  • User notified when task is paused (auto or manual)
  • User notified when task is resumed
  • Notifications work via email and webhook delivery methods
  • Notification content distinguishes auto vs manual pause
  • Task URL in notification links directly to task page

Dependencies:

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions