fix(terminal): use wall-clock duration for loop iterations with concurrent children#4443
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Adds a focused regression test suite in Reviewed by Cursor Bugbot for commit 2c729c0. Configure here. |
Greptile SummaryThis PR fixes a bug where terminal/console view showed rapidly-climbing iteration durations (e.g. 18m → 20m → 22m) for workflows with a parallel block nested inside a loop. The root cause was that Confidence Score: 5/5Safe to merge — minimal targeted fix with comprehensive regression coverage and no side-effects on other code paths. The change is a two-line deletion and replacement with the simpler wall-clock expression. Wall-clock is strictly correct for both sequential and parallel cases. All 9 new tests and the full 22/22 suite pass. No pre-existing logic is removed that would be needed for other display paths. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as Terminal UI
participant BET as buildEntryTree()
participant Old as Old Logic
participant New as New Logic
UI->>BET: ConsoleEntry[] (loop + parallel children)
Note over BET: Build subflow groups per iterationContainerId
BET->>Old: iterationType === 'parallel' ?
Old-->>BET: wallClock (parallel) OR sum(durationMs) (loop) — BUG: loop children can be parallel!
BET->>New: always wallClock = max(endedAt) − min(startedAt)
New-->>BET: correct wall-clock duration
BET-->>UI: EntryNode[] with correct durationMs for iterations & subflows
Reviews (1): Last reviewed commit: "fix(terminal): use wall-clock duration f..." | Re-trigger Greptile |
Summary
utils.tswas summing childdurationMsfor loop iteration containers. When children were concurrent parallel branches, each completing branch added its full duration to the displayed iteration time, over-counting by ~Nx.max(endedAt) − min(startedAt)) for synthetic subflow and iteration entries, regardless ofiterationType. Matches the post-run trace span builder's behavior.Type of Change
Testing
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/utils.test.tsbun run lintpassesbun run check:api-validation:strictpassesChecklist