Skip to content

tasks: refactor: separate tasks telemetry from workspace builds #1117

Open

Description

@blinkagent

Related to #973

Background

Currently, the presence of AI-generated tasks in a workspace build is tracked via the workspace_builds.has_ai_task column. This approach couples task telemetry with workspace builds and should be refactored to track tasks as independent entities.

Current Implementation

In coder/coder, the telemetry code at coderd/telemetry/telemetry.go converts workspace builds and includes the has_ai_task field:

func ConvertWorkspaceBuild(build database.WorkspaceBuild) WorkspaceBuild {
	// ...
	if build.HasAITask.Valid {
		wb.HasAITask = ptr.Ref(build.HasAITask.Bool)
	}
	return wb
}

Proposed Changes

  1. Remove the has_ai_task field from workspace build telemetry conversion (ConvertWorkspaceBuild)
  2. Implement a separate, dedicated telemetry tracking mechanism for tasks
    • Design TBD: Consider tracking task metadata independently rather than as a boolean on workspace builds
    • Should capture task lifecycle events and metrics separately from build lifecycle
  3. Once the telemetry change is complete, this will allow removal of the workspace_builds.has_ai_task database column (as tracked in tasks: refactor: remove column workspace_builds.has_ai_task #973)

Dependencies

This work depends on:

Considerations

  • The existing SDK usage may remain unchanged for backwards compatibility
  • Task telemetry should provide more granular insights than the current boolean flag
  • Consider what task-specific metrics would be valuable for telemetry (e.g., task creation, completion, failures, types)
  • Removing this telemetry dependency unblocks the database schema cleanup in tasks: refactor: remove column workspace_builds.has_ai_task #973
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions