Originally created by: adityaharishch
Summary
- Root cause:
pm_worklog_hours.status only ever leaves generating when the /worklog_hour call for that hour actually returns (success -> done, error -> reverted to pending). If the daemon process dies mid-call (crash, OOM kill, or a cargo-watch/launchd restart), the row is orphaned in generating permanently — nothing else re-checks it. Since hours are walked forward sequentially from the first not-done one, every hour after the stuck one silently never gets a ledger row either, so a single stuck hour blanks out the rest of the day on the timeline.
- Confirmed this is what happened live on my machine: a stuck 4-5pm hour blanked 5-6pm too; the LLM call layer itself is already safely bounded (90s subprocess timeout with
kill_on_drop), so this was specifically the missing crash-recovery path, not a hung call.
- Fix:
reset_stuck_generating_hours() in pm_worklog/ledger.rs, called once at daemon startup right next to the existing cleanup_incomplete_runs (the equivalent recovery the ETL pipeline already has) — any hour still generating from a previous run resets to pending and gets retried on the next tick.
Test plan
- [x]
cargo build / cargo clippy -- -D warnings / cargo fmt clean
- [x] Verified live: reset fired on daemon restart ("reset worklog hour(s) stuck in generating from a previous crash"), the previously-stuck hour flipped back to
pending and was picked up again
- [x] Full pre-push suite (fmt, clippy, cargo test, security audit) passed
Originally posted by: coderabbitai[bot]
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests - [ ] Commit unit tests in branch `fix/worklog-stuck-generating-recovery`Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)Comment
@coderabbitai helpto get the list of available commands.Ticket changed by: adityaharishch