Skip to content

馃О refactor: Use Bash PTC for Agent Tools - #13042

Merged
danny-avila merged 2 commits into
devfrom
danny-avila/bash-ptc-agent-tools
May 9, 2026
Merged

danny-avila merged 2 commits into
devfrom
danny-avila/bash-ptc-agent-tools

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

I split the programmatic tool-calling migration into its own stacked PR on top of #13028. This keeps the Code API auth PR focused while preserving the bash-first PTC behavior.

  • Switch agent programmatic tool registration from run_tools_with_code to run_tools_with_bash.
  • Add UI/tool-label handling for the bash PTC tool name.
  • Preserve recognition of legacy run_tools_with_code event payloads as a compatibility alias, while still routing them through the bash PTC implementation.
  • Add coverage for classification, event-handler injection, ToolService loading, and the tool icon mapping.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Testing

  • cd api && npx jest server/services/__tests__/ToolService.spec.js --runInBand
  • cd packages/api && npx jest src/agents/handlers.spec.ts src/tools/classification.spec.ts --runInBand
  • npm run build:client-package
  • cd client && npx jest src/components/Chat/Messages/Content/__tests__/ToolIcon.test.tsx --runInBand

Test Configuration:

  • Local LibreChat worktree on Node/Jest workspace dependencies.
  • The first direct client Jest run failed until @librechat/client was built; after npm run build:client-package, the targeted client test passed.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.

@danny-avila danny-avila changed the title 馃О fix: Use Bash PTC for Agent Tools 馃О refactor: Use Bash PTC for Agent Tools May 9, 2026
@danny-avila
danny-avila changed the base branch from danny-avila/ai-905-codeapi-auth to dev May 9, 2026 20:08
Copilot AI review requested due to automatic review settings May 9, 2026 20:12
@danny-avila
danny-avila force-pushed the danny-avila/bash-ptc-agent-tools branch from 3562a6b to 6dd71e4 Compare May 9, 2026 20:12
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates agent Programmatic Tool Calling (PTC) to a bash-first tool name (run_tools_with_bash) while retaining backwards compatibility for legacy run_tools_with_code event payloads across the API and client UI.

Changes:

  • Introduces Constants.BASH_PROGRAMMATIC_TOOL_CALLING and updates tool classification to register/instantiate the bash PTC tool/definition.
  • Updates agent tool-execution handling and ToolService event-driven tool loading to treat run_tools_with_code as a compatibility alias routed through the bash PTC implementation.
  • Updates client labeling/icon/renderer handling for the new tool name and adds/updates Jest coverage.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/data-provider/src/config.ts Adds a new constant for the bash PTC tool name.
packages/api/src/tools/classification.ts Switches tool classification/registration to bash PTC definition + tool factory.
packages/api/src/tools/classification.spec.ts Updates expectations and adds coverage ensuring bash PTC is created/registered.
packages/api/src/agents/handlers.ts Treats both bash and legacy PTC tool names as triggers for toolDefs/toolMap injection.
packages/api/src/agents/handlers.spec.ts Adds coverage for legacy PTC name receiving toolDefs/toolMap injection.
api/server/services/ToolService.js Loads bash PTC tool for both bash + legacy tool names (aliasing via name).
api/server/services/tests/ToolService.spec.js Adds compatibility test ensuring legacy name loads the bash PTC tool under the legacy name.
client/src/utils/toolLabels.ts Adds friendly label mapping for run_tools_with_bash.
client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx Maps bash PTC name to the execute-code icon type.
client/src/components/Chat/Messages/Content/Part.tsx Renders run_tools_with_bash tool calls via the ExecuteCode UI path.
client/src/components/Chat/Messages/Content/tests/ToolIcon.test.tsx Adds icon mapping coverage for the bash PTC constant.

馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 馃殌

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

GitNexus: 馃殌 deployed

The LibreChat-pr-13042 index is now live on the MCP server.
Deploy run

@danny-avila
danny-avila merged commit 715a4a5 into dev May 9, 2026
20 checks passed
@danny-avila
danny-avila deleted the danny-avila/bash-ptc-agent-tools branch May 9, 2026 20:31
fuuuzzy pushed a commit to fuuuzzy/LibreChat that referenced this pull request May 11, 2026
* fix: Use Bash PTC for programmatic agent tools

* fix: Preserve legacy PTC event calls
jcbartle pushed a commit to jcbartle/LibreChat that referenced this pull request May 11, 2026
* fix: Use Bash PTC for programmatic agent tools

* fix: Preserve legacy PTC event calls
ThomasVuNguyen pushed a commit to ThomasVuNguyen/LibreChat that referenced this pull request Jul 15, 2026
* fix: Use Bash PTC for programmatic agent tools

* fix: Preserve legacy PTC event calls
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