fix(daemon): kick recommender on startup + don't burn the interval on a failed launch#151
Conversation
…l on a failed launch Two follow-ups from #150's debugging: - mm start now runs one recommender due-check pass immediately (any overdue managed repo fires now → auto-dispatch on completion) and nudges auto-dispatch for every managed repo, instead of idling until the first cron tick (up to a full interval). A fresh restart works in seconds, not 15 minutes. - The cron stamps last_recommender_run before firing (overlap guard) but now ROLLS IT BACK on a failed launch (setLastRecommenderRun to the prior value), so a failure retries on the next tick rather than going quiet for a full interval.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds rollback behavior for failed recommender runs. A new ChangesRecommender run rollback on failure
Sequence Diagram(s)sequenceDiagram
participant CronPass as Cron Pass
participant RepoConfig as Repo Config
participant Recommender as Recommender
CronPass->>RepoConfig: read last_recommender_run (prev)
CronPass->>CronPass: check if repo due
alt Repo is due
CronPass->>RepoConfig: setLastRecommenderRun(now)
CronPass->>Recommender: runRecommender
alt Succeeds with 202
Recommender-->>CronPass: 202
CronPass->>CronPass: stamp remains at now
else Throws
Recommender-->>CronPass: error
CronPass->>RepoConfig: setLastRecommenderRun(prev)
CronPass->>CronPass: log failure, repo due on next tick
end
else Repo not due
CronPass->>CronPass: skip
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
The two follow-ups noted while debugging #150 — both the "
mm startshould self-start, not idle" class.1. Startup kick —
mm startworks in seconds, not after a 15-min waitA fresh daemon used to idle until the first cron tick (up to a full
interval_minutes) before the recommender ran, and never kicked auto-dispatch against an already-ready state issue. Now, right after the crons start, the daemon:runRecommenderCronPass) — any overdue managed repo fires now → auto-dispatch on completion; andscheduleAutoDispatch) — so an already-ready#84from a prior run drains on restart without waiting for a fresh recommender pass.2. A failed launch no longer burns the full interval
The cron stamps
last_recommender_runbefore firing (overlap guard) — but a failed launch left that stamp, so the repo went quiet for a full interval before retrying. It now rolls the stamp back to the prior value on a failed launch (setLastRecommenderRun), so the failure retries on the next tick. (A successful run keeps its stamp.)What to verify
recommender-cron.test.ts.setLastRecommenderRunwrites a value and clears it withnull—repo-config.test.ts.This is the last bit of the walk-away loop: pull +
mm stop && mm startand the recommender fires within seconds, then the 15-min cron keeps it going.Summary by CodeRabbit
Release Notes
New Features
Bug Fixes