Skip to content

feat(workflow): surface while-loop progress in compact events and UI#2178

Merged
daryllimyt merged 12 commits intomainfrom
feat/while-loop
Feb 27, 2026
Merged

feat(workflow): surface while-loop progress in compact events and UI#2178
daryllimyt merged 12 commits intomainfrom
feat/while-loop

Conversation

@daryllimyt
Copy link
Contributor

@daryllimyt daryllimyt commented Feb 24, 2026

Summary

  • fix do-while control action history so core.loop.start / core.loop.end no longer resolve to action_result: null in compact events
  • add explicit compact event fields for while-loop metadata that are distinct from existing loop_index (for_each):
    • while_iteration
    • while_continue
  • keep loop_index semantics unchanged for looped child-workflow fan-in
  • update event viewers to surface loop progress with:
    • numeric iteration badge (compact chip)
    • loop icon tooltip (Iteration N, continue/exit)
    • refined loop icon/background styling

Backend details

  • tracecat/dsl/workflow.py
    • _noop_loop_action() now injects the action's own stream-aware result into exec_context.ACTIONS[task.ref] before invoking noop loop activities, ensuring loop control payload is persisted
  • tracecat/workflow/executions/schemas.py
    • add while_iteration and while_continue to WorkflowExecutionEventCompact
  • tracecat/workflow/executions/service.py
    • extract while-loop metadata from wrapped result envelopes and populate new compact fields
    • preserve existing duplicate-collapse behavior and child-loop aggregation behavior

Frontend details

  • frontend/src/lib/event-history.ts
    • prefer new compact while fields for loop UI metadata, with fallback unwrapping for older payloads
  • frontend/src/components/executions/event-history.tsx
  • frontend/src/components/builder/events/events-workflow.tsx
    • show numeric iteration badge for loop start
    • show full progress string on loop icon tooltip
  • frontend/src/components/events/workflow-events-list.tsx
    • improved iteration badge styling/readability

Validation

  • uv run ruff check tracecat/dsl/workflow.py tracecat/workflow/executions/schemas.py tracecat/workflow/executions/service.py tests/unit/test_workflow_executions.py
  • uv run basedpyright tracecat/dsl/workflow.py tracecat/workflow/executions/schemas.py tracecat/workflow/executions/service.py tests/unit/test_workflow_executions.py
  • uv run pytest tests/unit/test_workflow_executions.py -q
  • pnpm -C frontend run typecheck

Summary by cubic

Adds do-while loop control flow (core.loop.start/end) and shows while-loop progress in compact events and the UI. Enforces a 2048-iteration cap; for_each behavior stays the same.

  • New Features

    • Added core.loop.start/end with scheduler support, loop region sync/validation, and registry entries.
    • Added compact fields while_iteration and while_continue; backend unwraps loop payloads and selects the latest loop meta per action.
    • UI: iteration chip, loop start/end icons with tooltips, and event rows surfacing latest loop progress; Quickstart docs include a Mermaid diagram and do-while semantics.
  • Bug Fixes

    • Persisted loop control payloads; loop start/end events no longer show action_result: null.
    • Enforced loop_end condition scope boundaries and aligned skip/boundary semantics.
    • Duplicate-collapse keeps the latest source event; normalized loop icon sizing; mapped Temporal UI to container port 8080 in dev.

Written for commit 5122b6a. Summary will update on new commits.

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.

2 issues found across 20 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tracecat/dsl/scheduler.py">

<violation number="1" location="tracecat/dsl/scheduler.py:379">
P1: When `_handle_loop_end` is called with `is_skipping=True`, it falls through to `_handle_success_path` instead of propagating the skip to downstream tasks. This means tasks after the loop will execute even when the entire loop was skipped. The skip branch should mark all outgoing edges as unreachable (like `_handle_loop_start` does) and return early.</violation>
</file>

<file name="frontend/src/components/builder/events/events-workflow.tsx">

<violation number="1" location="frontend/src/components/builder/events/events-workflow.tsx:366">
P3: Size styling is missing for loop status icons. `getWorkflowEventIcon` is called without the `size-5` class, so loop rows render larger icons than other rows and can overflow the 20px container.</violation>
</file>

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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62b6cee150

ℹ️ 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".

@blacksmith-sh

This comment has been minimized.

Copy link
Collaborator

@jordan-umusu jordan-umusu left a comment

Choose a reason for hiding this comment

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

LGTM, just one fix

Copy link
Collaborator

@jordan-umusu jordan-umusu left a comment

Choose a reason for hiding this comment

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

LGTM

@daryllimyt daryllimyt merged commit 148ece7 into main Feb 27, 2026
21 checks passed
@daryllimyt daryllimyt deleted the feat/while-loop branch February 27, 2026 02:24
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.

2 participants