gRPC client: Strip "grpc-go/version" suffix from User-Agent header#5689
gRPC client: Strip "grpc-go/version" suffix from User-Agent header#5689
Conversation
|
Claude Opus 4.6,以及启用了 Preview 中的 Copilot Memory,
|
Use reflect to create a custom grpc.DialOption that sets the User-Agent to exactly the configured value, without grpc-go appending its version string (e.g., "grpc-go/1.78.0"). The gRPC library's WithUserAgent() always appends the grpc-go version, which creates a fingerprinting issue. Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
…tUserAgent Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
|
这。。。@Fangliding 你看下, |
|
|
|
我猜可能 |
|
@copilot 根据 #5689 (comment) 简化代码与 test(减少行数) |
…Func Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Simplified in |
|
@copilot 原来这个要 dial 后啊,你看下 gRPC 那个 dial 后有没有发实际数据出去 |
grpc.Dial calls exitIdleMode which can start connecting asynchronously. Switch to grpc.NewClient (lazy, no connection) + setUserAgent + Connect() to guarantee the UserAgent is fixed before any transport is created. Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Fixed in |
|
@copilot conn.Connect() 没返回个 error 啥的?返回了的话给 err 赋值 |
|
|
@copilot 你加那 passthrough 是啥玩意儿 |
|
|
@copilot |
…serAgent Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Done in |
|
|
|
|

grpc-go/1.78.0to User-Agent headerconn.dopts.copts.UserAgentvia reflect aftergrpc.NewClientreturnsgrpc.NewClient(lazy, no connection) instead ofgrpc.Dialto ensuresetUserAgentruns before any transport is createdgrpc.WithUserAgent()call —setUserAgentsets the field directly, no need to set it first💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.