fix: read 200 tail lines to find preview through progress noise

Claude Code emits many progress lines during work, burying the last
assistant text. 5 lines was not enough to reach it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pierre Martin
2026-03-23 21:21:31 +01:00
parent dc1ec72056
commit 421bff8f73
2 changed files with 3 additions and 3 deletions

View File

@@ -188,7 +188,7 @@ func FindSessionForProcess(claudeDir string, proc Process) (string, []JSONLMessa
})
newest := topLevel[0]
messages, err := TailReadJSONL(newest, 5)
messages, err := TailReadJSONL(newest, 200)
if err != nil {
return "", nil, err
}

View File

@@ -63,8 +63,8 @@ func DetectState(messages []JSONLMessage, now time.Time) SessionState {
return Unknown
}
// ExtractPreview finds the last assistant text content and returns the first
// 5 lines, truncated to 300 characters.
// ExtractPreview finds the last assistant text content and returns
// the first 5 lines, truncated to 300 characters.
func ExtractPreview(messages []JSONLMessage) string {
for i := len(messages) - 1; i >= 0; i-- {
msg := messages[i]