Skip to content

fix(agent-core): run bash with process cwd#927

Closed
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/bash-process-cwd
Closed

fix(agent-core): run bash with process cwd#927
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/bash-process-cwd

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Jun 20, 2026

Copy link
Copy Markdown

Summary

Fixes #850.

  • run Bash commands with the process cwd instead of prefixing the shell source with cd '<cwd>' &&
  • keep Windows Git Bash >nul rewriting, but leave cwd handling to the process runner
  • normalize Git Bash-style /c/... cwd values back to Windows drive paths before spawning
  • update Bash tests so they assert both the spawned argv and the cwd passed through withCwd()

Validation

  • pnpm --filter @moonshot-ai/agent-core exec vitest run test/tools/bash.test.ts test/tools/shell-quoting.test.ts
  • pnpm --filter @moonshot-ai/agent-core run test
  • pnpm --filter @moonshot-ai/agent-core run typecheck
  • pnpm exec oxlint --type-aware packages/agent-core/src/tools/builtin/shell/bash.ts packages/agent-core/test/tools/bash.test.ts packages/agent-core/test/tools/shell-quoting.test.ts --quiet
  • pnpm --filter @moonshot-ai/agent-core run build
  • git diff --check

AI Assistance Disclosure

I used Codex to review the changes, sanity-check the implementation against existing patterns, and help spot potential edge cases.

@changeset-bot

changeset-bot Bot commented Jun 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de1a877

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tt-a1i

tt-a1i commented Jun 20, 2026

Copy link
Copy Markdown
Author

I missed #851 when checking for existing work because the title did not include #850. Closing this as a duplicate.

@tt-a1i tt-a1i closed this Jun 20, 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.

Refactor BashTool to Avoid Embedding CWD into bash -c Command String

1 participant