import: name copilot scanner buffer constant · Entire

import: name copilot scanner buffer constant

457c1a4→main·

computermode·3w ago·1 file·+6 added/-1 removed

Replace the bare 10*1024*1024 scanner-buffer magic number in copilotSessionInRepo with a documented maxCopilotLineBytes constant. No behavior change.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Sessions

b0226781fa86View transcript

Changes

1

15 unmodified lines

16
17
18
19
20
21
22
23
24
25
26
61 unmodified lines

88
89
90
86
91
92
93
94

15 unmodified lines

"github.com/entireio/cli/cmd/entire/cli/agent/types"
// maxCopilotLineBytes bounds the scanner buffer when reading events.jsonl;
// individual Copilot events (e.g. large tool payloads) can exceed bufio's
// default 64 KB line limit.
const maxCopilotLineBytes = 10 * 1024 * 1024

// copilotImporter imports Copilot CLI transcripts. Copilot stores sessions
// flat (~/.copilot/session-state/<id>/events.jsonl), not per-repo, so Discover
// reads each session's session.start event and keeps only those whose
61 unmodified lines

// Scan line-by-line and stop at the first session.start (normally line 0)
    // rather than slurping the whole transcript, which can be large.
    scanner := bufio.NewScanner(f)
    scanner.Buffer(make([]byte, 0, bufio.MaxScanTokenSize), 10*1024*1024) // 10 MB max line
    scanner.Buffer(make([]byte, 0, bufio.MaxScanTokenSize), maxCopilotLineBytes)
    for scanner.Scan() {
        var evt struct {
            Type string `json:"type"`