fix: extract session summaries from Claude JSONL files#96
fix: extract session summaries from Claude JSONL files#96AgentWrapper wants to merge 2 commits intomainfrom
Conversation
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Full JSONL file parsed twice per session per poll
Medium Severity
During each poll cycle, getSessionInfo() is called twice per active session — first in sessionManager.list() via enrichSessionWithRuntimeState(), then again in checkSession(). Since getSessionInfo() reads and parses entire JSONL conversation files (which grow with every message), this doubles the file I/O on every poll interval. The session object passed to checkSession already has agentInfo populated from enrichment, so the lifecycle manager could use session.agentInfo?.summary instead of re-invoking getSessionInfo().
Additional Locations (1)
Fix toClaudeProjectPath() encoding bug that prevented JSONL file discovery - the function was stripping the leading / before encoding, producing "Users-equinox-..." while Claude's actual directories are "-Users-equinox-...". Add live agent info enrichment in session manager so the dashboard gets summaries, cost estimates, and agent session IDs on every refresh. Add background summary persistence in lifecycle manager polling so summaries survive dashboard restarts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e067b9a to
a5655ae
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| const info = await agent.getSessionInfo(session); | ||
| if (info?.summary && info.summary !== session.metadata?.["summary"]) { | ||
| const sessionsDir = getSessionsDir(config.configPath, project.path); | ||
| updateMetadata(sessionsDir, session.id, { summary: info.summary }); |
There was a problem hiding this comment.
Newlines in summary corrupt metadata file format
Medium Severity
The summary from getSessionInfo (sourced from JSONL files) can contain newline characters — either from Claude's auto-generated summaries or from multi-line user prompts used as fallback. Writing this unsanitized value via updateMetadata into the newline-delimited key=value metadata format corrupts the file. On the next read, the summary is silently truncated at the first newline, and any subsequent lines containing = overwrite other metadata keys like status or pr.


Summary
toClaudeProjectPath()encoding bug — the function stripped the leading/before encoding, producingUsers-equinox-...while Claude's actual project directories are-Users-equinox-.... This was the root cause ofgetSessionInfo()never finding JSONL files.enrichSessionWithRuntimeState()so the dashboard gets summaries, cost estimates, and agent session IDs on every refresh.Before/After
Before: Sessions without PRs show generic info:
After: Sessions show actual agent summaries:
Test plan
pnpm buildsucceeds~/.claude/projects/directories🤖 Generated with Claude Code