The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
handoff: raise scanHead line limit for fx to match MaxFrameBytes
Cursor Agent2ec8772ac314
diff --git a/cli/beacon/internal/handoff/claude.go b/cli/beacon/internal/handoff/claude.goindex 920af6e7..d20153a2 100644--- a/cli/beacon/internal/handoff/claude.go+++ b/cli/beacon/internal/handoff/claude.go@@ -29,7 +29,7 @@ type claudeHead struct {// index entry needs the cwd its transcript records.func readClaudeHead(path string) claudeHead {var head claudeHead- scanHead(path, func(line []byte) bool {+ scanHead(path, claudeHeadMaxLineSize, func(line []byte) bool {head.consume(line)return head.CWD != "" && head.GitBranch != "" && head.FirstPrompt != ""})@@ -38,16 +38,23 @@ func readClaudeHead(path string) claudeHead {// scanHead passes the first lines of a JSONL transcript to consume until it returns true, within// the listing bounds above. A listing opens every transcript, so it reads only its head.-func scanHead(path string, consume func(line []byte) (done bool)) {+// maxLineSize controls the largest single line the scanner will keep; lines longer than it are+// silently skipped so one huge tool result cannot stall a listing. maxBytes caps the total bytes+// read from the file.+func scanHead(path string, maxLineSize int, consume func(line []byte) (done bool)) {+ maxBytes := int64(claudeHeadMaxBytes)+ if int64(maxLineSize) > maxBytes {+ maxBytes = int64(maxLineSize) + int64(claudeHeadMaxBytes)+ }f, err := os.Open(path)if err != nil {return}defer f.Close()- reader := bufio.NewReaderSize(io.LimitReader(f, claudeHeadMaxBytes), 64<<10)+ reader := bufio.NewReaderSize(io.LimitReader(f, maxBytes), 64<<10)for lines := 0; lines < claudeHeadMaxLines; lines++ {- line, err := readBoundedLine(reader, claudeHeadMaxLineSize)+ line, err := readBoundedLine(reader, maxLineSize)if len(line) > 0 && consume(line) {return}diff --git a/cli/beacon/internal/handoff/fx.go b/cli/beacon/internal/handoff/fx.goindex ec909439..eba0f277 100644--- a/cli/beacon/internal/handoff/fx.go+++ b/cli/beacon/internal/handoff/fx.go@@ -89,7 +89,7 @@ type fxHead struct {// log. fx commits a whole turn, prompt included, as one line, so the first prompt is near the top.func readFxHead(path string) fxHead {var head fxHead- scanHead(path, func(line []byte) bool {+ scanHead(path, fxsession.MaxFrameBytes, func(line []byte) bool {event, err := fxsession.DecodeEnvelope(line)if err != nil {return falsediff --git a/cli/beacon/internal/handoff/fx_test.go b/cli/beacon/internal/handoff/fx_test.goindex 64bccb34..866885d2 100644--- a/cli/beacon/internal/handoff/fx_test.go+++ b/cli/beacon/internal/handoff/fx_test.go@@ -76,6 +76,22 @@ func TestListReadsFxSessions(t *testing.T) {}}+func TestFxOversizedFirstTurnStillListsTitle(t *testing.T) {+ testenv.SetHome(t, t.TempDir())+ isolateRuntimeEnv(t)+ sessions := filepath.Join(t.TempDir(), "fx-sessions")+ id := fxSessionA+ log := filepath.Join(sessions, id, "events.jsonl")++ bigReply := strings.Repeat("x", 2<<20) // 2 MiB reply makes the turn exceed 1 MiB+ writeFixture(t, log, fxStartedFrame(id, "/work/big")+fxTurnFrame(2, "deploy to prod", bigReply))++ head := readFxHead(log)+ if head.FirstPrompt != "deploy to prod" {+ t.Fatalf("readFxHead missed oversized turn: FirstPrompt = %q", head.FirstPrompt)+ }+}+func TestFxStoreMissingListsNothing(t *testing.T) {testenv.SetHome(t, t.TempDir())sessions, err := (&fxSource{dir: filepath.Join(t.TempDir(), "absent")}).List()diff --git a/cli/beacon/internal/handoff/pi.go b/cli/beacon/internal/handoff/pi.goindex 4c05b4f5..c9a81e2a 100644--- a/cli/beacon/internal/handoff/pi.go+++ b/cli/beacon/internal/handoff/pi.go@@ -165,7 +165,7 @@ func piHeaderBranch(header map[string]interface{}) string {// readPiFirstPrompt returns the first thing a person typed in a Pi-format transcript.func readPiFirstPrompt(path string) string {var prompt string- scanHead(path, func(line []byte) bool {+ scanHead(path, claudeHeadMaxLineSize, func(line []byte) bool {var entry struct {Type string `json:"type"`Message struct {