refactor: rename guard/init.go, relocate expandTracingVariables, consolidate collaborator_permission helpers#5844
Merged
Conversation
4 tasks
…olidate collaborator_permission helpers
Copilot
AI
changed the title
[WIP] Refactor semantic function clustering analysis
refactor: rename guard/init.go, relocate expandTracingVariables, consolidate collaborator_permission helpers
May 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors a few small structural/layout concerns to better align file names and helper locations with their actual responsibilities, and to reduce duplicated collaborator-permission response handling across server/proxy code paths.
Changes:
- Renamed the guard LabelAgent runner file to
label_agent.goand updated its logger namespace/variable name accordingly. - Moved
expandTracingVariablesfrom the generic expansion utility file intoconfig_tracing.goalongsideTracingConfig/OpenTelemetry validation. - Relocated
LogAndWrapCollaboratorPermissionintotool_result.gonext toBuildMCPTextResponse, leavingcollaborator_permission.gofocused on argument parsing.
Show a summary per file
| File | Description |
|---|---|
| internal/mcp/tool_result.go | Adds LogAndWrapCollaboratorPermission alongside MCP response-building helpers. |
| internal/mcp/collaborator_permission.go | Removes the log/wrap helper, leaving only argument parsing. |
| internal/guard/label_agent.go | Renames logger variable/namespace to match the file’s LabelAgent responsibility. |
| internal/config/expand.go | Removes tracing-specific expansion wrapper to keep this file generic. |
| internal/config/config_tracing.go | Adds expandTracingVariables next to tracing config and validation logic. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 0
This was referenced May 16, 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.
Three low-severity structural issues identified by semantic function clustering analysis: a misleadingly named file, a domain-specific function in a generic utility file, and a split response-building concern.
Changes
internal/guard/init.go→internal/guard/label_agent.go: File contained onlyRunLabelAgent(...)— noinit()logic. Logger var renamedlogGuardInit→logLabelAgentto match.expandTracingVariablesmoved fromconfig/expand.go→config/config_tracing.go:expand.gois now a pure generic expansion utility (expandVariablesCore,expandVariables,ExpandRawJSONVariables,expandEnvVariables). The tracing-domain wrapper belongs withTracingConfigandvalidateOpenTelemetryConfig.LogAndWrapCollaboratorPermissionmoved frommcp/collaborator_permission.go→mcp/tool_result.go: Co-locates it withBuildMCPTextResponse, which it calls directly.collaborator_permission.gois now a single-concern file containing onlyParseCollaboratorPermissionArgs.