Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Subflow logs rendering should be accurate.

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 11, 2026 4:40am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR fixes subflow log rendering by threading a stable subflow identifier (iterationContainerId) through the execution pipeline (executor iteration context → SSE events → UI console store) and updating the terminal tree builder to group iterations by (iterationType, iterationContainerId, iterationCurrent).

It also tightens console update targeting by allowing updateConsole to match on executionOrder/iteration metadata, which helps avoid updating the wrong entry when the same blockId appears multiple times within an execution (e.g., repeated iterations).

Key areas touched:

  • Executor iteration context/type updates (IterationContext now includes iterationContainerId, and iterationTotal becomes optional)
  • SSE event payload typing + event emission includes iterationContainerId
  • Terminal UI grouping logic now separates subflows by container id
  • Console store update matching optionally includes executionOrder and iterationContainerId

Confidence Score: 3/5

  • This PR is likely correct but has a couple of edge cases that can break console updates or subflow grouping.
  • The core change (adding iterationContainerId and grouping by it) is consistent across executor → SSE → UI. However, tightening update matching on executionOrder can prevent updates after hydration/refresh, and iterationContainerId can still be undefined for parallel branches if parallelId is missing, collapsing groups to 'unknown'. Also, the new per-block info logging in the API route may be too noisy for production.
  • apps/sim/stores/terminal/console/store.ts; apps/sim/executor/execution/block-executor.ts; apps/sim/app/api/workflows/[id]/execute/route.ts

Important Files Changed

Filename Overview
apps/sim/app/api/workflows/[id]/execute/route.ts Propagates iterationContainerId into SSE block events emitted by the execution route.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/utils.ts Changes terminal log tree grouping to include iterationContainerId when creating subflow/iteration synthetic nodes.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts Includes iterationContainerId and executionOrder in console updates so subflow logs can be grouped/updated correctly.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts Propagates iterationContainerId from SSE events into console entries during full-logging execution.
apps/sim/executor/execution/block-executor.ts Extends executor iteration context to include iterationContainerId and makes iterationTotal optional.
apps/sim/executor/execution/types.ts Updates IterationContext type: iterationTotal optional, adds iterationContainerId optional.
apps/sim/lib/workflows/executor/execution-events.ts Adds iterationContainerId to SSE event data and callback typing for block started/completed/error.
apps/sim/stores/terminal/console/store.ts Refines updateConsole matching to also consider executionOrder and iterationContainerId when provided.
apps/sim/stores/terminal/console/types.ts Extends ConsoleEntry/ConsoleUpdate with iterationContainerId and executionOrder.

Sequence Diagram

sequenceDiagram
  participant Exec as BlockExecutor
  participant SSE as createSSECallbacks
  participant API as /api/workflows/[id]/execute (SSE)
  participant UI as useWorkflowExecution
  participant Store as TerminalConsoleStore
  participant Term as Terminal buildEntryTree

  Exec->>SSE: onBlockStart(blockId,..., executionOrder, IterationContext)
  SSE->>API: sendEvent block:started {iterationContainerId}
  API->>UI: SSE message block:started
  UI->>Store: addConsole/updateConsole (executionOrder, iterationContainerId)
  Store->>Term: groupEntriesByExecution -> buildEntryTree
  Term-->>UI: Render subflow/iteration grouping by (iterationType, iterationContainerId, iterationCurrent)

  Exec->>SSE: onBlockComplete(..., callbackData, IterationContext)
  SSE->>API: sendEvent block:completed|block:error {iterationContainerId}
  API->>UI: SSE message block:completed|block:error
  UI->>Store: updateConsole (matches by blockId+executionId+executionOrder+iteration*)
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

9 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Additional Comments (1)

apps/sim/app/api/workflows/[id]/execute/route.ts
Verbose per-block logging

The new logger.info calls inside SSE callbacks (onBlockStart / onBlockComplete) will run for every block event and can generate very high log volume in production. Since this is on the request path for SSE runs, it will also add noise to logs even for normal executions.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@icecrasher321 icecrasher321 merged commit af01dce into staging Feb 11, 2026
12 checks passed
@icecrasher321 icecrasher321 deleted the fix/terminal-console-subflows branch February 11, 2026 05:16
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