Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions crates/mcp/src/task_server/tools/task_attempts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ struct StartWorkspaceRequest {
executor: String,
#[schemars(description = "Optional executor variant, if needed")]
variant: Option<String>,
#[schemars(
description = "Optional model override (e.g. 'anthropic/claude-sonnet-4-20250514'). Forwarded to ExecutorConfig.model_id."
)]
model_id: Option<String>,
#[schemars(
description = "Optional agent mode override. Forwarded to ExecutorConfig.agent_id."
)]
agent_id: Option<String>,
#[schemars(
description = "Optional reasoning effort override (e.g. 'high', 'medium', 'low'). Forwarded to ExecutorConfig.reasoning_id."
)]
reasoning_id: Option<String>,
#[schemars(description = "Repository selection for the workspace")]
repositories: Vec<McpWorkspaceRepoInput>,
#[schemars(
Expand Down Expand Up @@ -65,6 +77,15 @@ struct LinkWorkspaceIssueResponse {
issue_id: String,
}

fn trim_to_option(s: String) -> Option<String> {
let trimmed = s.trim();
if trimmed.is_empty() {
None
} else {
Some(trimmed.to_string())
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

New helper duplicates existing inline trim logic

Low Severity

The newly introduced trim_to_option helper performs exactly the same trim-and-collapse-to-None logic that already exists inline for prompt and variant in the same function. Introducing the helper but not applying it to the existing identical closures creates duplicated logic within a single function — if the trimming behavior ever changes, it would need updating in three places instead of one.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9f22c62. Configure here.


fn build_workspace_prompt_from_issue(issue: &api_types::Issue) -> Option<String> {
let title = issue.title.trim();
let description = issue
Expand Down Expand Up @@ -99,6 +120,9 @@ impl McpServer {
prompt,
executor,
variant,
model_id,
agent_id,
reasoning_id,
repositories,
issue_id,
}): Parameters<StartWorkspaceRequest>,
Expand Down Expand Up @@ -183,9 +207,9 @@ impl McpServer {
executor_config: ExecutorConfig {
executor: base_executor,
variant,
model_id: None,
agent_id: None,
reasoning_id: None,
model_id: model_id.and_then(trim_to_option),
agent_id: agent_id.and_then(trim_to_option),
reasoning_id: reasoning_id.and_then(trim_to_option),
permission_policy: None,
},
prompt: workspace_prompt,
Expand Down