- Notifications
You must be signed in to change notification settings - Fork1.1k
feat: add display name field for tasks#20856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
976ef82 to64b6b10Compare| -- Recreate view without the display_name column. | ||
| -- This restores the view to its previous state after removing display_name from tasks. | ||
| CREATE VIEW |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It seems adding the view recreation is required on both migrations, because otherwise sqlc would not generate the Task structure withDisplayName on up. AFAIU, since our queries all usetasks_with_status view and not thetasks table, PostgreSQL doesn't automatically update the view definition. That is why we need to force PostgreSQL to re-expand thetasks.* wildcard and pick up the new column. Let me know if there is a cleaner way of doing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Unfortunately this is the way ™️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We need to get this implemented in our sqlc fork:Emyrk/sqlc#1
64b6b10 to9ecbe62CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
coderd/taskname/taskname.go Outdated
| returnaisdk.AnthropicToDataStream(client.Messages.NewStreaming(ctx, anthropic.MessageNewParams{ | ||
| Model:model, | ||
| MaxTokens:24, | ||
| MaxTokens:50, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Did you hit the limit of 24? I'm not entirely sure what this limit should be but just want to make sure we're not at risk of running over
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yeah, I hit the limit with 24 😕 the JSON would be incomplete and parsing would fail. I bumped it to 50 after testing with the maximum characters we could generate.
According toAnthropic's documentation, Claude uses approximately 3.5 characters per token for English text. Our max output is:
- Base JSON structure: {"task_name":"","display_name":""} = 43 chars
- Task name: 27 chars max
- Display name: 64 chars max
- Total: 134 characters ≈ 38 tokens
So, I guess 50 tokens gives us a comfortable buffer above the theoretical max, accounting for tokenization variance and any extra whitespace Claude might add 🤷♀️
ssncferreiraNov 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@DanielleMaywood How did you come up with 24 the first time? 🤔
I can add these calculations as a comment if that helps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I used one of those tools that tells you how many tokens are in a message, added a few for leeway and doubled it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I tested the max output with anthropics token counting API:https://platform.claude.com/docs/en/build-with-claude/token-counting#count-tokens-in-basic-messages
It seems this endpoint is for input messages, but I assume the tokenization should be identical for both input and output. The endpoint returned 70 tokens, so I've updated this to be 100 for a safety buffer:39d3805
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
coderd/aitasks.go Outdated
| } | ||
| generatedTaskName:=taskname.Generate(ctx,req.Input) | ||
| taskName=generatedTaskName.Name | ||
| displayName=generatedTaskName.DisplayName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This behavior will be a bit weird if the user specifies a name. There's two options as I see it:
- Allow them to manually specify it in the request
- Always generate name/display name, only assign name if empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good catch, I completely missed that! I've updated the code to allow setting a display name as well. Now if either field is not provided, we generate both and use the generated value for the missing field. Addressed in:75277dc
coderd/aitasks.go Outdated
| displayName:=dbTask.DisplayName | ||
| ifdisplayName=="" { | ||
| // Fallback for tasks created before display_name column was added. | ||
| // Use the prompt as display name, truncated to match display name limits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If we don't make a change to the logic above, it also applies to tasks created with a predefined name.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
DanielleMaywood left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm happy with this. We also have time before code-freeze/release to address any issues if they pop up
mafredri left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'd like for us to surface generate errors some way, but other than that there are no blockers on my end. Nice work. 👍🏻
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
3011207 intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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_namefield and updates the task-name generation flow. The Claude system prompt was updated to return valid JSON with bothnameanddisplay_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 legacytask-prefix has been removed. For context, PR#20834 introduced a small Task icon to the workspace list to help identify workspaces associated to tasks.Changes
display_namecolumn to tasks tabletask-prefix from task names to allow more descriptive namesNote: UI changes will be addressed in a follow-up PR
Related to:#20801