Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions src/apps/desktop/src/api/tool_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,19 @@ pub struct ToolConfirmationResponse {
}

fn build_tool_context(workspace_path: Option<&str>) -> ToolUseContext {
let normalized_workspace_path = workspace_path
.map(str::trim)
.filter(|path| !path.is_empty());

ToolUseContext {
tool_call_id: None,
message_id: None,
agent_type: None,
session_id: None,
dialog_turn_id: None,
workspace: workspace_path
.filter(|path| !path.is_empty())
workspace: normalized_workspace_path
.map(|path| WorkspaceBinding::new(None, PathBuf::from(path))),
current_working_directory: normalized_workspace_path.map(str::to_string),
safe_mode: Some(false),
abort_controller: None,
read_file_timestamps: HashMap::new(),
Expand Down
23 changes: 5 additions & 18 deletions src/crates/core/src/agentic/agents/agentic_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,8 @@ impl Agent for AgenticMode {
"Full-featured AI assistant with access to all tools for comprehensive software development tasks"
}

fn prompt_template_name(&self, model_name: Option<&str>) -> &str {
let Some(model_name) = model_name else {
return "agentic_mode";
};
let model_name = model_name.trim().to_ascii_lowercase();
if model_name.contains("gpt-5") {
"agentic_mode_gpt5"
} else {
"agentic_mode"
}
fn prompt_template_name(&self, _model_name: Option<&str>) -> &str {
"agentic_mode"
}

fn default_tools(&self) -> Vec<String> {
Expand All @@ -74,21 +66,16 @@ mod tests {
use super::{Agent, AgenticMode};

#[test]
fn selects_gpt5_prompt_template() {
fn always_uses_default_prompt_template() {
let agent = AgenticMode::new();
assert_eq!(
agent.prompt_template_name(Some("gpt-5.1")),
"agentic_mode_gpt5"
"agentic_mode"
);
assert_eq!(
agent.prompt_template_name(Some("GPT-5-CODEX")),
"agentic_mode_gpt5"
"agentic_mode"
);
}

#[test]
fn keeps_default_template_for_non_gpt5_models() {
let agent = AgenticMode::new();
assert_eq!(
agent.prompt_template_name(Some("claude-sonnet-4")),
"agentic_mode"
Expand Down
71 changes: 0 additions & 71 deletions src/crates/core/src/agentic/agents/prompts/agentic_mode_gpt5.md

This file was deleted.

1 change: 1 addition & 0 deletions src/crates/core/src/agentic/execution/execution_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ impl ExecutionEngine {
session_id: None,
dialog_turn_id: None,
workspace: workspace.cloned(),
current_working_directory: None,
safe_mode: None,
abort_controller: None,
read_file_timestamps: Default::default(),
Expand Down
10 changes: 10 additions & 0 deletions src/crates/core/src/agentic/tools/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct ToolUseContext {
pub session_id: Option<String>,
pub dialog_turn_id: Option<String>,
pub workspace: Option<WorkspaceBinding>,
pub current_working_directory: Option<String>,
pub safe_mode: Option<bool>,
pub abort_controller: Option<String>,
pub read_file_timestamps: HashMap<String, u64>,
Expand All @@ -43,6 +44,15 @@ impl ToolUseContext {
self.workspace.as_ref().map(|binding| binding.root_path())
}

pub fn current_working_directory(&self) -> Option<&Path> {
self.current_working_directory.as_deref().map(Path::new)
}

pub fn path_resolution_base(&self) -> Option<&Path> {
self.current_working_directory()
.or_else(|| self.workspace_root())
}

pub fn is_remote(&self) -> bool {
self.workspace
.as_ref()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ Usage:
.and_then(|v| v.as_bool())
.unwrap_or(false);

let resolved_path = resolve_path_with_workspace(file_path, context.workspace_root())?;
let resolved_path = resolve_path_with_workspace(
file_path,
context.current_working_directory(),
context.workspace_root(),
)?;

// When WorkspaceServices is available (both local and remote),
// use the abstract FS to read → edit in memory → write back.
Expand Down
Loading
Loading