mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: add display name field for tasks (#20856)
## Problem Tasks currently only expose a machine-friendly name field (e.g. `task-python-debug-a1b2`), but this value is primarily an identifier rather than a clean, descriptive label. We need a separate display-friendly name for use in the UI. This PR introduces a new `display_name` field and updates the task-name generation flow. The Claude system prompt was updated to return valid JSON with both `name` and `display_name`. The name generation logic follows a fallback chain (Anthropic > prompt sanitization > random fallback). To make task names more closely resemble their display names, the legacy `task-` prefix has been removed. For context, PR https://github.com/coder/coder/pull/20834 introduced a small Task icon to the workspace list to help identify workspaces associated to tasks. ## Changes - Database migration: Added `display_name` column to tasks table - Updated system prompt to generate both task name and display name as valid JSON - Task name generation now follows a fallback chain: Anthropic > prompt sanitization > random fallback - Removed `task-` prefix from task names to allow more descriptive names - Note: PR https://github.com/coder/coder/pull/20834 adds a Task icon to workspaces in the workspace list to distinguish task-created workspaces **Note:** UI changes will be addressed in a follow-up PR Related to: https://github.com/coder/coder/issues/20801
This commit is contained in:
Generated
+5
-1
@@ -1826,9 +1826,12 @@ CREATE TABLE tasks (
|
||||
template_parameters jsonb DEFAULT '{}'::jsonb NOT NULL,
|
||||
prompt text NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL,
|
||||
deleted_at timestamp with time zone
|
||||
deleted_at timestamp with time zone,
|
||||
display_name character varying(127) DEFAULT ''::character varying NOT NULL
|
||||
);
|
||||
|
||||
COMMENT ON COLUMN tasks.display_name IS 'Display name is a custom, human-friendly task name.';
|
||||
|
||||
CREATE VIEW visible_users AS
|
||||
SELECT users.id,
|
||||
users.username,
|
||||
@@ -1964,6 +1967,7 @@ CREATE VIEW tasks_with_status AS
|
||||
tasks.prompt,
|
||||
tasks.created_at,
|
||||
tasks.deleted_at,
|
||||
tasks.display_name,
|
||||
CASE
|
||||
WHEN (tasks.workspace_id IS NULL) THEN 'pending'::task_status
|
||||
WHEN (build_status.status <> 'active'::task_status) THEN build_status.status
|
||||
|
||||
Reference in New Issue
Block a user