Skip to content

Conversation

Copy link

Copilot AI commented Jan 26, 2026

The Shell tool's cwd parameter is optional and should default to the environment's current working directory when not specified. The previous implementation used PathBuf::from(".") as an intermediate value, relying on subsequent path normalization to resolve to the environment cwd.

Changes

  • Direct environment cwd access: Changed from PathBuf::from(".") to self.services.get_environment().cwd.clone() when input.cwd is None
  • Added clarifying comment: Documents the default behavior inline

Before/After

// Before: indirect via path normalization
let cwd = input.cwd.unwrap_or_else(|| PathBuf::from("."));
let normalized_cwd = self.normalize_path(cwd.display().to_string());

// After: explicit environment cwd default
let cwd = input
    .cwd
    .unwrap_or_else(|| self.services.get_environment().cwd.clone());
let normalized_cwd = self.normalize_path(cwd.display().to_string());

Behavior unchanged—improves code clarity and intent.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Make Shell tool cwd handling more explicit by directly using
environment's cwd when None instead of relying on "." normalization.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>

Co-authored-by: manthanabc <48511543+manthanabc@users.noreply.github.com>
Copilot AI changed the title [WIP] Update changes based on feedback from PR #55 fix(shell): explicitly default to environment cwd when None Jan 26, 2026
Copilot AI requested a review from manthanabc January 26, 2026 21:25
@manthanabc manthanabc closed this Jan 26, 2026
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.

2 participants