mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08: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
+1
@@ -49,6 +49,7 @@ curl -X POST http://coder-server:8080/api/v2/api/experimental/tasks/{user} \
|
||||
|
||||
```json
|
||||
{
|
||||
"display_name": "string",
|
||||
"input": "string",
|
||||
"name": "string",
|
||||
"template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1",
|
||||
|
||||
Generated
+5
@@ -2085,6 +2085,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
|
||||
```json
|
||||
{
|
||||
"display_name": "string",
|
||||
"input": "string",
|
||||
"name": "string",
|
||||
"template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1",
|
||||
@@ -2096,6 +2097,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
|
||||
|
||||
| Name | Type | Required | Restrictions | Description |
|
||||
|------------------------------|--------|----------|--------------|-------------|
|
||||
| `display_name` | string | false | | |
|
||||
| `input` | string | false | | |
|
||||
| `name` | string | false | | |
|
||||
| `template_version_id` | string | false | | |
|
||||
@@ -7805,6 +7807,7 @@ Only certain features set these fields: - FeatureManagedAgentLimit|
|
||||
"timestamp": "2019-08-24T14:15:22Z",
|
||||
"uri": "string"
|
||||
},
|
||||
"display_name": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
"initial_prompt": "string",
|
||||
"name": "string",
|
||||
@@ -7848,6 +7851,7 @@ Only certain features set these fields: - FeatureManagedAgentLimit|
|
||||
|-----------------------------|----------------------------------------------------------------------|----------|--------------|-------------|
|
||||
| `created_at` | string | false | | |
|
||||
| `current_state` | [codersdk.TaskStateEntry](#codersdktaskstateentry) | false | | |
|
||||
| `display_name` | string | false | | |
|
||||
| `id` | string | false | | |
|
||||
| `initial_prompt` | string | false | | |
|
||||
| `name` | string | false | | |
|
||||
@@ -8032,6 +8036,7 @@ Only certain features set these fields: - FeatureManagedAgentLimit|
|
||||
"timestamp": "2019-08-24T14:15:22Z",
|
||||
"uri": "string"
|
||||
},
|
||||
"display_name": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
"initial_prompt": "string",
|
||||
"name": "string",
|
||||
|
||||
Reference in New Issue
Block a user