refactor(server): decouple WorkingDir from RuntimeConfig in SessionManager#3602
Open
Piyush0049 wants to merge 1 commit into
Open
refactor(server): decouple WorkingDir from RuntimeConfig in SessionManager#3602Piyush0049 wants to merge 1 commit into
Piyush0049 wants to merge 1 commit into
Conversation
…nager Eliminates the hacky \.Clone()\ of the global CLI \RuntimeConfig\ inside the \SessionManager\'s per-session path. Instead of overriding the config's \WorkingDir\ and passing the mutated copy down to the team loader, the session's working directory is now passed cleanly via a new \ eamloader.WithWorkingDir()\ functional option. This treats the \RuntimeConfig\ as a proper read-only global context and resolves a lingering TODO left by maintainers regarding configuration leak.
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.
Description
This PR resolves an architectural TODO regarding configuration leakage inside the
SessionManager.Previously, the
SessionManagerwas mutating the global CLIRuntimeConfigby performing a heavy.Clone()operation on every session request just to inject the session's specificWorkingDir.Instead of overriding the config's
WorkingDirand passing a mutated copy down to the team loader, the session's working directory is now passed cleanly via a newteamloader.WithWorkingDir()functional option. This allows the backend to treat theRuntimeConfigas a pristine, read-only global context, eliminating the clone hack in the hot path.Changes Made
pkg/teamloader: Added aWithWorkingDir()functional option and updated the fallback coalescing (cmp.Or) so tests/CLI execution remain 100% backwards compatible.pkg/server: Removedrc := sm.runConfig.Clone()insideRunSessionand ferried theWorkingDirvia the new option.TODOas the structural weirdness is fully resolved.Validation
task build/go build ./...)task lint/go vet)go test ./pkg/server ./pkg/teamloader)