Skip to content

Fix bash tool consistency: Add matching default commands for Claude and Copilot engines - #1089

Merged
pelikhan merged 8 commits into
mainfrom
copilot/fix-67009230-c9dc-4883-a452-698495ca9a0f
Sep 28, 2025
Merged

pelikhan merged 8 commits into
mainfrom
copilot/fix-67009230-c9dc-4883-a452-698495ca9a0f

Conversation

Copilot AI commented Sep 28, 2025 •

Copy link
Copy Markdown
Contributor

Fix bash tool consistency between Claude and Copilot agentic engines

COMPLETED: Fixed the bash tool consistency issue between Claude and Copilot engines by ensuring both provide identical default bash commands when bash tools are enabled.

Changes Made

  • Added Default Bash Commands: Created DefaultBashTools constant with common safe bash commands: echo, ls, pwd, cat, head, tail, grep, wc, sort, uniq, date
  • Updated Compiler Logic: Modified applyDefaultTools() in compiler.go to add default bash commands when bash is enabled with bash: true or bash: nil
  • Fixed Empty Array Semantics: Corrected behavior so bash: [] means "no bash tools allowed" rather than adding default tools
  • Enhanced Documentation: Added comprehensive bash tools documentation in docs/src/content/docs/reference/tools.md
  • Merged Latest Changes: Successfully merged main branch and resolved all conflicts
  • Fixed Test Issues: Updated failing tests after merge, particularly TestGenerateErrorValidationWithEngineConfigPatterns which was outdated due to Claude now supporting error validation
  • Code Quality: Applied formatting, linting, and fixed all test failures
  • Comprehensive Testing: Added bash_defaults_consistency_test.go to verify both engines get identical default commands across all bash configuration scenarios
  • Integration Testing: Added copilot_git_commands_integration_test.go to ensure Copilot has equivalent git command testing as Claude

Bash Configuration Behavior

  • bash: true → Add default commands (echo, ls, pwd, etc.)
  • bash: nil → Add default commands (only if no git commands needed)
  • bash: [] → No bash tools allowed (empty array preserved)
  • bash: ["echo", "ls"] → Use specified commands only

Documentation Added

Comprehensive bash tools documentation now includes:

  • Default command behavior - Explains the new default bash commands feature
  • Configuration examples - Shows all supported bash configuration patterns
  • Security considerations - Guidance on safe vs unrestricted access
  • Git integration - How bash commands work with safe outputs requiring git

Results

Both engines now provide exactly the same default bash commands when bash is enabled:

  • Claude: Bash(cat), Bash(date), Bash(echo), Bash(grep), Bash(head), Bash(ls), Bash(pwd), Bash(sort), Bash(tail), Bash(uniq), Bash(wc) + bash helpers + Claude defaults
  • Copilot: shell(cat) shell(date) shell(echo) shell(grep) shell(head) shell(ls) shell(pwd) shell(sort) shell(tail) shell(uniq) shell(wc)

Key Features

  • ✅ Maintains compatibility: Git commands and explicit bash commands work as before
  • ✅ Safe commands only: Default commands are read-only and commonly used
  • ✅ Preserves existing behavior: When bash: nil is used with safe outputs requiring git, it remains nil as expected
  • ✅ Correct empty array semantics: bash: [] means no bash tools, not default tools
  • ✅ Comprehensive documentation: Complete guide to bash tool configuration and security
  • ✅ Up-to-date with main: Successfully merged latest changes from main branch
  • ✅ Full test coverage: All tests pass, including fixed test for Claude's new error validation support
  • ✅ Code quality: All formatting and linting checks pass

The default set of allowed bash tools now matches perfectly between Claude and Copilot agentic engines, providing a consistent user experience across both engines while maintaining backward compatibility with existing workflows.

Original prompt

Compare the default set of allowed bash tools in Claude and Copilot agentic engines. Make sure they match.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot continue plan

Copilot AI commented Sep 28, 2025

Copy link
Copy Markdown
Contributor Author

@copilot continue plan

Continuing the plan to identify the specific discrepancy in default bash tools between Claude and Copilot engines. I'll run the integration test I created to see if it reveals the issue, then implement the fix.

Copilot AI changed the title [WIP] Compare the default set of allowed bash tools in Claude and Copilot agentic engines. Make sure they match. Fix bash tool consistency: Add matching default commands for Claude and Copilot engines Sep 28, 2025
Comment thread pkg/workflow/compiler.go Outdated
tools["bash"] = defaultCommands
} else if bashCommands, ok := bashTool.([]any); ok && len(bashCommands) == 0 {
// bash is empty array - add default bash commands
defaultCommands := make([]any, len(constants.DefaultBashTools))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot empty array means no bash tools. Update documentation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit c614a7d. Updated the logic so bash: [] correctly means "no bash tools allowed" rather than adding default tools. Also added comprehensive documentation explaining the behavior:

  • bash: true or bash: nil → Add default commands
  • bash: [] → No bash tools allowed (empty array preserved)
  • bash: ["cmd1", "cmd2"] → Use specific commands only

The empty array now correctly preserves its semantic meaning of "no tools" rather than being converted to default commands.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot update documentation on bash tool (start a documentation page on tools if needed)

Copilot AI commented Sep 28, 2025 •

Copy link
Copy Markdown
Contributor Author

@copilot update documentation on bash tool (start a documentation page on tools if needed)

Added comprehensive bash tools documentation in commit 28a8734. Updated the existing tools documentation page (docs/src/content/docs/reference/tools.md) with:

New Bash Tools Section includes:

  • Default command behavior (explains the new default bash commands: echo, ls, pwd, cat, head, tail, grep, wc, sort, uniq, date)
  • Configuration examples for all supported patterns (bash: true, bash: [], bash: ["cmd1"], bash: [":*"])
  • Semantic meaning of different configurations
  • Security considerations and wildcard usage
  • Git integration behavior with safe outputs

Updated Examples:

  • Overview section now shows bash: true instead of specific commands
  • Neutral tools section explains default vs custom commands
  • All examples demonstrate the preferred bash: true pattern

The documentation now fully explains the bash tool consistency improvements and provides clear guidance for users on how to configure bash tools safely and effectively.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: node /home/REDACTED/work/gh-aw/gh-aw/docs/node_modules/.bin/astro build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan
pelikhan marked this pull request as ready for review September 28, 2025 18:17
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot merge main, format, lint, fix tests

Copilot AI commented Sep 28, 2025

Copy link
Copy Markdown
Contributor Author

@copilot merge main, format, lint, fix tests

Completed all requested tasks in commit 1e3dbf8:

✅ Merged main: Successfully merged latest changes from main branch, resolving all conflicts
✅ Formatted code: Applied go fmt to all Go files and prettier to JavaScript files
✅ Linted code: Passed all linting checks (golangci-lint and prettier)
✅ Fixed tests: Resolved test failure in TestGenerateErrorValidationWithEngineConfigPatterns that occurred due to Claude now supporting error validation after the main merge

Key merge resolution: Updated failing test that assumed Claude doesn't support error validation - now correctly expects Claude to generate error validation steps since it has built-in error patterns.

All unit tests now pass and the codebase is fully up-to-date with main while maintaining the bash tool consistency improvements.

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