Skip to content

feat(effects): resume reminders when repeats are raised - #628

Open
ccf-lisa[bot] wants to merge 1 commit into
effectors/27-closed-streamsfrom
effectors/28-resume-repeats
Open

ccf-lisa[bot] wants to merge 1 commit into
effectors/27-closed-streamsfrom
effectors/28-resume-repeats

Conversation

@ccf-lisa

@ccf-lisa ccf-lisa Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What

Raising a rule action's repeats resumes the reminders of its finished effects (user decision: raising max_repeats, or changing repeat, must resume reminders of finished effects).

  • PUT /api/rules/{id}/actions/{actionId} sets RepeatsChanged on the ActionChanged change when repeat or max_repeats changed.
  • In the change's transaction, the engine (Machine.ResumeAction) takes every finished effect of the action on its current agent and effector action that has repeats left: repeat set and max_repeats either unset (0, unlimited) or above the effect's repeat_count. Each goes back to active with its repeat count and last_repeat_at kept.
  • Nothing is delivered at that moment. The next tick is scheduled at last_repeat_at + repeat, or now when that has passed. That tick delivers repeated, or finished when the count reaches the new max_repeats.
  • The usual re-evaluation of the action (backfill) still runs. A resumed effect whose repeat is already due may repeat during that backfill rather than its tick; either way it's one delivery.

Edge cases (what the code does)

  • repeat changed but the effect is still at its max (repeat_count >= max_repeats): stays finished.
  • repeat removed (0): nothing resumes, whatever max_repeats says.
  • max_repeats cleared (unlimited) with repeat set: resumes, and repeats until the condition clears.
  • Lowering max_repeats to or below an active effect's count delivers nothing at change time: its next repeat finishes it, delivered as finished with the count it reached (for example 2 with max_repeats lowered to 1).
  • Changes that don't touch repeat or max_repeats (target, delay, params) leave finished effects alone. A disabled rule's changes don't reach the engine, and a repointed action's effects are cleared and start from scratch, as before.

Docs: user-interface.md ("How often an action fires": raising repeats resumes; the action edit table), triggers.md (state diagram finished --> active: repeats raised, transitions table), lld/poc-followups.md (item 12, decided). The route's swagger description says so too.

Tests

  • Integration (effects): finished at max 2 → raise to 4 → active, nothing delivered, tick one interval after the last repeat → repeated (3) → finished at 4, nothing after; at max, a repeat-only change leaves it finished, then clearing max_repeats resumes it with the overdue repeat fired at once; no resume without raised repeats (a change without RepeatsChanged, a lowered max); lowering max below an active effect's count finishes it at the next repeat.
  • Integration (handler): a repeat change carries RepeatsChanged.

Part of the effectors plan: docs/effectors/lld/implementation-plan.md.

Gate

On this branch: go build ./... pass; go vet -tags integration ./... pass; golangci-lint v2.15.0 (shared CI config) 0 new issues; make test pass; make swag no diff (regenerated docs/ committed here: the route description); go mod tidy no diff; go test -tags integration -p 1 on internal/service/effects and internal/api/handler/... pass.

Size

Counted: 230 lines (added + removed, tests included; docs/docs.go and docs/swagger.* excluded).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5a153b02-3df0-42ae-9976-1b7564c655c1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@ccf-lisa
ccf-lisa Bot added this pull request to stack #604 December 2, 2026 11:08
@ccf-lisa
ccf-lisa Bot force-pushed the effectors/28-resume-repeats branch from 54ed785 to f618101 Compare December 2, 2026 12:07
ccf-lisa Bot added a commit that referenced this pull request Dec 2, 2026
Stack 3 as built (#619-#626) with counted lines, #613's count, and the
two decided follow-ups (#627 closed streams, #628 resumed repeats).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Changing a rule action's repeat or max_repeats resumes its finished
effects that have repeats left: active again with the repeat count kept,
nothing delivered then, the next repeat one interval after the last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gusfcarvalho gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ccf-review: APPROVE

no findings.

Stack (gh stack 604): #592 → #593 → #594 → #595 → #596 → #597 → #598 → #599 → #600 → #601 → #602 → #603 → #605 → #606 → #607 → #608 → #609 → #610 → #611 → #612 → #613 → #614 → #615 → #616 → #617 → #618 → #619 → #620 → #621 → #622 → #623 → #624 → #625 → #626 → #627 → #628 → #629 → #630

This branch has not been deployed

No deployments
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