Repository navigation
Pause automations after 3 consecutive failures (#160) - #1580
Conversation
Count launch throws immediately and runs that end with thread status "failed" on the next scheduler tick. At 3 in a row the automation is set enabled=false with a "Paused after N consecutive failures" error and a desktop notification. Re-enabling resets the streak. The Automations view refetches on open so a background pause is visible. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2fcf17ad4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| useEffect(() => { | ||
| if (view === "automations") void refreshAutomations().catch(() => {}); | ||
| }, [view, refreshAutomations]); |
There was a problem hiding this comment.
Keep an open Automations view synchronized
Refresh while the Automations view remains open, not only when view changes. If the user is already on this view when the scheduler auto-pauses an automation, this effect never runs again because refreshAutomations is stable, and there is no automation-change subscription or polling elsewhere. The row therefore continues to show On and omits the pause reason until the user navigates away and back or performs another action.
Useful? React with 👍 / 👎.
| if (pause && typeof ctx.notify === "function") { | ||
| try { | ||
| ctx.notify({ id, name: auto.name, message: lastError }); |
There was a problem hiding this comment.
Pass the pause notifier through Run Now
Ensure the automations:runNow path supplies the same notifier as the scheduler. A launch failure from Run Now reaches this branch with the IPC context, but makeCtx does not expose notify; therefore, when a manual launch is the third consecutive failure, the automation is disabled without the promised desktop notification. Only scheduled failures receive the notifier passed directly to startScheduler in main.js.
Useful? React with 👍 / 👎.
Closes #160.
What
consecutiveFailures): a launch throw counts immediately; a run that launches and later ends with thread statusfailedis settled on the next scheduler tick viapendingRunThreadId(startRun resolves at launch, not at run end).enabled=false,lastErrorreads "Paused after 3 consecutive failures. Last: …", and a desktop notification fires once.Not built
Tests
electron/test/automations.test.js: pause after 3 (launch throw + two runtime failures), pause blocks the next fire, single notify, re-enable resets; finished run resets streak.npm run test:electronwith CI-comparable env: 4519 pass / 0 fail / 0 cancelled.🤖 Generated with Claude Code