From 93089698ba702e2d66c2a9908c2ce5a1a1f8e2f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 17:20:24 +0000 Subject: [PATCH 1/2] Initial plan From e56f387c518d91d713146e4a167cc832165013ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 17:27:54 +0000 Subject: [PATCH 2/2] refactor: extract logOutboundRPCRequest helper and update flags.go table Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/e8ae36d4-4bd4-4cfc-8485-ec88e9301b82 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- internal/cmd/flags.go | 2 ++ internal/mcp/connection.go | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/internal/cmd/flags.go b/internal/cmd/flags.go index 8bc80053..afd97f79 100644 --- a/internal/cmd/flags.go +++ b/internal/cmd/flags.go @@ -39,6 +39,8 @@ // flags_difc.go getDefaultAllowOnlyOwner() → MCP_GATEWAY_ALLOWONLY_SCOPE_OWNER // flags_difc.go getDefaultAllowOnlyRepo() → MCP_GATEWAY_ALLOWONLY_SCOPE_REPO // flags_difc.go getDefaultAllowOnlyMinIntegrity() → MCP_GATEWAY_ALLOWONLY_MIN_INTEGRITY +// flags_tracing.go getDefaultOTLPEndpoint() → OTEL_EXPORTER_OTLP_ENDPOINT +// flags_tracing.go getDefaultOTLPServiceName() → OTEL_SERVICE_NAME // // This pattern is intentionally kept in individual feature files because: // - Each helper names the specific environment variable it reads, making the diff --git a/internal/mcp/connection.go b/internal/mcp/connection.go index 5c828284..aaa85b3e 100644 --- a/internal/mcp/connection.go +++ b/internal/mcp/connection.go @@ -417,6 +417,16 @@ func (c *Connection) callSDKMethodWithReconnect(method string, params interface{ return result, err } +// logOutboundRPCRequest logs an outbound RPC request, optionally attaching agent DIFC tag snapshots. +// When shouldAttachTags is true, snapshot must be non-nil. +func logOutboundRPCRequest(serverID string, method string, payload []byte, shouldAttachTags bool, snapshot *AgentTagsSnapshot) { + if shouldAttachTags { + logger.LogRPCRequestWithAgentSnapshot(logger.RPCDirectionOutbound, serverID, method, payload, snapshot.Secrecy, snapshot.Integrity) + } else { + logger.LogRPCRequest(logger.RPCDirectionOutbound, serverID, method, payload) + } +} + // logInboundRPCResponse logs an inbound RPC response, optionally attaching agent DIFC tag snapshots. // When shouldAttachTags is true, snapshot must be non-nil. func logInboundRPCResponse(serverID string, payload []byte, err error, shouldAttachTags bool, snapshot *AgentTagsSnapshot) { @@ -445,11 +455,7 @@ func (c *Connection) SendRequestWithServerID(ctx context.Context, method string, "method": method, "params": params, }) - if shouldAttachAgentTags { - logger.LogRPCRequestWithAgentSnapshot(logger.RPCDirectionOutbound, serverID, method, requestPayload, snapshot.Secrecy, snapshot.Integrity) - } else { - logger.LogRPCRequest(logger.RPCDirectionOutbound, serverID, method, requestPayload) - } + logOutboundRPCRequest(serverID, method, requestPayload, shouldAttachAgentTags, snapshot) var result *Response var err error