Skip to content

fix: save cursor on early return in get_events resume path - #103

Merged
evansenter merged 1 commit into
mainfrom
fix/resume-cursor-persistence
Feb 7, 2026
Merged

fix: save cursor on early return in get_events resume path#103
evansenter merged 1 commit into
mainfrom
fix/resume-cursor-persistence

Conversation

@evansenter

Copy link
Copy Markdown
Owner

Summary

  • Persist cursor on the early return path in get_events when resume=True encounters a session without a saved cursor
  • Without this fix, sessions perpetually hit the "no cursor" branch and never see new events via --resume
  • Added regression test verifying subsequent resume calls pick up new events

Fixes #102

Test plan

  • New regression test test_resume_saves_cursor_on_early_return validates end-to-end behavior
  • All 294 existing tests pass
  • Format and lint clean (ruff format --check, ruff check)

🤖 Generated with Claude Code

When resume=True encounters a session without a saved cursor, the early
return path now persists the current high-water mark so subsequent resume
calls can pick up new events. Without this, sessions would perpetually
hit the "no cursor" branch and never see new events.

Fixes #102

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Feb 7, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

Fixes a bug where get_events with resume=True never saved the cursor on the early return path (no prior cursor exists), causing subsequent resume calls to perpetually return empty results. Adds a regression test validating the fix.

Critical

None

Important

None

Suggestions

None

Verdict

APPROVE - The fix is minimal, correct, and well-tested. The if session and next_cursor is not None guard properly handles both edge cases (non-existent session and empty event table). The regression test directly validates the end-to-end behavior described in #102.


Automated review by Claude Code

@evansenter
evansenter merged commit 22a70bb into main Feb 7, 2026
5 checks passed
@evansenter
evansenter deleted the fix/resume-cursor-persistence branch February 7, 2026 03:32
evansenter added a commit that referenced this pull request Mar 31, 2026
… tests (#114)

Split the resume early-return branch into two distinct paths:
- Session exists but no cursor: persist tip cursor (builds on #103)
- Session doesn't exist: return {"error": "Session not found"} instead
  of silently returning empty events

Add regression tests for rapid polling event loss and pre-existing event
filtering with resume=True.

Fixes #114

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
evansenter added a commit that referenced this pull request Mar 31, 2026
* docs: Add design spec for resume cursor persistence fix (#114)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: Return error for resume with nonexistent session, add regression tests (#114)

Split the resume early-return branch into two distinct paths:
- Session exists but no cursor: persist tip cursor (builds on #103)
- Session doesn't exist: return {"error": "Session not found"} instead
  of silently returning empty events

Add regression tests for rapid polling event loss and pre-existing event
filtering with resume=True.

Fixes #114

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: Address review feedback — clarify test differentiation, fix stale line refs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_events resume=True doesn't save cursor on early return

1 participant