Skip to content

Commit 4e77ef8

Browse files
authored
fix(guard): correct backend enrichment tool names and args (#2340)
## Problem Backend enrichment calls in the GitHub guard's `backend.rs` used incorrect tool names and missing parameters, causing all enrichment to silently fail: 1. **PR enrichment** called `get_pull_request` — not a registered MCP tool (should be `pull_request_read`) 2. **PR enrichment** used `pull_number` arg — should be `pullNumber` and include `method: "get"` 3. **Issue enrichment** called `issue_read` without `method: "get"` parameter This meant `author_login` was never fetched from the backend, so trusted bot detection (`github-actions[bot]`, `dependabot[bot]`, etc.) never ran for resource-level labels in `tool_rules`. Bot-authored PRs and issues defaulted to `none` integrity and were incorrectly filtered. ## Fix - Change PR enrichment tool: `"get_pull_request"` → `"pull_request_read"` - Fix PR enrichment args: `pull_number` → `pullNumber`, add `method: "get"` - Fix issue enrichment args: add `method: "get"` ## Validation Discovered via repo-assist run [23412180702](https://github.com/github/gh-aw-mcpg/actions/runs/23412180702) (v0.1.25) which showed 4 DIFC-FILTERED events for `github-actions[bot]` authored items. ### Note `repo-assist.lock.yml` uses `:local` container build (inherited from main). Will revert after validation.
2 parents b2b0527 + 8a00a87 commit 4e77ef8

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

  • guards/github-guard/rust-guard/src/labels

guards/github-guard/rust-guard/src/labels/backend.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub fn is_repo_private_with_callback(
214214

215215
/// Determine whether a pull request is from a fork.
216216
///
217-
/// This helper calls `get_pull_request` through the provided backend callback,
217+
/// This helper calls `pull_request_read` through the provided backend callback,
218218
/// extracts `base.repo.full_name` and `head.repo.full_name`, and returns:
219219
/// - `Some(true)` if the PR is from a fork (head repo differs from base repo)
220220
/// - `Some(false)` if the PR is direct (same repository)
@@ -233,7 +233,8 @@ pub fn is_forked_pull_request_with_callback(
233233
let args = serde_json::json!({
234234
"owner": owner,
235235
"repo": repo,
236-
"pull_number": pull_number,
236+
"pullNumber": pull_number,
237+
"method": "get",
237238
});
238239

239240
let args_str = args.to_string();
@@ -244,7 +245,7 @@ pub fn is_forked_pull_request_with_callback(
244245
owner, repo, pull_number
245246
));
246247

247-
let len = match callback("get_pull_request", &args_str, &mut result_buffer) {
248+
let len = match callback("pull_request_read", &args_str, &mut result_buffer) {
248249
Ok(len) if len > 0 => len,
249250
Ok(_) => return None,
250251
Err(code) => {
@@ -294,13 +295,14 @@ pub fn get_pull_request_facts_with_callback(
294295
let args = serde_json::json!({
295296
"owner": owner,
296297
"repo": repo,
297-
"pull_number": pull_number,
298+
"pullNumber": pull_number,
299+
"method": "get",
298300
});
299301

300302
let args_str = args.to_string();
301303
let mut result_buffer = vec![0u8; SMALL_BUFFER_SIZE];
302304

303-
let len = match callback("get_pull_request", &args_str, &mut result_buffer) {
305+
let len = match callback("pull_request_read", &args_str, &mut result_buffer) {
304306
Ok(len) if len > 0 => len,
305307
_ => return None,
306308
};
@@ -370,6 +372,7 @@ pub fn get_issue_author_association_with_callback(
370372
"owner": owner,
371373
"repo": repo,
372374
"issue_number": issue_number,
375+
"method": "get",
373376
});
374377

375378
let args_str = args.to_string();
@@ -419,6 +422,7 @@ pub fn get_issue_author_info_with_callback(
419422
"owner": owner,
420423
"repo": repo,
421424
"issue_number": issue_number,
425+
"method": "get",
422426
});
423427

424428
let args_str = args.to_string();

0 commit comments

Comments
 (0)