Conversation
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/340ad058-2095-4321-8496-a3a4e25776d8 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace static-string
[rust-guard] Remove static-string allocations in guard outputs and add response path labeling coverage
Apr 20, 2026
String fields with &'static str in output structs
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Rust GitHub guard by eliminating per-call heap allocations for output fields that are always static literals, and by adding targeted unit tests for high-impact label_response_paths branches to increase confidence in response labeling behavior.
Changes:
- Change
LabelResourceOutput.operationandLabelAgentOutput.difc_modefromStringto&'static str, and remove now-unneeded.to_string()calls. - Add unit tests covering
label_response_pathsbehavior forsearch_repositories,list_pull_requests, query-scopedsearch_issues, and unknown-tool fallback.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/lib.rs | Removes unnecessary heap allocations by switching static output fields to &'static str and simplifying construction sites. |
| guards/github-guard/rust-guard/src/labels/response_paths.rs | Adds direct unit coverage for key response-path labeling branches and fallback behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
This was referenced Apr 20, 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.
This PR addresses two gaps in the Rust guard: avoid per-call heap allocation for output fields that are always static literals, and add direct unit coverage for high-impact
label_response_pathsbranches (search_repositories,list_pull_requests, query-scopedsearch_issues, and unknown-tool fallback).Static output fields:
String→&'static str(allocation removal)LabelResourceOutput::operationandLabelAgentOutput::difc_modeto&'static str..to_string()at construction sites inlabel_resourceandlabel_agent.Response path labeling tests (new coverage in
response_paths.rs)search_repositorieslist_pull_requestsrepo:query qualifier forsearch_issuesNoneresult for unknown toolsRepresentative change
Warning
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-build1015159776/b513/launcher.test /tmp/go-build1015159776/b513/launcher.test -test.testlogfile=/tmp/go-build1015159776/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1015159776/b431/vet.cfg 1.80.0/health/grpc_health_v1/health.pb.go 1.80.0/health/grpc_health_v1/health_grpc.pb.go x_amd64/vet -p base -lang=go1.25 x_amd64/vet -I g_.a 999199174/b287//-ifaceassert x_amd64/vet --gdwarf-5 ernal/middleware-atomic 9199174/b287/ x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build1015159776/b495/config.test /tmp/go-build1015159776/b495/config.test -test.testlogfile=/tmp/go-build1015159776/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1015159776/b388/vet.cfg @v1.1.3/cpu/arm/go1.25.9 9199174/b151/ x_amd64/vet -p nal/impl -lang=go1.25 x_amd64/vet 9199�� g_.a -I x_amd64/vet --gdwarf-5 64 -o x_amd64/vet(dns block)nonexistent.local/tmp/go-build1015159776/b513/launcher.test /tmp/go-build1015159776/b513/launcher.test -test.testlogfile=/tmp/go-build1015159776/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1015159776/b431/vet.cfg 1.80.0/health/grpc_health_v1/health.pb.go 1.80.0/health/grpc_health_v1/health_grpc.pb.go x_amd64/vet -p base -lang=go1.25 x_amd64/vet -I g_.a 999199174/b287//-ifaceassert x_amd64/vet --gdwarf-5 ernal/middleware-atomic 9199174/b287/ x_amd64/vet(dns block)slow.example.com/tmp/go-build1015159776/b513/launcher.test /tmp/go-build1015159776/b513/launcher.test -test.testlogfile=/tmp/go-build1015159776/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1015159776/b431/vet.cfg 1.80.0/health/grpc_health_v1/health.pb.go 1.80.0/health/grpc_health_v1/health_grpc.pb.go x_amd64/vet -p base -lang=go1.25 x_amd64/vet -I g_.a 999199174/b287//-ifaceassert x_amd64/vet --gdwarf-5 ernal/middleware-atomic 9199174/b287/ x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build1015159776/b522/mcp.test /tmp/go-build1015159776/b522/mcp.test -test.testlogfile=/tmp/go-build1015159776/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s -I .cfg om/spf13/cobra@v1.10.2/args.go x_amd64/vet --gdwarf-5 g/grpc/resolver -o x_amd64/vet .cfg�� 9199174/b394/_pkg_.a -importpath x_amd64/vet -ldflags="-O2" "bash g/grpc/internal//usr/bin/runc -I x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: