GitLabgitlab-org
cli
main
1package sync
3import (
4 "bufio"
5 "context"
6 "crypto/sha256"
7 "encoding/hex"
8 "encoding/json"
9 "errors"
10 "fmt"
11 "io"
12 "io/fs"
13 "os"
14 "path/filepath"
15 "runtime"
16 "strings"
17 "time"
19 "gitlab.com/gitlab-org/cli/internal/commands/govern/internal/claudehooks"
20 "gitlab.com/gitlab-org/cli/internal/commands/govern/internal/gaig"
21 "gitlab.com/gitlab-org/cli/internal/commands/govern/internal/redact"
22 "gitlab.com/gitlab-org/cli/internal/commands/govern/internal/syncstate"
23)
25// claudeProjectsDir returns the base directory for Claude Code project transcripts.
26func claudeProjectsDir() (string, error) {
27 home, err := os.UserHomeDir()
28 if err != nil {
29 return "", fmt.Errorf("could not find home directory: %w", err)
30 }
31 return filepath.Join(home, ".claude", "projects"), nil
32}
34// cwdToProjectHash converts the current working directory path to the
35// directory name Claude Code uses for storing transcripts.
36// e.g. /Users/jean/gdk/gitlab -> -Users-jean-gdk-gitlab
37func cwdToProjectHash(cwd string) string {
38 return strings.ReplaceAll(cwd, string(filepath.Separator), "-")
39}
41// transcriptPath returns the path to the JSONL transcript for a given session.
42func transcriptPath(sessionID, cwd string) (string, error) {
43 base, err := claudeProjectsDir()
44 if err != nil {
45 return "", err
46 }
47 projectHash := cwdToProjectHash(cwd)
48 return filepath.Join(base, projectHash, sessionID+".jsonl"), nil
49}
51// transcriptEntry represents a single line in a Claude Code JSONL transcript.
52type transcriptEntry struct {
53 Type string `json:"type"`
54 SessionID string `json:"sessionId"`
55 Timestamp string `json:"timestamp"`
56 UUID string `json:"uuid"`
57 Message json.RawMessage `json:"message"`
58 IsMeta bool `json:"isMeta"`
59 // IsCompactSummary marks the summary Claude Code writes of the
60 // conversation so far when it compacts it, which can be from before setup.
61 IsCompactSummary bool `json:"isCompactSummary"`
62 IsVisibleInTranscriptOnly bool `json:"isVisibleInTranscriptOnly"`
63 Subtype string `json:"subtype"`
64 CWD string `json:"cwd"`
65 Version string `json:"version"`
67 // user entry fields
68 PromptID string `json:"promptId"`
70 // system summary fields
71 DurationMs int `json:"durationMs"`
72 MessageCount int `json:"messageCount"`
73}
75// assistantMessage represents the message field of an assistant entry.
76type assistantMessage struct {
77 ID string `json:"id"`
78 Model string `json:"model"`
79 Content []contentBlock `json:"content"`
80 Usage tokenUsage `json:"usage"`
81}
83type tokenUsage struct {
84 InputTokens int `json:"input_tokens"`
85 OutputTokens int `json:"output_tokens"`
86 CacheReadInputTokens int `json:"cache_read_input_tokens"`
87 CacheCreationInputTokens int `json:"cache_creation_input_tokens"`
88}
90// contentBlock represents a single content block in an assistant message.
91type contentBlock struct {
92 Type string `json:"type"`
93 ID string `json:"id"`
94 Name string `json:"name"`
95 Input json.RawMessage `json:"input"`
96 Text string `json:"text"`
98 // tool_result fields
99 ToolUseID string `json:"tool_use_id"`
100 IsError bool `json:"is_error"`
101 Content json.RawMessage `json:"content"`
102}
104// sessionData holds extracted data from the transcript for a single session.
105type sessionData struct {
106 SessionID string
107 Goal string
108 StartedAt time.Time
109 ToolCalls []toolCall
110 ToolResults []toolResult
111 Prompts []prompt
112 Responses []llmResponse
113 EndedAt time.Time
114 IsComplete bool
116 AgentVersion string
117}
119// empty reports whether there is nothing to post.
120func (d *sessionData) empty() bool {
121 return len(d.ToolCalls) == 0 && len(d.ToolResults) == 0 && len(d.Prompts) == 0 && len(d.Responses) == 0
122}
124// toolCall represents a single tool invocation extracted from the transcript.
125type toolCall struct {
126 ID string
127 Name string
128 // Namespace is the tool's group as the agent recorded it, for example a Codex
129 // MCP server. Empty for agents that record only a name.
130 Namespace string
131 Input json.RawMessage
132 Timestamp time.Time
133 // CWD is the folder the agent worked in when it recorded the entry, or
134 // empty when the transcript does not say. Results, prompts and responses
135 // carry the same field.
136 CWD string
137}
139// toolResult is the outcome of a tool call. Name and Duration are empty when
140// the call was synced in an earlier run.
141type toolResult struct {
142 CallID string
143 Name string
144 Namespace string
145 // Outcome overrides the outcome derived from IsError, for agents that do
146 // not record whether a call succeeded.
147 Outcome string
148 IsError bool
149 Error string
150 Duration time.Duration
151 Timestamp time.Time
152 CWD string
153}
155// prompt is a prompt the user typed.
156type prompt struct {
157 ID string
158 Text string
159 Timestamp time.Time
160 CWD string
161}
163// llmResponse is the metadata of one model response, without its content.
164type llmResponse struct {
165 ID string
166 Model string
167 Usage tokenUsage
168 Timestamp time.Time
169 CWD string
170}
172// cleanCWD cleans a recorded folder, so the same folder always compares equal
173// whichever agent or line recorded it.
174func cleanCWD(dir string) string {
175 if dir == "" {
176 return ""
177 }
178 return filepath.Clean(dir)
179}
181// sessionMeta is written by the hooks so that `--all` can sync the session
182// later without the agent's environment or working directory.
183type sessionMeta struct {
184 AgentType string `json:"agent_type"`
185 PathWithNamespace string `json:"path_with_namespace"`
186 Host string `json:"host"`
187 // Transcript is the agent's locator for the session transcript.
188 Transcript string `json:"transcript,omitempty"`
189 CompletedAt *time.Time `json:"completed_at,omitempty"`
190}
192// extractPrompt returns the text the user typed in a user message, or an
193// empty string for bash inputs, tool results, and other non-prompt content.
194func extractPrompt(raw json.RawMessage) string {
195 // Try array content format: {"role":"user","content":[{"type":"text","text":"..."}]}
196 var msgArray struct {
197 Content []struct {
198 Type string `json:"type"`
199 Text string `json:"text"`
200 } `json:"content"`
201 }
202 if err := json.Unmarshal(raw, &msgArray); err == nil {
203 for _, block := range msgArray.Content {
204 if block.Type == "text" && block.Text != "" {
205 if skipPrompt(block.Text) {
206 return ""
207 }
208 return block.Text
209 }
210 }
211 }
213 // Try string content format: {"role":"user","content":"<bash-input>..."}
214 var msgString struct {
215 Content string `json:"content"`
216 }
217 if err := json.Unmarshal(raw, &msgString); err == nil && msgString.Content != "" {
218 content := strings.TrimSpace(msgString.Content)
219 if skipPrompt(content) {
220 return ""
221 }
222 return content
223 }
225 return ""
226}
228// skipPrompt reports whether text is a bash input or XML-tagged content
229// injected by the agent rather than typed by the user.
230func skipPrompt(text string) bool {
231 return strings.Contains(text, "<bash-input>") ||
232 strings.Contains(text, "<bash-output>") ||
233 strings.HasPrefix(strings.TrimSpace(text), "<")
234}
236// goalFromText returns text truncated for use as a session goal, or an empty
237// string for bash inputs and XML-tagged content.
238func goalFromText(text string) string {
239 if skipPrompt(text) {
240 return ""
241 }
242 text = redact.Secrets(text)
243 if len(text) > 256 {
244 return text[:256] + "..."
245 }
246 return text
247}
249// parseTranscript reads the complete entries of the transcript file after
250// startOffset, extracts session data, and returns the offset after the last
251// complete entry, so an entry that is still being written is read next time.
252func parseTranscript(path string, startOffset int64) (*sessionData, int64, error) {
253 data := &sessionData{}
254 goalFound := startOffset > 0 // if we have a cursor, we already captured the goal
255 calls := map[string]toolCall{}
256 responses := map[string]int{}
258 offset, err := scanJSONL(path, startOffset, func(line []byte, _ int64) {
259 var entry transcriptEntry
260 if err := json.Unmarshal(line, &entry); err != nil {
261 return // skip malformed lines
262 }
264 if data.SessionID == "" && entry.SessionID != "" {
265 data.SessionID = entry.SessionID
266 }
267 if data.AgentVersion == "" {
268 data.AgentVersion = entry.Version
269 }
271 ts, err := time.Parse(time.RFC3339Nano, entry.Timestamp)
272 if err != nil {
273 ts = time.Now() // fallback: use current time if timestamp is malformed
274 }
276 switch entry.Type {
277 case "user":
278 var msg assistantMessage
279 // A prompt's content can be a plain string, which fails to decode
280 // as blocks and holds no tool results.
281 _ = json.Unmarshal(entry.Message, &msg)
282 hasResults := false
283 for _, block := range msg.Content {
284 if block.Type != "tool_result" {
285 continue
286 }
287 hasResults = true
288 result := toolResult{CallID: block.ToolUseID, IsError: block.IsError, Timestamp: ts, CWD: cleanCWD(entry.CWD)}
289 if call, ok := calls[block.ToolUseID]; ok {
290 result.Name = call.Name
291 result.Duration = ts.Sub(call.Timestamp)
292 result.CWD = call.CWD
293 }
294 if block.IsError {
295 result.Error = toolResultText(block.Content)
296 }
297 data.ToolResults = append(data.ToolResults, result)
298 }
299 if entry.IsMeta || entry.IsCompactSummary || entry.IsVisibleInTranscriptOnly || entry.PromptID == "" || hasResults {
300 return
301 }
302 text := extractPrompt(entry.Message)
303 if text == "" {
304 return
305 }
306 data.Prompts = append(data.Prompts, prompt{ID: entry.UUID, Text: text, Timestamp: ts, CWD: cleanCWD(entry.CWD)})
307 if !goalFound {
308 data.Goal = goalFromText(text)
309 data.StartedAt = ts
310 goalFound = true
311 }
313 case "assistant":
314 var msg assistantMessage
315 if err := json.Unmarshal(entry.Message, &msg); err != nil {
316 return
317 }
319 for _, block := range msg.Content {
320 if block.Type == "tool_use" {
321 call := toolCall{ID: block.ID, Name: block.Name, Input: block.Input, Timestamp: ts, CWD: cleanCWD(entry.CWD)}
322 calls[block.ID] = call
323 data.ToolCalls = append(data.ToolCalls, call)
324 }
325 }
327 // A response is streamed as several entries with the same message
328 // ID. The usage of the latest entry is the most complete.
329 if msg.ID != "" {
330 response := llmResponse{ID: msg.ID, Model: msg.Model, Usage: msg.Usage, Timestamp: ts, CWD: cleanCWD(entry.CWD)}
331 if i, ok := responses[msg.ID]; ok {
332 response.Timestamp = data.Responses[i].Timestamp
333 response.CWD = data.Responses[i].CWD
334 data.Responses[i] = response
335 } else {
336 responses[msg.ID] = len(data.Responses)
337 data.Responses = append(data.Responses, response)
338 }
339 }
341 case "system":
342 // Session summary entry signals completion
343 if entry.DurationMs > 0 {
344 data.IsComplete = true
345 if ts, err := time.Parse(time.RFC3339Nano, entry.Timestamp); err == nil {
346 data.EndedAt = ts
347 }
348 }
349 }
350 })
351 if err != nil {
352 return nil, offset, err
353 }
355 return data, offset, nil
356}
358// toolResultText returns the text of a tool_result content, which is either a
359// string or a list of content blocks.
360func toolResultText(raw json.RawMessage) string {
361 var text string
362 if json.Unmarshal(raw, &text) == nil {
363 return text
364 }
365 var blocks []contentBlock
366 if json.Unmarshal(raw, &blocks) != nil {
367 return ""
368 }
369 parts := make([]string, 0, len(blocks))
370 for _, b := range blocks {
371 if b.Type == "text" {
372 parts = append(parts, b.Text)
373 }
374 }
375 return strings.Join(parts, "\n")
376}
378// sha256File computes the SHA-256 hex string of a file's contents.
379func sha256File(path string) (string, error) {
380 f, err := os.Open(path)
381 if err != nil {
382 return "", err
383 }
384 defer f.Close()
386 h := sha256.New()
387 if _, err := io.Copy(h, f); err != nil {
388 return "", err
389 }
391 return hex.EncodeToString(h.Sum(nil)), nil
392}
394// currentCWD returns the current working directory.
395func currentCWD() (string, error) {
396 cwd, err := os.Getwd()
397 if err != nil {
398 return "", fmt.Errorf("could not get current directory: %w", err)
399 }
400 // On macOS, resolve symlinks since Claude Code uses the resolved path
401 if runtime.GOOS == "darwin" {
402 if resolved, err := filepath.EvalSymlinks(cwd); err == nil {
403 cwd = resolved
404 }
405 }
406 return cwd, nil
407}
409func findTranscriptForSession(sessionID string) (string, error) {
410 base, err := claudeProjectsDir()
411 if err != nil {
412 return "", err
413 }
415 dirs, err := os.ReadDir(base)
416 if err != nil {
417 if os.IsNotExist(err) {
418 return "", nil
419 }
420 return "", err
421 }
423 for _, dir := range dirs {
424 if !dir.IsDir() {
425 continue
426 }
427 candidate := filepath.Join(base, dir.Name(), sessionID+".jsonl")
428 if _, err := os.Stat(candidate); err == nil {
429 return candidate, nil
430 }
431 }
432 return "", nil
433}
435func metaPath(sessionID string) (string, error) {
436 cp, err := syncstate.PositionPath(sessionID)
437 if err != nil {
438 return "", err
439 }
440 return cp + ".meta", nil
441}
443func writeSessionMeta(sessionID string, meta sessionMeta) error {
444 path, err := metaPath(sessionID)
445 if err != nil {
446 return err
447 }
448 data, err := json.Marshal(meta) //nolint:forbidigo // writing to disk, not stdout
449 if err != nil {
450 return err
451 }
452 if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
453 return fmt.Errorf("could not create meta directory: %w", err)
454 }
455 return os.WriteFile(path, data, 0o600)
456}
458// errNoSessionMeta is returned by readSessionMeta when the session has no metadata.
459var errNoSessionMeta = errors.New("no session metadata")
461func readSessionMeta(sessionID string) (*sessionMeta, error) {
462 path, err := metaPath(sessionID)
463 if err != nil {
464 return nil, err
465 }
466 data, err := os.ReadFile(path)
467 if errors.Is(err, fs.ErrNotExist) {
468 return nil, errNoSessionMeta
469 }
470 if err != nil {
471 return nil, err
472 }
473 var meta sessionMeta
474 if err := json.Unmarshal(data, &meta); err != nil {
475 return nil, err
476 }
477 return &meta, nil
478}
480// listSessionMetas returns the IDs of sessions that have metadata.
481func listSessionMetas() ([]string, error) {
482 entries, err := os.ReadDir(filepath.Join(gaig.StateDir(), "cursors"))
483 if errors.Is(err, fs.ErrNotExist) {
484 return nil, nil
485 }
486 if err != nil {
487 return nil, fmt.Errorf("could not read cursors directory: %w", err)
488 }
489 var ids []string
490 for _, entry := range entries {
491 if id, ok := strings.CutSuffix(entry.Name(), ".meta"); ok && !entry.IsDir() {
492 ids = append(ids, id)
493 }
494 }
495 return ids, nil
496}
498func forgetSession(sessionID string) error {
499 cp, err := syncstate.PositionPath(sessionID)
500 if err != nil {
501 return err
502 }
503 start, err := syncstate.StartPath(sessionID)
504 if err != nil {
505 return err
506 }
507 var errs []error
508 for _, path := range []string{cp, cp + ".meta", start} {
509 if err := os.Remove(path); err != nil && !errors.Is(err, fs.ErrNotExist) {
510 errs = append(errs, err)
511 }
512 }
513 return errors.Join(errs...)
514}
516// sessionMetaModTime returns when a hook last recorded the session.
517func sessionMetaModTime(sessionID string) (time.Time, error) {
518 path, err := metaPath(sessionID)
519 if err != nil {
520 return time.Time{}, err
521 }
522 info, err := os.Stat(path)
523 if err != nil {
524 return time.Time{}, err
525 }
526 return info.ModTime(), nil
527}
529func markSessionCompleted(sessionID string, at time.Time) error {
530 meta, err := readSessionMeta(sessionID)
531 if errors.Is(err, errNoSessionMeta) {
532 return nil
533 }
534 if err != nil {
535 return err
536 }
537 meta.CompletedAt = &at
538 return writeSessionMeta(sessionID, *meta)
539}
541// errTranscriptNotFound is returned when a session's transcript does not exist.
542var errTranscriptNotFound = errors.New("transcript not found")
544// errAgentSessionNotFound is returned when the agent reports that it has no
545// such session, which may also mean the job cannot see the agent's data.
546var errAgentSessionNotFound = errors.New("the agent reports no such session")
548// transcript is a source of agent session data.
549type transcript interface {
550 fmt.Stringer
551 // read returns the session data recorded after cursor, and the cursor
552 // to pass next time.
553 read(ctx context.Context, cursor int64) (*sessionData, int64, error)
554 lastActivity(ctx context.Context) (time.Time, error)
555 checksum(ctx context.Context) (string, error)
556}
558// claudeTranscript is a Claude Code JSONL transcript. Its cursor is a byte offset.
559type claudeTranscript struct {
560 path string
561}
563func (t claudeTranscript) String() string {
564 return t.path
565}
567func (t claudeTranscript) read(_ context.Context, cursor int64) (*sessionData, int64, error) {
568 if _, err := os.Stat(t.path); errors.Is(err, fs.ErrNotExist) {
569 return nil, cursor, errTranscriptNotFound
570 }
571 return parseTranscript(t.path, cursor)
572}
574func (t claudeTranscript) lastActivity(context.Context) (time.Time, error) {
575 info, err := os.Stat(t.path)
576 if errors.Is(err, fs.ErrNotExist) {
577 return time.Time{}, errTranscriptNotFound
578 }
579 if err != nil {
580 return time.Time{}, err
581 }
582 return info.ModTime(), nil
583}
585func (t claudeTranscript) checksum(context.Context) (string, error) {
586 return sha256File(t.path)
587}
589// claudeCode syncs Claude Code sessions. Their transcript locator is the
590// JSONL file path.
591type claudeCode struct{}
593func (claudeCode) name() string { return "claude-code" }
595func (claudeCode) sessionID() string { return os.Getenv("CLAUDE_CODE_SESSION_ID") }
597func (claudeCode) current(sessionID string) (transcript, string, error) {
598 cwd, err := currentCWD()
599 if err != nil {
600 return nil, "", fmt.Errorf("could not get current directory: %w", err)
601 }
602 path, err := transcriptPath(sessionID, cwd)
603 if err != nil {
604 return nil, "", fmt.Errorf("could not resolve transcript path: %w", err)
605 }
606 return claudeTranscript{path: path}, path, nil
607}
609func (claudeCode) recorded(sessionID, path string) (transcript, string, error) {
610 if _, err := os.Stat(path); err == nil {
611 return claudeTranscript{path: path}, path, nil
612 }
613 // The recorded path is derived from the hook's working directory, which
614 // differs from the session's project directory if the agent changed
615 // directory.
616 found, err := findTranscriptForSession(sessionID)
617 if err != nil {
618 return nil, "", err
619 }
620 if found == "" {
621 return claudeTranscript{path: path}, path, nil
622 }
623 return claudeTranscript{path: found}, found, nil
624}
626// canForget allows forgetting a completed Claude Code session once its
627// transcript is deleted, which Claude Code does after cleanupPeriodDays.
628func (claudeCode) canForget(src transcript, _ time.Time) (bool, error) {
629 t, ok := src.(claudeTranscript)
630 if !ok {
631 return false, fmt.Errorf("unexpected Claude Code transcript type %T", src)
632 }
633 return fileDeleted(t.path)
634}
636func (claudeCode) discover(context.Context, func(string) bool) ([]discoveredSession, error) {
637 return nil, nil
638}
640func fileDeleted(path string) (bool, error) {
641 _, err := os.Stat(path)
642 if errors.Is(err, fs.ErrNotExist) {
643 return true, nil
644 }
645 return false, err
646}
648func fileModTime(path string) (time.Time, error) {
649 info, err := os.Stat(path)
650 if errors.Is(err, fs.ErrNotExist) {
651 return time.Time{}, errTranscriptNotFound
652 }
653 if err != nil {
654 return time.Time{}, err
655 }
656 return info.ModTime(), nil
657}
659// scanJSONL calls fn for each complete line of the file at path after
660// offset, with the offset where the line starts. It returns the offset after
661// the last complete line, so a line still being written is read next time.
662func scanJSONL(path string, offset int64, fn func(line []byte, lineOffset int64)) (int64, error) {
663 f, err := os.Open(path)
664 if err != nil {
665 return offset, fmt.Errorf("could not open transcript: %w", err)
666 }
667 defer f.Close()
668 if _, err := f.Seek(offset, io.SeekStart); err != nil {
669 return offset, fmt.Errorf("could not seek transcript: %w", err)
670 }
672 r := bufio.NewReaderSize(f, 1024*1024)
673 for {
674 line, err := r.ReadBytes('\n')
675 if errors.Is(err, io.EOF) {
676 return offset, nil
677 }
678 if err != nil {
679 return offset, fmt.Errorf("error reading transcript: %w", err)
680 }
681 fn(line[:len(line)-1], offset)
682 offset += int64(len(line))
683 }
684}
686func (claudeCode) pausedReason() (string, error) {
687 settings, err := claudehooks.SettingsPath()
688 if err != nil {
689 return "", err
690 }
691 installed, err := claudehooks.SyncHookInstalled(settings)
692 if err != nil {
693 return "", err
694 }
695 if !installed {
696 return "the glab Stop hook is not installed in ~/" + claudehooks.SettingsFile, nil
697 }
698 return "", nil
699}
Diagnostics9 git calls · 221 ms
CallStatusSizeTime0221 ms
discover200185 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=185 git.server.agent=git/2.56.g1891de4-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=185 git.pkt.payload.max=35
ls-refs20058 KiB · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=59849 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=731 git.pkt.data=730 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=59849 git.pkt.payload.max=143 git.ls_refs.count=730 git.ls_refs.head=refs/heads/main
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=4273 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=4273 git.pkt.payload.max=4173 git.sideband.band1.bytes=4173 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=11 git.pack.bytes=4173 git.fetch.wide.objects=11 git.fetch.wide.extra_bytes=3930 git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=1 git.response.bytes=32926 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=22 git.pkt.data=20 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=32926 git.pkt.payload.max=32046 git.sideband.band1.bytes=32046 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=80 git.pack.bytes=32046 git.pack.ofs_delta=36 git.pack.ref_delta=0 git.pack.chain.max=2 git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91 git.pack.full=44Open pack map
fetchtree:02001.8 KiB · hit1 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=1857 git.response.cache=HIT git.response.duration_ms=1 git.fetch.filter=tree:0 git.fetch.wants=dce174ff8c632a19d17eea99c8a9b7c37fb2b592 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1857 git.pkt.payload.max=1830 git.sideband.band1.bytes=1830 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=1830 git.pack.trailer=fb03183b7909876778f740d196d7516811003517Open pack map
fetchtree:0200261 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=261 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=3bb9946301aa8c0dc8d202b83bc9f84bf0400f6d git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=261 git.pkt.payload.max=234 git.sideband.band1.bytes=234 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=234 git.pack.trailer=e0a52f164f79506da6b0dcc275ed62911f5383bfOpen pack map
fetchtree:0200139 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=139 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=f91da6c620e9fe39086f689d1ae91b87356cda50 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=139 git.pkt.payload.max=112 git.sideband.band1.bytes=112 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=112 git.pack.trailer=a35549813b2a01d473947912b5773e993ce7c2e2Open pack map
fetchtree:0200638 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=209 git.response.bytes=638 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=02089b627a9895becfd23127f25e46df629ce9b2 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=638 git.pkt.payload.max=611 git.sideband.band1.bytes=611 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=611 git.pack.trailer=f2a6246e346c2fa34e54ecb04cb1dd1c524f65bcOpen pack map
fetch2005.8 KiB209 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=5990 git.response.cache=MISS git.response.duration_ms=209 git.fetch.wants=4f2ff295e5a22090ba4d4ee53ab7d4ae2e29a753 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=5990 git.pkt.payload.max=5963 git.sideband.band1.bytes=5963 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://gitlab.com/gitlab-org/cli
- Ref
- refs/heads/main
- Commit
- 0dd7574dce9e385c5c30540e6c15657adc6bdce9
- cf-ray
- a5e2d104ed57cf3a
- Request
- e287cca0…
- Protocol
- v2 · sha1
- Agent
- git/2.56.g1891de4-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format