feat: add prompt and app_id fields to coder_ai_task#445
feat: add prompt and app_id fields to coder_ai_task#445DanielleMaywood merged 3 commits intomainfrom
prompt and app_id fields to coder_ai_task#445Conversation
0a8c610 to
bf7817e
Compare
task_id, prompt and app_id fields to coder_ai_taskprompt and app_id fields to coder_ai_task
There was a problem hiding this comment.
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_idfield and computedtask_id/promptfields to thecoder_ai_taskresource - Deprecates the
sidebar_appfield in favor of the simplerapp_idapproach - 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
bf7817e to
a8d0534
Compare
| } else { | ||
| resourceData.SetId(uuid.NewString()) | ||
| } |
There was a problem hiding this comment.
Would it make more sense to exit with an error here?
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| if prompt := os.Getenv("CODER_TASK_PROMPT"); prompt != "" { | ||
| resourceData.Set("prompt", prompt) |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
The RFC laid out prompt so I'm tempted to keep it here, I also don't mind either way.
63d905c to
347e659
Compare
Closes coder/internal#977
Adds one required field
app_id, one read-only computed fieldprompt,as well as deprecates the
sidebar_appfield.Also updates the
idfield to inherit the value fromCODER_TASK_IDenv variable