Skip to content

fix: emit workflow.submitted on run submission - #536

Merged
pratyush618 merged 4 commits into
masterfrom
fix/python-workflow-submitted-event
Jul 24, 2026
Merged

fix: emit workflow.submitted on run submission#536
pratyush618 merged 4 commits into
masterfrom
fix/python-workflow-submitted-event

Conversation

@kartikeya-27

@kartikeya-27 kartikeya-27 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

EventType.WORKFLOW_SUBMITTED was defined but never emitted. It now fires from submit_workflow with {run_id, workflow_name}, and from sub-workflow submission with parent_run_id added.

Also fixes the events guide: worker event payload fields corrected (worker_id/queues, not hostname) and the workflow/saga/predicate events added to the payload table.

Regression tests: submit emits the event without a worker; child submission carries parent_run_id.

Part of #535.

Summary by CodeRabbit

  • New Features

    • Added WORKFLOW_SUBMITTED events for queued workflows and child workflows.
    • Submission events include workflow names, run identifiers, and parent run identifiers when applicable.
    • Expanded lifecycle event coverage for workflow completion, failure, cancellation, compensation, and predicate outcomes.
  • Documentation

    • Updated the event reference with new lifecycle events and revised worker and queue event payload details.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pratyush618, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6a62869c-2dcf-4fbe-935c-47168ff16fcb

📥 Commits

Reviewing files that changed from the base of the PR and between eb47e8d and e3c1f27.

📒 Files selected for processing (2)
  • sdks/python/taskito/workflows/mixins.py
  • sdks/python/tests/workflows/test_workflows_subworkflow.py
📝 Walkthrough

Walkthrough

Changes

Workflow submission events

Layer / File(s) Summary
Queue submission event contract and emission
docs/content/docs/python/guides/extensibility/events-webhooks.mdx, sdks/python/taskito/workflows/mixins.py, sdks/python/tests/workflows/test_workflows_linear.py
The event catalog is expanded, queue submission emits WORKFLOW_SUBMITTED with run_id and workflow_name, and linear workflow tests validate dispatch before worker startup.
Sub-workflow submission event emission
sdks/python/taskito/workflows/tracker/sub_workflows.py, sdks/python/tests/workflows/test_workflows_subworkflow.py
Sub-workflow submission emits child and parent run metadata, while tests verify the event and child workflow name.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant QueueWorkflowMixin
  participant EventBus
  participant SubWorkflowTracker
  Caller->>QueueWorkflowMixin: submit_workflow()
  QueueWorkflowMixin->>EventBus: emit WORKFLOW_SUBMITTED with run_id and workflow_name
  SubWorkflowTracker->>EventBus: emit WORKFLOW_SUBMITTED with child_run_id and parent_run_id
Loading

Suggested reviewers: pratyush618

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: emitting WORKFLOW_SUBMITTED when a workflow run is submitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/python-workflow-submitted-event

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

Comment @coderabbitai help to get the list of available commands.

@pratyush618

Copy link
Copy Markdown
Collaborator

@CodeRabbit full review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sdks/python/taskito/workflows/mixins.py`:
- Around line 94-98: Guard the _emit_event call in _inner.submit_workflow with
the same exception-handling pattern used by submit_sub_workflow, logging
delivery failures while allowing tracker.register_run() and the run-handle
return to proceed unchanged.

In `@sdks/python/tests/workflows/test_workflows_subworkflow.py`:
- Around line 75-87: Update the subworkflow event test around the
WORKFLOW_SUBMITTED listener to use a threading.Event that the callback sets
after appending the payload, then wait for that event after run.wait() and
before filtering or asserting child_events. Preserve the existing event
filtering and assertions, following the synchronization pattern used by the
linear submission-event test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f99e0469-721d-4cef-b316-1385962cc56d

📥 Commits

Reviewing files that changed from the base of the PR and between 6ada5b0 and eb47e8d.

📒 Files selected for processing (5)
  • docs/content/docs/python/guides/extensibility/events-webhooks.mdx
  • sdks/python/taskito/workflows/mixins.py
  • sdks/python/taskito/workflows/tracker/sub_workflows.py
  • sdks/python/tests/workflows/test_workflows_linear.py
  • sdks/python/tests/workflows/test_workflows_subworkflow.py

Comment thread sdks/python/taskito/workflows/mixins.py Outdated
Comment thread sdks/python/tests/workflows/test_workflows_subworkflow.py
@pratyush618
pratyush618 merged commit 2ed64a8 into master Jul 24, 2026
18 checks passed
@pratyush618
pratyush618 deleted the fix/python-workflow-submitted-event branch July 24, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants