Skip to content

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Aug 22, 2025

Summary by CodeRabbit

  • New Features

    • The AI Prompt setting is now editable after initial setup, allowing on-the-fly adjustments from the interface.
    • Updates to this setting no longer require recreating environments or configurations.
  • Bug Fixes

    • Improved handling when applying presets or prebuilt configurations that previously prevented editing the AI Prompt.

@johnstcn johnstcn self-assigned this Aug 22, 2025
Copy link

coderabbitai bot commented Aug 22, 2025

Walkthrough

The Terraform data block data "coder_parameter" "ai_prompt" in dogfood/coder/main.tf was changed to set mutable = true and an inline comment was added. No other files or logic were modified.

Changes

Cohort / File(s) Summary
Coder parameter mutability
dogfood/coder/main.tf
Changed data "coder_parameter" "ai_prompt" attribute mutable from false to true; added inline comment: // Workaround for issue with claiming a prebuild from a preset that does not include this parameter.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nudge a flag from false to true,
A tiny hop through Terraform dew.
Carrots align, configs agree,
Mutable now—so prompt and free! 🥕
I twitch my whiskers, merge and go.

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 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 952ba06 and 261dcb2.

📒 Files selected for processing (1)
  • dogfood/coder/main.tf (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • dogfood/coder/main.tf
⏰ 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: build_image
  • GitHub Check: gen
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cj/dogfood/prompt-mutable

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

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. 😅

@johnstcn
Copy link
Member Author

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.

Copy link

@coderabbitai coderabbitai bot left a 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 features

Today, 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 vars

The 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 5e49d8c and 952ba06.

📒 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 UX

Allowing mid-workspace edits to the AI task prompt is desirable and aligns with how related parameters here are already marked mutable.

@johnstcn johnstcn merged commit fe36e9c into main Aug 22, 2025
34 checks passed
@johnstcn johnstcn deleted the cj/dogfood/prompt-mutable branch August 22, 2025 14:08
@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 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.

3 participants