Skip to content

fix(api): match pause points with jsonb_path_exists so a status-filtered run list stays fast - #9971

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/pause-point-jsonpath
Nov 13, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/pause-point-jsonpath

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • fix(api): report a finished run's real status once its pauses have settled; show the request id in the CLI #9924's run-list status (executionStatus in execution-queries.ts) checked pause points with a correlated jsonb_each / jsonb_array_elements union per row. Unpaged results only compute it for the page, but ?status= puts the CASE in the WHERE, so it runs for every run of the workflow. On a workflow with many open pause records, the filtered list went from about 0.25s to 6s warm (25s cold)
  • Replace the shared PAUSE_POINT_ROWS derived table with somePausePointMatches(filter), a jsonb_path_exists call guarded by jsonb_typeof that reads both the object and the legacy array shape. The same scan takes about 0.35s
  • The paused-runs list's human-wait filter uses the same helper. Each filter keeps the old defaults: a missing or null resumeStatus reads paused, and a missing or null pauseKind reads human

Type of Change

Testing

  • Equivalence: old and new predicates compared on a read replica across every stored pause record, plus 17 synthetic edge rows (legacy arrays, missing, null, numeric and non-object points). Zero mismatches for both filters
  • Timing: the same full-workflow status scan, old vs new, on the replica
  • read-workflow-run-pause.integration.ts (CI) covers settled vs waiting runs in the run list and legacy array rows and time-only exclusion in the paused-runs list
  • biome

Checklist

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

@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 13, 2026 1:51am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable failures were found.

Summary

Replaces the per-row pause-point subquery with jsonb_path_exists for faster status-filtered run lists.

  • Workflow run lists check pause points without expanding them into rows.
  • Paused-run lists keep human waits and skip timed pauses.

Reviews (1) · Last reviewed commit: "fix(api): match pause points with jsonb_..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 3 files

Confidence score: 3/5

  • paused-runs.ts drops points with no pauseKind, even though they should default to human; legacy/default paused runs may be missed. Add an explicit missing-pauseKind branch before the time comparison.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/lib/workflows/executor/paused-runs.ts">

<violation number="1" location="apps/sim/lib/workflows/executor/paused-runs.ts:40">
P2: The human-wait filter drops points with a missing `pauseKind`, instead of applying the documented `human` default. Add an explicit `!exists(@.pauseKind)` branch before the time comparison so legacy/default points remain visible.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — def4a2e3 Deployed Nov 13, 2026 by vercel[bot]
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