Skip to content

🧷 fix: Dedupe Agent Tool Bindings#179

Draft
danny-avila wants to merge 1 commit into
mainfrom
danny-avila/dedupe-tool-bindings
Draft

🧷 fix: Dedupe Agent Tool Bindings#179
danny-avila wants to merge 1 commit into
mainfrom
danny-avila/dedupe-tool-bindings

Conversation

@danny-avila

Copy link
Copy Markdown
Owner

Summary

I added a generic duplicate-name guard in AgentContext so duplicate tool bindings are deduped before reaching the model, with logging as a safety net. Related to danny-avila/LibreChat#13162.

  • Added name-based dedupe for tool binding output across schema-only, graph-managed, and instance tools.
  • Logged duplicate removals once per agent/tool name to make fallback behavior visible without spamming repeated binds.
  • Added focused coverage for a duplicate web_search binding where the schema-only LibreChat tool wins over the appended native instance.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • git diff --check HEAD~1..HEAD
  • Not run: npx --no-install jest src/agents/__tests__/AgentContext.test.ts --runInBand because this worktree is missing ts-jest.

Test Configuration:

  • Worktree: /Users/danny/.codex/worktrees/0ae6/agents

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

@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ea820edc3

ℹ️ 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".

Comment on lines +1393 to +1395
if (seenNames.has(name)) {
duplicateNames.add(name);
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep dedupe precedence aligned with runtime tool resolution

This dedupe path keeps the first tool for a duplicate name, but runtime execution still resolves duplicates by Map overwrite semantics (later entries win) in the tool-node initialization path (Graph.initializeTools builds maps from arrays, and ToolNode executes via toolMap.get(call.name)). That means when duplicate names exist, the model is bound with one tool schema while execution can run a different implementation, causing wrong routing or argument/schema mismatches at call time. Please make binding dedupe use the same precedence as runtime resolution (or dedupe both binding list and execution map from one shared source).

Useful? React with 👍 / 👎.

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.

1 participant