Commit 58e86c5
fix(terminal): correct error/cancel block status in logs panel
Three bugs in the workflow editor's terminal/logs panel where block
status diverged from the engine's truth on error paths:
1. **Errored block shown as "canceled"** — when the SSE 'add' mode
produced a duplicate entry on block error and `cancelRunningEntries`
then swept the original placeholder.
2. **Upstream blocks stuck on "Running"** — terminal events arrived
before the engine's last block events under reconnect/timeout, so
the live panel never received the per-block terminal state.
3. **Phantom "Run Error" pseudo-row** — the failing block rendered as
"canceled" while a synthetic row carried the real error text.
Fixes:
- **Fix B** (`addConsoleErrorEntry`): when a running placeholder exists
for `(blockId, executionId)`, route through `updateConsoleErrorEntry`
instead of creating a second entry. Aligns 'add' mode with the
existing 'update' mode behavior.
- **Fix C** (`reconcileFinalBlockLogs`): terminal SSE events now carry
`finalBlockLogs` (server-authoritative snapshot). On
execution:error / execution:cancelled, reconcile any still-running
entries with their server-side terminal state. Recovers correctness
on network drop, server timeout/abort, and reconnect-resume paths
where individual block:* events may not have reached the client.
- **Fix D** (`addExecutionErrorConsoleEntry`): cross-check
`useTerminalConsoleStore` for entries with `error` set scoped to the
executionId before emitting the synthetic "Run Error" row. Suppresses
the phantom row when the failing block already carries the message.
- **Signature refactor**: `handleExecutionErrorConsole` /
`handleExecutionCancelledConsole` now take a typed
`ExecutionConsoleDeps` object instead of stacking positional deps —
matches the existing `createBlockEventHandlers(config, deps)`
precedent in the same file.
Tests:
- 12 tests in `workflow-execution-utils.test.ts` covering Fix B/C/D and
the deps-object signature refactor.
- Centralized terminal-console store mock in `@sim/testing` so future
tests can stub the store without per-file boilerplate.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 220f8c8 commit 58e86c5
9 files changed
Lines changed: 587 additions & 40 deletions
File tree
- apps/sim
- app
- api/workflows/[id]/execute
- workspace/[workspaceId]/w/[workflowId]
- hooks
- utils
- lib/workflows/executor
- stores/terminal/console
- packages/testing/src/mocks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1165 | 1165 | | |
1166 | 1166 | | |
1167 | 1167 | | |
| 1168 | + | |
1168 | 1169 | | |
1169 | 1170 | | |
1170 | 1171 | | |
| |||
1178 | 1179 | | |
1179 | 1180 | | |
1180 | 1181 | | |
| 1182 | + | |
1181 | 1183 | | |
1182 | 1184 | | |
1183 | 1185 | | |
| |||
1242 | 1244 | | |
1243 | 1245 | | |
1244 | 1246 | | |
| 1247 | + | |
1245 | 1248 | | |
1246 | 1249 | | |
1247 | 1250 | | |
| |||
Lines changed: 24 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
219 | 220 | | |
220 | 221 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
225 | 226 | | |
226 | | - | |
| 227 | + | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
231 | 237 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
236 | 242 | | |
237 | | - | |
| 243 | + | |
238 | 244 | | |
239 | 245 | | |
240 | 246 | | |
| |||
1226 | 1232 | | |
1227 | 1233 | | |
1228 | 1234 | | |
| 1235 | + | |
1229 | 1236 | | |
1230 | 1237 | | |
1231 | 1238 | | |
| |||
1252 | 1259 | | |
1253 | 1260 | | |
1254 | 1261 | | |
| 1262 | + | |
1255 | 1263 | | |
1256 | 1264 | | |
1257 | 1265 | | |
| |||
1739 | 1747 | | |
1740 | 1748 | | |
1741 | 1749 | | |
| 1750 | + | |
1742 | 1751 | | |
1743 | 1752 | | |
1744 | 1753 | | |
| |||
1751 | 1760 | | |
1752 | 1761 | | |
1753 | 1762 | | |
| 1763 | + | |
1754 | 1764 | | |
1755 | 1765 | | |
1756 | 1766 | | |
| |||
1999 | 2009 | | |
2000 | 2010 | | |
2001 | 2011 | | |
| 2012 | + | |
2002 | 2013 | | |
2003 | 2014 | | |
2004 | | - | |
| 2015 | + | |
2005 | 2016 | | |
2006 | 2017 | | |
2007 | 2018 | | |
| |||
2018 | 2029 | | |
2019 | 2030 | | |
2020 | 2031 | | |
| 2032 | + | |
2021 | 2033 | | |
2022 | 2034 | | |
2023 | 2035 | | |
| |||
0 commit comments