Skip to content

fix(server): keep skipped runs from crowding out workflow runs() results - #45795

Open
saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:hunter/c-bff785d44e
Open

saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:hunter/c-bff785d44e

Conversation

@saphid

@saphid saphid commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Problem

runs() inside a workflow step or onEnd can return 500 skipped runs and miss the one matching run that did something. The DSL's Runs.list handler (WorkflowEngine.list) forwarded the filter straight to WorkflowStore.runsWhere, so top-level skips and ordinary runs shared its newest-500 LIMIT. skip() documents that lists leave skips out unless asked, and the CLI/UI list already keeps them apart (#43560).

Deterministic repro on origin/main (531c977e5478af59418e4557ad99d2c11dc4465a): in apps/server/src/workflows/Workflows.test.ts, start a sorter run tagged pr and insert 500 newer top-level skipped sorter runs with the same tag. Then start the finder workflow, whose step calls runs({ workflow: "sorter", tag: "pr" }) without a status.

  • Observed: expected [ 'skip-1 pr', 'skip-10 pr', …(498) ] to deeply equal [ 'kept pr' ]. Every result is a skip, and the real run is missing.
  • Expected: ["kept pr"]. runs({ ..., status: "skipped" }) still returns the skips.

Change

When the DSL query has no status, WorkflowEngine.list now passes skippedTopLevel: false to runsWhere, so top-level skips are filtered out before the limit. An explicit status, including "skipped", is passed through unchanged. Skipped runs that another run invoked are still listed. The external Workflows.list path is not touched; #43560 already fixed it.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • New case runs() in a step keeps the runs that did something apart from skipped ones fails on base with the assertion above and passes on head. The finder fixture gained an optional status so the case also shows status: "skipped" still returns all 500 skips.
  • vp test run src/workflows/Workflows.test.ts: 73/73 pass on head.
  • vp run check:changed exited 0 (via the commit wrapper).
  • Before/after transcript: https://gist.github.com/saphid/771c813f26880909cfe88a854ebd48d0

Not shown: no UI change (server-side workflow author API only); no live workflow run against a real database.

Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).

Not shown

  • apps/server/src/workflows/Workflows.test.ts:3007 — The transcript seeds skips with SQL and exercises a step, not onEnd or a live server. In Not shown, say those paths were not run; for a scenarios:prove recipe, use tags() then skip() in 500 uniquely keyed top-level runs and read the completed finder with t3 workflow show --json.
  • .github/pull_request_template.md:26 — check:changed exit 0 is reported through the pre-commit wrapper, but the public transcript only shows the focused tests. Attach the wrapper’s exit-0 output and identify the resulting HEAD, or note that the check was not independently rerun during review.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 30, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — Status-unspecified workflow run queries now exclude skipped top-level runs before applying the result limit. Human confirmation is required for this change to default result visibility; explicit status queries remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

WorkflowEngine.list now excludes top-level skipped runs when callers omit a status filter. The workflow finder accepts and forwards an explicit skipped status. A test checks default results and results for 500 skipped runs.

Changes: Workflow run filtering

Layer / File(s) Summary
Workflow filtering and coverage
apps/server/src/workflows/WorkflowEngine.ts, apps/server/src/workflows/Workflows.test.ts
WorkflowEngine.list excludes top-level skipped runs when no status filter is supplied. The finder forwards an explicit skipped status, and the test checks that the default query returns the kept run while the skipped-status query returns 500 skipped runs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, iamshadmantaqi

Merge Risk: Minimal · up to 04cc3

Workflow queries that omit a status now return runs that did work, even when many newer top-level skipped runs exist. Explicit status queries behave as before. The change is small and tested, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: skipped runs no longer crowd out workflow runs() results. It uses a conventional commit prefix (fix(server)) and matches the code change that filters top-level skipped…
Description check Passed The description follows the template sections (Problem, Change, Scope, Verification). It gives a clear problem statement, a deterministic repro, the code change, a scope rationale, and test results. G…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: skipped runs no longer crowd out workflow runs() results. It uses a conventional commit prefix (fix(server)) and matches the code change that filters top-level skipped runs before the query limit when no status is given.

Full details: Description check

Explanation

The description follows the template sections (Problem, Change, Scope, Verification). It gives a clear problem statement, a deterministic repro, the code change, a scope rationale, and test results. Gaps remain. The Verification section cites a check:changed exit 0 that is not independently shown and gives no HEAD for that run. The Not shown section does not state that onEnd and a live server were not exercised, although the template asks for untested items. The template also asks for the model and harness used, and the author lists a model name that is not verifiable here. The reviewer comments on the description ask for a scenarios:prove recipe and a wrapper output attachment. These are the remaining items.

Resolution

Optionally, attach the pre-commit wrapper's exit-0 output and identify the resulting HEAD for check:changed. In Not shown, state that onEnd and a live server were not run. Confirm the agent and model line matches the template request.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bf0a0ce and 04cc320.

Files selected for processing: 2

  • apps/server/src/workflows/WorkflowEngine.ts
  • apps/server/src/workflows/Workflows.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant