fix: Return empty events for resume with missing/cursorless session - #100
Conversation
When get_events() is called with resume=True but the session doesn't exist or has no saved cursor, return empty events instead of falling through to return all historical events from the beginning. This fixes issue #99 where CLI --resume flag would flood users with stale events from December when the session wasn't properly registered. Fixes #99 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryThis PR fixes a bug where Issues FoundCriticalNone ImportantNone SuggestionsNone VerdictAPPROVE - Code looks good, no issues found. The fix is minimal and targeted, correctly addressing the bug described in #99. The two new tests provide good coverage for both failure scenarios (nonexistent session and session without cursor). The debug logging is properly guarded since Automated review by Claude Code |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryThis PR fixes a bug where Issues FoundCriticalNone ImportantNone SuggestionsNone VerdictAPPROVE - The fix is minimal and correctly addresses the issue described in #99. Key observations:
Automated review by Claude Code |
- Raw API responses moved to top (data model first) - Conversations reordered by research interest: collaborative debugging, cross-repo negotiation, planning/delegation/verification - Added full performance debugging thread (14 events over 3 days) - Added ingestion automation planning + data validation conversation - Added cascading bug chain (#99 -> #100 -> #102) as own section - Pattern annotations explain emergent dynamics (fan-out, escalation, hypothesis elimination, asymmetric channel targeting) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add example agent communications with raw API responses Real conversations between Claude Code sessions extracted from the live event bus. Includes curated examples organized by communication pattern (coordination, debugging, cross-repo collaboration, knowledge sharing, infrastructure setup, social) plus raw JSON API responses for agent researchers showing the actual get_events, list_sessions, and list_channels formats. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: restructure for multi-agent dynamics researchers - Raw API responses moved to top (data model first) - Conversations reordered by research interest: collaborative debugging, cross-repo negotiation, planning/delegation/verification - Added full performance debugging thread (14 events over 3 days) - Added ingestion automation planning + data validation conversation - Added cascading bug chain (#99 -> #100 -> #102) as own section - Pattern annotations explain emergent dynamics (fan-out, escalation, hypothesis elimination, asymmetric channel targeting) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: address reviewer feedback on EXAMPLE_COMMS.md - Add note about pre-rename repo names (claude-event-bus → agent-event-bus) - Redact infrastructure identifiers (hostnames, Tailscale URLs, paths) - Fix methodology contradiction (Status Broadcasts noted as supplementary) - Consolidate duplicate Infrastructure Setup content - Replace Python pseudocode with actual MCP tool parameters Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
get_events(resume=True)to return empty events when session doesn't exist or has no saved cursorProblem
When
--resumewas used with a session that either:last_cursorThe code would fall through to the default behavior, returning ALL events from the beginning (event #1 from December 2025). This broke the
prompt-events.shhook which relies on--resumefor incremental polling.Solution
Add an early return when
resume=Truebut no cursor is available, returning empty events with a validnext_cursorfor future polling. This treats the session as "caught up".Test plan
test_resume_with_nonexistent_session_returns_emptytest_resume_with_session_without_cursor_returns_emptyFixes #99
🤖 Generated with Claude Code