Skip to content

fix(bash): make description parameter optional in bash tool#13832

Open
hobostay wants to merge 3 commits intoanomalyco:devfrom
hobostay:fix/bash-description-optional
Open

fix(bash): make description parameter optional in bash tool#13832
hobostay wants to merge 3 commits intoanomalyco:devfrom
hobostay:fix/bash-description-optional

Conversation

@hobostay
Copy link
Contributor

Summary

This PR fixes a critical bug where the bash tool's description parameter was marked as required but not exposed to the AI model, causing ALL bash commands to fail with a Zod validation error.

The Bug

When running any bash command (even simple ones like ls -la), the AI would receive:

Error: The bash tool was called with invalid arguments: [
  {
    "expected": "string",
    "code": "invalid_type",
    "path": ["description"],
    "message": "Invalid input: expected string, received undefined"
  }
]

This completely broke the bash tool - one of OpenCode's most fundamental tools.

Root Cause

In packages/opencode/src/tool/bash.ts, the description parameter was defined as:

description: z.string().describe("...")
//          ↑↑↑ Missing .optional() - treated as REQUIRED by Zod

However, this parameter was not included in the tool schema exposed to the AI model, so the AI had no way to know it needed to pass it.

The Fix

Made description optional and added fallback to params.command:

- description: z.string().describe("...")
+ description: z.string().describe("...").optional()

Added fallback values in 4 locations where description is used:

  • Initial metadata setup: params.description ?? params.command
  • Metadata updates during execution: params.description ?? params.command
  • Return value title: params.description ?? params.command
  • Return value metadata: params.description ?? params.command

Impact

✅ Bash commands now work without requiring the description parameter
✅ When description is not provided, it defaults to the command string
✅ Backward compatible: existing code that passes description still works
Unblocks the bash tool - users can now run shell commands again

Test plan

  • Verified that description is now optional in the schema
  • Added fallback values for all usages of params.description
  • Ensured backward compatibility with existing callers
  • Minimal change - only what's needed to fix the bug

Fixes #13146

🤖 Generated with Claude Code

hobostay and others added 3 commits February 16, 2026 19:18
This commit fixes multiple translation issues in the Russian zen.mdx file:

**Critical fixes:**
- Change "Открытый код" to "OpenCode" (product name should not be translated)
- Change "opencode" to "OpenCode" throughout the document for consistency
- Fix broken sentence structure on line 24-25
- Fix "обслуживаются. правильно." to "обслуживаются правильно."
- Fix broken instruction text in "How it works" section

**Terminology improvements:**
- Change "агентов кодирования" to "кодинг-агентов" (more natural Russian)
- Change "курировать модели" to "выбирать модели" (correct word choice)
- Change "автоматическая перезагрузка" to "автопополнение" (correct meaning)
- Change "Принесите свой ключ" to "Использование собственных API-ключей" (more professional)
- Change "Дзен" to "Zen" (product name consistency)

**Content updates:**
- Add missing GLM 5 model to endpoint table
- Add missing MiniMax M2.5 models to endpoint table
- Update pricing table with new GLM 5 and MiniMax M2.5 entries
- Update free models list to match current offering
- Update privacy section to remove deprecated models
- Fix grammar error "Мы будем скоро поделимся" to "Мы вскоре поделимся"

These changes improve readability, consistency, and accuracy of the Russian
translation while aligning it with the English source document.

Fixes anomalyco#13808

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit adds a comprehensive keybinds reference section to the
keybinds documentation, making it easier for users to understand what
each keybind does.

**Changes:**
- Added "Keybinds reference" section after the config example
- Organized keybinds into logical categories:
  - Application & UI (13 keybinds)
  - Session management (17 keybinds)
  - Messages & navigation (17 keybinds)
  - Model & agent management (12 keybinds)
  - Input editing (6 keybinds)
  - Cursor movement (12 keybinds)
  - Text selection (11 keybinds)
  - Text deletion (7 keybinds)
  - History (2 keybinds)
- Each entry includes the keybind name, default value, and description
- Descriptions are sourced directly from the config schema definitions

This addresses issue anomalyco#13792 where users requested better documentation
of keybind actions alongside their default values.

Fixes anomalyco#13792

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The `description` parameter was marked as required in the schema but was
not properly exposed to the AI model, causing ALL bash commands to fail
with a Zod validation error.

**Changes:**
- Made `description` parameter optional by adding `.optional()`
- Added fallback to `params.command` when description is not provided
- This affects 4 locations where description was used:
  - Initial metadata setup (line 184)
  - Metadata updates during command execution (line 194)
  - Return value title (line 259)
  - Return value metadata (line 263)

**Impact:**
- Bash commands now work without requiring the description parameter
- When description is not provided, it defaults to the command string
- Backward compatible: existing calls with description still work

**Root cause:**
The bash tool defined `description` as a required `z.string()` but the
tool schema exposed to the AI did not include this parameter. This meant
the AI had no way to know it needed to pass this field, resulting in
validation errors for every bash call.

Fixes anomalyco#13146

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found one highly relevant PR that should be investigated:

Potential Duplicate Found:

Recommendation: Check PR #11605 to see if it was already closed/merged or if it needs to be reapplied. If it's an open/merged PR that attempts to fix the same issue, your PR #13832 may be a duplicate or addressing the same root cause.

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.

Bash(ls -la) tool description parameter is required but not exposed in tool schema — breaks all bash calls

1 participant