Conversation
…d-tool match arms Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/0dd025c3-d8f6-42b3-8b66-94b4eabf48b5 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Deduplicate inline search-query-fallback blocks into a shared helper
rust-guard: deduplicate search-query-fallback blocks and merge blocked-tool match arms
Apr 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the rust-guard labels subsystem to remove small but repeated repo-scope extraction logic and to consolidate identical tool-label match arms, reducing duplication while keeping labeling behavior consistent.
Changes:
- Added a shared helper (
extract_repo_scope_with_query_fallback) to centralize “owner/repo from args, elserepo:inquery” resolution. - Replaced four duplicated inline fallback blocks in response labeling with calls to the new helper.
- Merged multiple blocked repository-operation match arms in
tool_rules.rsinto a single arm with a shared implementation.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/helpers.rs | Introduces a canonical helper for extracting repo scope with search-query fallback. |
| guards/github-guard/rust-guard/src/labels/response_items.rs | Replaces duplicated repo-extraction + query-fallback logic with the new helper. |
| guards/github-guard/rust-guard/src/labels/response_paths.rs | Same deduplication as response_items.rs for the path-based labeling implementation. |
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Consolidates identical blocked-repo-operation match arms into one arm. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
This was referenced Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two instances of code duplication in the rust-guard labels subsystem: a 7-line "extract repo from tool args, fall back to
repo:in search query" block repeated 4× acrossresponse_items.rsandresponse_paths.rs, and two consecutive match arms intool_rules.rswith identical bodies.Changes
helpers.rs— addspub(crate) fn extract_repo_scope_with_query_fallback(tool_args: &Value) -> (String, String, String): canonical implementation of the owner/repo extraction with query fallbackresponse_items.rs/response_paths.rs— replaces 4 inline copies with a single call:tool_rules.rs— merges"transfer_repository"and"archive_repository" | "unarchive_repository" | "rename_repository"into one arm; both calledapply_repo_visibility_secrecywith identical arguments under the same policy rationaleWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build2886625906/b514/launcher.test /tmp/go-build2886625906/b514/launcher.test -test.testlogfile=/tmp/go-build2886625906/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s 8536�� .cfg /tmp/go-build235-ifaceassert x_amd64/vet . telabs/wazero/ininfo --64 x_amd64/vet -I .cfg elemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp@v1.43.0/internal/otlpconfig/options.go x_amd64/vet --gdwarf-5 g/protobuf/encodinfo -o x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build2886625906/b496/config.test /tmp/go-build2886625906/b496/config.test -test.testlogfile=/tmp/go-build2886625906/b496/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2886625906/b385/vet.cfg g_.a om/go-logr/logr@-c=4 x_amd64/vet /tmp/go-build235/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet ternal/engine/wa-atomic x86_64-linux-gnu-bool x_amd64/vet -I 7xwaangNM -I x_amd64/vet --gdwarf-5 8536374/b239/ -o x_amd64/vet(dns block)nonexistent.local/tmp/go-build2886625906/b514/launcher.test /tmp/go-build2886625906/b514/launcher.test -test.testlogfile=/tmp/go-build2886625906/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s 8536�� .cfg /tmp/go-build235-ifaceassert x_amd64/vet . telabs/wazero/ininfo --64 x_amd64/vet -I .cfg elemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp@v1.43.0/internal/otlpconfig/options.go x_amd64/vet --gdwarf-5 g/protobuf/encodinfo -o x_amd64/vet(dns block)slow.example.com/tmp/go-build2886625906/b514/launcher.test /tmp/go-build2886625906/b514/launcher.test -test.testlogfile=/tmp/go-build2886625906/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s 8536�� .cfg /tmp/go-build235-ifaceassert x_amd64/vet . telabs/wazero/ininfo --64 x_amd64/vet -I .cfg elemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp@v1.43.0/internal/otlpconfig/options.go x_amd64/vet --gdwarf-5 g/protobuf/encodinfo -o x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build2886625906/b523/mcp.test /tmp/go-build2886625906/b523/mcp.test -test.testlogfile=/tmp/go-build2886625906/b523/testlog.txt -test.paniconexit0 -test.timeout=10m0s .cfg�� 8536374/b351/_pkg_.a -I x_amd64/vet --gdwarf-5 g/grpc/internal//usr/bin/runc -o x_amd64/vet .cfg�� wwMF/PIk94C_Qa7ObsBMvwwMF pkg/mod/github.com/santhosh-teku-ifaceassert x_amd64/vet . --gdwarf2 --64 x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: