Skip to content

fix(event bus cron): cron event being marked as delivered after one successful run#2444

Open
viktormarinho wants to merge 1 commit intomainfrom
fix-event-bus-cron
Open

fix(event bus cron): cron event being marked as delivered after one successful run#2444
viktormarinho wants to merge 1 commit intomainfrom
fix-event-bus-cron

Conversation

@viktormarinho
Copy link
Contributor

@viktormarinho viktormarinho commented Feb 13, 2026

What is this contribution about?

Describe your changes and why they're needed.

Screenshots/Demonstration

Add screenshots or a Loom video if your changes affect the UI.

How to Test

Provide step-by-step instructions for reviewers to test your changes:

  1. Step one
  2. Step two
  3. Expected outcome

Migration Notes

If this PR requires database migrations, configuration changes, or other setup steps, document them here. Remove this section if not applicable.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Fixes cron events being marked as delivered after the first run. Cron events now stay pending between deliveries and are only marked delivered when the schedule is exhausted.

  • Bug Fixes
    • Worker marks cron events as delivered only when there is no next run.
    • Storage skips auto-marking cron events as delivered and adds markEventCompleted to set the final state.

Written for commit 8f5cf8a. Summary will update on new commits.

@github-actions
Copy link
Contributor

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Contributor

Release Options

Should a new version be published when this PR is merged?

React with an emoji to vote on the release type:

Reaction Type Next Version
👍 Prerelease 2.96.1-alpha.1
🎉 Patch 2.96.1
❤️ Minor 2.97.0
🚀 Major 3.0.0

Current version: 2.96.0

Deployment

  • Deploy to production (triggers ArgoCD sync after Docker image is published)

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/mesh/src/event-bus/worker.ts">

<violation number="1" location="apps/mesh/src/event-bus/worker.ts:410">
P2: `markEventCompleted` unconditionally sets the event to `delivered`, which can overwrite a `failed` status when the final cron run fails. This hides delivery failures for the last cron cycle.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

`[EventBus] Cron expression for event ${event.id} has no more runs`,
);
// Cron is exhausted — mark the event as delivered (terminal state)
await this.storage.markEventCompleted(event.id);
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 13, 2026

Choose a reason for hiding this comment

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

P2: markEventCompleted unconditionally sets the event to delivered, which can overwrite a failed status when the final cron run fails. This hides delivery failures for the last cron cycle.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/event-bus/worker.ts, line 410:

<comment>`markEventCompleted` unconditionally sets the event to `delivered`, which can overwrite a `failed` status when the final cron run fails. This hides delivery failures for the last cron cycle.</comment>

<file context>
@@ -406,6 +406,8 @@ export class EventBusWorker {
           `[EventBus] Cron expression for event ${event.id} has no more runs`,
         );
+        // Cron is exhausted — mark the event as delivered (terminal state)
+        await this.storage.markEventCompleted(event.id);
         return;
       }
</file context>
Fix with Cubic

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