Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(coderd): generate task names based on their prompt#19335

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

Merged

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywoodDanielleMaywood commentedAug 13, 2025
edited
Loading

Closes#18159

If an Anthropic API key is available, we call out to Claude to generate a task name based on the user-provided prompt instead of our random name generator.

A question I have: Should we have an option to disable this even with an API key present? Or should we make this featureopt in even with an API key being present?

@DanielleMaywoodDanielleMaywood changed the titleDanielle/tasks/generate task name on coderdfeat(coderd): generate task names based on their promptAug 13, 2025
@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewAugust 19, 2025 10:42
}

return aisdk.AnthropicToDataStream(client.Messages.NewStreaming(ctx, anthropic.MessageNewParams{
Model: anthropic.ModelClaude3_5HaikuLatest,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This may be deprecated at some point in future based onhttps://docs.anthropic.com/en/docs/about-claude/model-deprecations#deprecation-history

I would suggest we allow reading fromANTHROPIC_MODEL. This will also allow administrators to choose a different model if they prefer.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sounds good to me 👍 In that case, we should probably default to a newer model then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Haiku is cheap though! For something like this it seems to be "good enough"

},
}

if apiKey := os.Getenv("ANTHROPIC_API_KEY"); apiKey == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

suggestion: allow passing infunc(key string) string for testing / mocking

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Rather than using an env, should we provide API key as argument to the function? Would solve the testing aspect.

Fine to have another exported function likeGetAnthropicAPIKeyFromEnv in this package too that can be used at the call-site to avoid magic strings andos.Getenv.


stream, err := anthropicDataStream(ctx, anthropicClient, conversation)
if err != nil {
return fallback, xerrors.Errorf("create anthropic data stream: %w", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nit: Returning a value and error is not common practice and may be surprising to the reader. The way fallback is used here it would make sense to either return error or provide the fallback, but not both. Perhaps returning empty strings in all fallback cases and handling it at the call-site would be preferable?

- "Set up CI/CD pipeline" → "task-setup-cicd-44"

If you cannot create a suitable name:
- Respond with "task-workspace"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
-Respondwith"task-workspace"
-Respondwith"task-unnamed"

Suggestion to decouple this from workspaces, if possible.

},
}

if apiKey := os.Getenv("ANTHROPIC_API_KEY"); apiKey == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Rather than using an env, should we provide API key as argument to the function? Would solve the testing aspect.

Fine to have another exported function likeGetAnthropicAPIKeyFromEnv in this package too that can be used at the call-site to avoid magic strings andos.Getenv.

@DanielleMaywoodDanielleMaywood merged commit6553771 intomainAug 19, 2025
26 checks passed
@DanielleMaywoodDanielleMaywood deleted the danielle/tasks/generate-task-name-on-coderd branchAugust 19, 2025 13:56
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 19, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

tasks: name the workspace/task based on a summary
3 participants
@DanielleMaywood@mafredri@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp