-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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
- Remove the
has_ai_taskfield from workspace build telemetry conversion (ConvertWorkspaceBuild) - 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
- Once the telemetry change is complete, this will allow removal of the
workspace_builds.has_ai_taskdatabase column (as tracked in tasks: refactor: remove column workspace_builds.has_ai_task #973)
Dependencies
This work depends on:
- Tasks API: Design and implement tasks data model in database #948
- coder terraform provider: modify
coder_ai_taskto add app_id and prompt fields #977
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