fix(tables): workflow-column run fixes + bounded run-N-rows#4754
Conversation
- Pass group.autoRun as the add-group dispatch flag so an autoRun=false
column no longer opens a no-op dispatch that flashes the run-count badge.
- Scope the context-menu re-run to the right-clicked workflow cell's group
(cascading to dependents) instead of every group on the row.
- Add an extensible per-dispatch row cap (DispatchLimit { type:'rows', max })
surfaced as "Run 10 / 1,000 empty rows" in the group header; dispatcher
stops after N eligible rows. New limit/processed_count columns on
table_run_dispatches.
- Fix stranded "Queued" cells: the cascade owner now treats a queued marker
(orphan pre-stamp) as a manual run so autoRun=false requested groups are
picked up, and drains late markers before releasing the row lock.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…dependency # Conflicts: # apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
Re-numbers the table_run_dispatches limit/processed_count columns from the collided 0212 to 0214 after merging staging (which added its own 0212/0213). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview UI: Workflow group headers expose “Run 10 / 1,000 empty rows”; right-click on a workflow cell scopes Run/Re-run to that group (labels “Run cell” / “Re-run cell”) and classifies status per group. Reliability: Queued markers ( Reviewed by Cursor Bugbot for commit ffa8bd3. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR fixes several workflow-column bugs and adds bounded "run N rows" capability. The
Confidence Score: 5/5Safe to merge — all changed paths are additive (new DB columns with defaults, new optional request field, new constant) and the bug fixes are narrowly scoped to the dispatcher step and cascade lock handoff. The two concerns raised in the previous review round (budget counter advancing on failed batches, and the terminal SSE missing the limit field) are both addressed. The dispatchedRows = 0 reset in the catch block correctly prevents cap consumption on transient failures. The completeDispatch helper now spreads dispatch.limit into the SSE event. The outer cascade re-drive loop is guarded by an explicit hasQueuedMarker check, preventing infinite re-triggering of auto-eligible groups. Schema migration is non-breaking (both columns have defaults). Test coverage for the queued-marker handoff is included. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as Client UI
participant API as /columns/run API
participant WC as workflow-columns.ts
participant D as dispatcher.ts
participant BG as workflow-column-execution.ts
participant DB as Database
UI->>API: "POST runColumn { groupIds, limit: { type:'rows', max:10 } }"
API->>WC: "runWorkflowColumn({ limit })"
WC->>DB: "insertDispatch({ limit, processedCount:0 })"
WC-->>UI: "{ dispatchId }"
Note over D: dispatcherStep loop
loop Per window
D->>DB: fetch chunk of rows
D->>D: buildPendingRuns → filter to allowed rowIds (≤ remaining)
D->>DB: stampQueuedForBatch(windowRuns)
D->>BG: batchEnqueueAndWait(windowRuns)
alt Batch succeeds
D->>DB: incrementProcessedCount(+dispatchedRows)
alt budgetExhausted
D->>DB: markDispatchComplete
D->>UI: SSE dispatch complete (limit included)
else budget remains
D->>DB: advanceCursor
D->>UI: SSE dispatch dispatching
end
else Batch fails
D->>D: "reset dispatchedRows=0, budgetExhausted=false"
D->>DB: flip pre-stamps → error
D->>UI: SSE cell error per row
end
end
Note over BG: Per-cell cascade + queued-marker handoff
BG->>DB: withCascadeLock → runRowCascadeLoop
loop Cascade groups
BG->>DB: runWorkflowAndWriteTerminal
BG->>DB: pickNextEligibleGroupForRow(excludeCurrentGroup)
end
BG->>DB: release lock
BG->>DB: getRowById (fresh)
BG->>BG: pickNextEligibleGroupForRow (no exclude)
alt queued marker found (pending + no executionId)
BG->>DB: re-acquire lock with new executionId
BG->>DB: run queued-marker group
else no marker
BG->>BG: break
end
Reviews (2): Last reviewed commit: "chore(lint): format generated tool-schem..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a7bc6ea. Configure here.
- Don't consume the row cap when batchEnqueueAndWait fails; a transient failure no longer completes a capped dispatch with zero rows started. - Outer cascade-drain loop only re-drives a genuine queued marker, not any eligible group, so an empty-output group can't re-run forever. - completeDispatch forwards limit on the terminal SSE event. - Extract shared LIMITED_RUN_PRESETS for the Run-N-rows menu items.
|
@greptile review |

Summary
group.autoRunas the dispatch flag, so anautoRun: falsecolumn stops opening a no-op dispatch that briefly showed "N running."{ type: 'rows', max }) surfaced as "Run 10 / 1,000 empty rows" in the workflow-group header. The dispatcher stops after N eligible rows; the overlay/optimistic stamping skip capped runs. Addslimit+processed_countcolumns ontable_run_dispatches(migration0214).autoRun: falsegroup used to stick on Queued forever. The cascade owner now treats the queued marker (orphan pre-stamp) as a manual run and picks it up, and drains late markers before releasing the lock. No re-enqueue / polling.Type of Change
Testing
Tested manually.
tsc --noEmitclean;check:api-validation:strictpasses; 161 table tests pass (incl. newworkflow-columns.test.tscovering the queued-marker handoff). Merged lateststagingbefore shipping.Checklist