tasks: refactor: separate tasks telemetry from workspace builds
- Dominant language
- No language data
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
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:
```go
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 #973)
## Dependencies
This work depends on:
- #948
- #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 #973
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.