MCPcopy Create free account
hub / github.com/alibaba/open-code-review / GetOrCreateFileSession

Method GetOrCreateFileSession

internal/session/history.go:235–249  ·  view source on GitHub ↗

GetOrCreateFileSession returns the FileSession for the given file path, creating one if it doesn't exist yet.

(filePath string)

Source from the content-addressed store, hash-verified

233// GetOrCreateFileSession returns the FileSession for the given file path,
234// creating one if it doesn't exist yet.
235func (sh *SessionHistory) GetOrCreateFileSession(filePath string) *FileSession {
236 sh.mu.Lock()
237 defer sh.mu.Unlock()
238
239 fs, ok := sh.FileSessions[filePath]
240 if !ok {
241 fs = &FileSession{
242 FilePath: filePath,
243 TaskRecords: make(map[TaskType][]*TaskRecord),
244 session: sh,
245 }
246 sh.FileSessions[filePath] = fs
247 }
248 return fs
249}
250
251// RecordReviewItemDone persists the file-level checkpoint used by resume.
252func (sh *SessionHistory) RecordReviewItemDone(filePath, oldPath, newPath, fingerprint string, comments []model.LlmComment) {

Callers 15

RecordReviewItemDoneMethod · 0.95
TestAppendTaskRecordFunction · 0.80
TestSetResponseFunction · 0.80
TestSetErrorFunction · 0.80
TestLLMFailuresFunction · 0.80
TestAddToolResultFunction · 0.80

Calls

no outgoing calls

Tested by 12

TestAppendTaskRecordFunction · 0.64
TestSetResponseFunction · 0.64
TestSetErrorFunction · 0.64
TestLLMFailuresFunction · 0.64
TestAddToolResultFunction · 0.64
TestSetErrorWritesJSONLFunction · 0.64