Skip to content

Conversation

@mafredri
Copy link
Member

@mafredri mafredri commented Dec 1, 2025

Summary

This PR removes the deprecated AITaskPromptParameterName constant and all backward compatibility code that was added in v2.28 for the AI Prompt parameter.

Background

In v2.28, task prompts were migrated from being stored as workspace build parameters (named "AI Prompt") to being stored directly in the tasks.prompt database column. The AITaskPromptParameterName constant was kept for backward compatibility with older templates that might still define an "AI Prompt" parameter.

Changes

Backend

  • Remove AITaskPromptParameterName constant from codersdk/aitasks.go
  • Remove backward compatibility code in coderd/aitasks.go that automatically populated the "AI Prompt" parameter for templates that defined it
  • Remove the import of github.com/coder/terraform-provider-coder/v2/provider from codersdk
  • Remove coderd/util/slice import as it's no longer needed
  • Update dbfake.WorkspaceBuildBuilder.WithTask() to no longer set the AI Prompt parameter

Tests

  • Remove the OK AIPromptBackCompat test case from coderd/aitasks_test.go
  • Update toolsdk_test.go to not require AI Prompt parameter in template version

Frontend

  • Remove AITaskPromptParameterName constant from site/src/api/typesGenerated.ts
  • Remove the preset prompt read-only feature from TaskPrompt.tsx component that relied on the AI Prompt parameter
  • Update MockAIPromptPresets test mock to not include the AI Prompt parameter
  • Rename ReadOnlyPresetPrompt story to WithAIPresets

Result

Task prompts are now exclusively stored in the tasks.prompt database column. Templates no longer need to define an "AI Prompt" parameter to work with tasks.

Note: The Terraform provider (github.com/coder/terraform-provider-coder) may still require this parameter for coder_ai_task resources. That's a separate change tracked in a corresponding provider issue.

Closes coder/internal#1150

@mafredri mafredri force-pushed the fix-deprecated-parameter-removal branch from a52a4a1 to f2eae91 Compare December 1, 2025 14:21
This removes the deprecated AITaskPromptParameterName constant and
all backward compatibility code that was added in v2.28.

Changes:
- Remove AITaskPromptParameterName constant from codersdk/aitasks.go
- Remove backward compatibility code in coderd/aitasks.go that
  automatically populated the 'AI Prompt' parameter for templates
  that defined it
- Remove the backward compatibility test (OK AIPromptBackCompat)
- Update dbfake to no longer set the AI Prompt parameter
- Update toolsdk tests to not require AI Prompt parameter
- Remove AITaskPromptParameterName from frontend TypeScript types
- Remove preset prompt read-only feature from TaskPrompt component
  that relied on the AI Prompt parameter
- Update test mocks (MockAIPromptPresets) to not include AI Prompt

Task prompts are now exclusively stored in the tasks.prompt database
column, as introduced in the migration that added the tasks table.

Related: coder/internal#1150
@mafredri mafredri force-pushed the fix-deprecated-parameter-removal branch from f2eae91 to 705f201 Compare December 1, 2025 14:22
@github-actions github-actions bot added the stale This issue is like stale bread. label Dec 9, 2025

## Tasks format from 2.28 onwards

In v2.28 and above, the following changes were made:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to modify/bump the version number specified here?

Copy link
Member Author

@mafredri mafredri Dec 10, 2025

Choose a reason for hiding this comment

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

I think this statement is still true. 🤔 It's more that in 2.29 we still allowed the syntax and had back-combat, but in 2.30 we're removing the back-compat too. But please correct me if I'm overlooking something.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was a non-blocking suggestion so I'm happy to merge as-is

@DanielleMaywood DanielleMaywood removed the stale This issue is like stale bread. label Dec 10, 2025
@mtojek
Copy link
Member

mtojek commented Dec 12, 2025

@mafredri QQ: Can we merge this PR now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tasks: remove deprecated field ai_prompt

4 participants