-
Notifications
You must be signed in to change notification settings - Fork 975
fix(dogfood/coder): allow mutable ai_prompt parameter #19493
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe Terraform data block Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Should it be made mutable only for prebuild/claim? If it's mutable for a claimed stopped workspace, that makes me wonder what should happen once it comes up. 😅
I'd imagine that when we go to 'resume' a task, we might want to add some previous context to the input. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
dogfood/coder/main.tf (2)
41-42
: Guard against whitespace-only prompts when toggling AI featuresToday, any non-empty string (including whitespace) flips local.has_ai_prompt to true and enables the Claude-related resources. Trim the value before checking emptiness to avoid accidental enablement.
- has_ai_prompt = data.coder_parameter.ai_prompt.value != "" + has_ai_prompt = trimspace(data.coder_parameter.ai_prompt.value) != ""
252-258
: Optional: add prompt-length validation to prevent oversized env varsThe prompt is surfaced as an environment variable (CODER_MCP_CLAUDE_TASK_PROMPT). Extremely large values can exceed shell/process limits or bloat plans. If the provider supports string validation for coder_parameter, consider enforcing a reasonable max length; otherwise, we can trim on assignment.
Option A (preferred, if supported by the provider): add a validation block.
data "coder_parameter" "ai_prompt" { type = "string" name = "AI Prompt" default = "" description = "Prompt for Claude Code" + validation { + # Keep prompts to <= 4000 chars to avoid oversized env vars. + # If regex validation for strings is supported, enforce it here. + # regex = "^(?s).{0,4000}$" + # message = "Prompt must be 4000 characters or fewer." + } mutable = true // You may wish to change the prompt, so mutability here is desirable. }Option B (fallback): trim and hard-cap when setting the env value (silent truncate).
resource "coder_env" "claude_task_prompt" { count = local.has_ai_prompt ? data.coder_workspace.me.start_count : 0 agent_id = coder_agent.dev.id name = "CODER_MCP_CLAUDE_TASK_PROMPT" - value = data.coder_parameter.ai_prompt.value + value = substr(trimspace(data.coder_parameter.ai_prompt.value), 0, 4000) }Can you confirm whether the coder provider supports string regex validation on parameters? If so, I’ll post a precise regex and message.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
dogfood/coder/main.tf
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: lint
- GitHub Check: gen
- GitHub Check: build_image
🔇 Additional comments (1)
dogfood/coder/main.tf (1)
257-257
: Change looks good: enabling mutability for AI prompt is consistent with intended UXAllowing mid-workspace edits to the AI task prompt is desirable and aligns with how related parameters here are already marked mutable.
Summary by CodeRabbit
New Features
Bug Fixes