Skip to content

Conversation

@DanielleMaywood
Copy link
Contributor

@DanielleMaywood DanielleMaywood commented Sep 26, 2025

Closes coder/internal#977

Adds one required field app_id, one read-only computed field prompt,
as well as deprecates the sidebar_app field.

Also updates the id field to inherit the value from CODER_TASK_ID
env variable

@DanielleMaywood DanielleMaywood force-pushed the danielle/tasks/ai-fields branch 4 times, most recently from 0a8c610 to bf7817e Compare September 29, 2025 10:57
@DanielleMaywood DanielleMaywood changed the title feat: add task_id, prompt and app_id fields to coder_ai_task feat: add prompt and app_id fields to coder_ai_task Sep 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for task identification and prompt handling in the coder_ai_task resource by introducing new fields and deprecating the existing sidebar_app configuration pattern.

  • Adds required app_id field and computed task_id/prompt fields to the coder_ai_task resource
  • Deprecates the sidebar_app field in favor of the simpler app_id approach
  • Updates tests to cover the new field validation and backward compatibility scenarios

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
provider/provider.go Updates resource function name from aiTask() to aiTaskResource()
provider/ai_task.go Implements new fields with environment variable integration and backward compatibility logic
provider/ai_task_test.go Adds comprehensive test coverage for new fields, validation, and deprecation scenarios
docs/resources/ai_task.md Updates documentation to reflect the new optional/computed fields and deprecation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Closes coder/internal#977

Adds one required field `app_id`, one read-only computed field `prompt`,
as well as deprecates the `sidebar_app` field.

Also updates the `id` field to inherit the value from `CODER_TASK_ID`
env variable
@DanielleMaywood DanielleMaywood marked this pull request as ready for review September 29, 2025 11:43
Comment on lines 33 to 35
} else {
resourceData.SetId(uuid.NewString())
}
Copy link
Member

Choose a reason for hiding this comment

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

Would it make more sense to exit with an error here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't mind either.

What would happen if the provider version this lands in is used with an older version of coder? (I guess also do we care?)

Copy link
Member

Choose a reason for hiding this comment

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

The integration tests will tell us :)
I'd expect that it won't have any effect unless the template defines a coder_ai_task. In that case, folks can lock their provider version.

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

LGTM!

}

if prompt := os.Getenv("CODER_TASK_PROMPT"); prompt != "" {
resourceData.Set("prompt", prompt)
Copy link
Member

Choose a reason for hiding this comment

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

Question, prompt vs input? I don't personally mind either way as both work. "You give your task an initial prompt and then send new input".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The RFC laid out prompt so I'm tempted to keep it here, I also don't mind either way.

@DanielleMaywood DanielleMaywood force-pushed the danielle/tasks/ai-fields branch from 63d905c to 347e659 Compare October 1, 2025 11:19
@DanielleMaywood DanielleMaywood merged commit c2c443b into main Oct 1, 2025
6 checks passed
@DanielleMaywood DanielleMaywood deleted the danielle/tasks/ai-fields branch October 1, 2025 11:25
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coder terraform provider: modify coder_ai_task to add app_id and prompt fields

3 participants