MCPcopy Index your code
hub / github.com/docker/docker-agent / copySessionMetadata

Function copySessionMetadata

pkg/session/branch.go:174–197  ·  view source on GitHub ↗
(dst, src *Session, title string)

Source from the content-addressed store, hash-verified

172}
173
174func copySessionMetadata(dst, src *Session, title string) {
175 if src == nil || dst == nil {
176 return
177 }
178 dst.Title = title
179 dst.ToolsApproved = src.ToolsApproved
180 dst.HideToolResults = src.HideToolResults
181 dst.WorkingDir = src.WorkingDir
182 dst.SendUserMessage = src.SendUserMessage
183 dst.MaxIterations = src.MaxIterations
184 // MaxConsecutiveToolCalls and MaxOldToolCallTokens are safety / context
185 // rails that may be configured deliberately by the user or operator
186 // (consecutive-tool-call cutoff, old-tool-call truncation budget).
187 // Dropping them on a fork or branch would silently make the new
188 // session behave differently from its parent. Clone() preserves both,
189 // so do the same here.
190 dst.MaxConsecutiveToolCalls = src.MaxConsecutiveToolCalls
191 dst.MaxOldToolCallTokens = src.MaxOldToolCallTokens
192 dst.Starred = src.Starred
193 dst.Permissions = clonePermissionsConfig(src.Permissions)
194 dst.AgentModelOverrides = cloneStringMap(src.AgentModelOverrides)
195 dst.CustomModelsUsed = cloneStringSlice(src.CustomModelsUsed)
196 dst.AttachedFiles = src.AttachedFilesSnapshot()
197}
198
199// generateBranchTitle creates a title for a branched session based on the parent title.
200// If the parent has no title, returns empty string (will trigger auto-generation).

Callers 2

branchSessionWithTitleFunction · 0.85
cloneSubSessionFunction · 0.85

Calls 4

clonePermissionsConfigFunction · 0.85
cloneStringMapFunction · 0.85
cloneStringSliceFunction · 0.85
AttachedFilesSnapshotMethod · 0.80

Tested by

no test coverage detected