Skip to content

send reaped sessions from the session-start that reaped them - #124

Closed
iPeluwa wants to merge 1 commit into
iamnotstatic:mainfrom
iPeluwa:flush-on-reap
Closed

iPeluwa wants to merge 1 commit into
iamnotstatic:mainfrom
iPeluwa:flush-on-reap

Conversation

@iPeluwa

@iPeluwa iPeluwa commented Oct 18, 2026

Copy link
Copy Markdown

Problem

A session whose wrapper dies without a clean exit (closed terminal, killed process) stays at exitCode: -1 until the reaper finalizes it at the next session-start. But nothing flushes it afterwards: flushPendingSubmissions runs on clean ends, and a reaped session's only other trigger is another session ending cleanly. If sessions keep dying uncleanly — laptop sleep, closed tabs — reaped work sits unsubmitted indefinitely. I lost a 13-commit session this way this week.

Fix

  • refreshAndReap() / reapOrphanedSessions() / refreshRecentSessions() now return how many sessions they settled.
  • onSessionStart calls flushPendingSubmissions when that count is non-zero, so the session-start that reaps a session also sends it. Quiet starts still spend no time on the network.

Tests

test/flush-on-reap.test.mjs (3 cases): reap returns count and submits; clean-end re-finalize keeps momentum; no flush on a start that settled nothing.

@iPeluwa

iPeluwa commented Oct 21, 2026

Copy link
Copy Markdown
Author

Closing — keeping these fixes local rather than upstreaming. Thanks!

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.

1 participant