Skip to content

Bug: repo_search_commits searchText not passed to API as searchCriteria.messageContains #1327

Description

@iamchenyu

Description

The repo_search_commits tool's searchText parameter never returns expected results because it is not passed to the Azure DevOps API as searchCriteria.messageContains. Instead, it only performs client-side filtering on the already-limited result set (default top: 10).

Steps to Reproduce

  1. Have a repository with a commit message containing "BSC" (e.g., "Merged PR 22210: BSC: Provide the role code dropdown...")
  2. Call repo_search_commits with searchText: "BSC", fromDate: "2026-04-01", top: 10
  3. Returns []
  4. Calling the ADO REST API directly with searchCriteria.messageContains=BSC returns the expected commits

Root Cause

In dist/tools/repositories.js (~line 1481), the searchCriteria object is built without including messageContains:

js
const searchCriteria = {
fromCommitId: fromCommit,
toCommitId: toCommit,
includeLinks: includeLinks,
includeWorkItems: includeWorkItems,
};
// searchText is NOT added here

Then at line 1515, client-side filtering is applied to the already-fetched (and limited) results:

js
if (searchText && filteredCommits) {
filteredCommits = filteredCommits.filter((commit) =>
commit.comment?.toLowerCase().includes(searchText.toLowerCase()));
}

Since the API call respects the top parameter, only the N most recent commits are returned, and the client-side filter searches within those N commits only.

Expected Fix

Add searchText to the API search criteria:

js
if (searchText) {
searchCriteria.messageContains = searchText;
}

Environment

  • Package version: 2.7.0
  • OS: Windows 11
  • Node.js: v20.5.1

Metadata

Metadata

Labels

Needs Review 👓needs review by the product teamRepos 📁issue in the repos area

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions