Skip to content

mini: auto-handoff: fix mtime prefilter hiding idle threads - #54

Merged
Jish2 merged 1 commit into
mainfrom
fix/auto-handoff-mtime-prefilter
Oct 21, 2026
Merged

Jish2 merged 1 commit into
mainfrom
fix/auto-handoff-mtime-prefilter

Conversation

@Jish2

@Jish2 Jish2 commented Oct 21, 2026

Copy link
Copy Markdown
Owner

The first live test thread (idle since 17:49, 122k context) was never handed off.

Cause: the watcher skipped any transcript whose mtime wasn't within the idle window ±5 minutes. But Claude Code appends last-prompt and cost-state records, which have no timestamp, about 30 minutes after a session goes quiet. That bumped the file's mtime to 18:19. During the 18:29–18:39 window the file looked only 10–20 minutes old, so it was never parsed. By the time its mtime was in range, the real idle time was past 50 minutes.

Fix: mtime is always at or after the last activity, so it only rules out sessions that are idle longer than the window. Keep only the upper bound.

Checked: on the same session with --idle-min 60 --idle-max 90, the old script doesn't consider it and the new one reports would send. A full run with the defaults takes 0.3 s.

🤖 Generated with Claude Code

Claude Code appends untimestamped last-prompt/cost-state records ~30 min
after a session goes quiet, bumping the transcript's mtime. The two-sided
prefilter then hid sessions that were inside the idle window (the first
live test thread was never considered). Keep only the upper bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jish2
Jish2 merged commit a024a42 into main Oct 21, 2026
1 check passed
@Jish2
Jish2 deleted the fix/auto-handoff-mtime-prefilter branch October 21, 2026 01:59
@claude

claude Bot commented Oct 21, 2026

Copy link
Copy Markdown

Claude review: skipped (PR is already merged/closed)

Checked only the PR state; no code review was run.

Not approved: the PR is already merged, so there is nothing to approve.

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