Skip to content

fix(server): an infinite workflow interval no longer breaks unrelated workflow sweeps - #45371

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-3ec0b80328
Nov 29, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-3ec0b80328

Conversation

@saphid

@saphid saphid commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Problem

every("Infinity") accepts an interval that cannot produce a valid next date. Formatting that date aborts the entire sweep before it reaches later schedules, forge triggers, watches, or reconciliation.

Deterministic repro on origin/main (8ce22420f98324cfa2bafa7d787d95a28e61a282)

In a clean checkout of that base, apply only the regression tests from the proposed commit and run them:

git diff 8ce22420f98324cfa2bafa7d787d95a28e61a282 f654e2ef1982164d5ede1926c00e00e93fa02f10 -- apps/server/src/workflows/Workflows.test.ts | git apply
vp test run apps/server/src/workflows/Workflows.test.ts -t 'workflow interval'

The constructor case calls every("Infinity"). The SQLite-backed engine case starts its synthetic clock at 2026-01-01T00:00:00Z, registers every("20000000 weeks") before every("1 minute"), and calls Workflows.sweep.

Observed: The constructor accepts Infinity, and the finite boundary case aborts the sweep with RangeError: Invalid time value.
Expected: The constructor rejects Infinity, and the sweep skips an unrepresentable next date and still starts the healthy workflow when due.

Change

Reject non-finite intervals in every(). Before writing the next run time, the shared server engine checks that the date is representable; it warns once per trigger per engine and continues the sweep. This covers workflows regardless of client or connection mode, without client or protocol changes.

Scope

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

Verification

  • Both focused cases failed on base and passed on head. The engine case verifies that the healthy workflow starts despite the oversized interval.
  • vp run check:changed exited 0; all 74 affected tests passed.
  • Before/after runtime transcript.

Not shown: Live forge calls, external providers, or client UI; the proof exercises the shared workflow engine with an isolated SQLite database.

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

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

macroscopeapp Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at f654e2e

Macroscope's review found this PR approvable — Rejects non-finite workflow intervals and skips out-of-range next-run dates so they do not interrupt unrelated schedule sweeps. Valid schedules and product defaults remain unchanged.

No code changes detected at 68ecc73. Prior analysis still applies.

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

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between abfa223 and 68ecc73.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The workflow interval validation now rejects non-finite values. Schedule processing skips invalid next-run dates and logs a warning once per affected trigger. Tests cover both behaviors.

Changes: Workflow interval handling

Layer / File(s) Summary
Finite interval validation
apps/server/src/workflows/triggers.ts, apps/server/src/workflows/Workflows.test.ts
every rejects non-finite intervals before applying the minimum-duration check. Tests cover the error and retain bigint equivalence and short-interval assertions.
Invalid schedule date handling
apps/server/src/workflows/WorkflowEngine.ts, apps/server/src/workflows/Workflows.test.ts
The engine skips triggers with no next run. It warns once per trigger ID and leaves the stored schedule time unchanged when the next-run date is invalid. The regression test checks that the healthy schedule runs.

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

Change: Bug fix

Suggested reviewers: juliusmarminge, only21mil

Merge Risk: Minimal · previous review f654e

This change rejects infinite workflow intervals and keeps a workflow with an oversized interval from aborting the sweep, so healthy schedules still run. The behavior change is narrow and has focused test coverage, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: an infinite workflow interval no longer breaks unrelated workflow sweeps. The changeset rejects non-finite intervals in every() and makes the engine skip unrepresentab…
Description check Passed The description covers the problem, the change, scope, and verification. It has a clear reproduction with commands, observed and expected behavior, and a focused test run. The Problem, Change, Scope, …
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: an infinite workflow interval no longer breaks unrelated workflow sweeps. The changeset rejects non-finite intervals in every() and makes the engine skip unrepresentable next-run dates, which matches the title. The title uses the conventional commit format and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description covers the problem, the change, scope, and verification. It has a clear reproduction with commands, observed and expected behavior, and a focused test run. The Problem, Change, Scope, and Verification sections match the template. It also states what was not tested (live forge calls, external providers, client UI). The template's conventional-commit guidance is followed by the title. The description does not link an issue, but it explains why none is needed for a small obvious bug fix, as the template allows.

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 8ce2242 and f654e2e.

Files selected for processing: 3

  • apps/server/src/workflows/WorkflowEngine.ts
  • apps/server/src/workflows/Workflows.test.ts
  • apps/server/src/workflows/triggers.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.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 29, 2026
@saphid
saphid force-pushed the hunter/c-3ec0b80328 branch from 26aa9f4 to 79b9fd7 Compare November 29, 2026 08:47
@saphid
saphid force-pushed the hunter/c-3ec0b80328 branch from 79b9fd7 to abfa223 Compare November 29, 2026 09:12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Real Linux server/CLI reproduction on fresh isolated databases, 2026-11-29 09:31–09:37 UTC. On each commit, start two real Node T3 servers on loopback using separate fresh data directories, workflowsEnabled=true and T3CODE_DEV_SEED=0. Server A loads oversized every("20000000 weeks") before healthy every("1 minute"), both returning Effect.void. Server B starts with healthy only. Capture server output and t3 workflow list --json about once a minute. After three minutes, hot-load a second file on B declaring infinite every("Infinity"); observe for another three minutes. No clocks, services, or providers are mocked.

Videos render captured timestamped output at 10× speed (1600×1000); CLI JSON is projected to workflow, status and startedAt for readability. Full CLI output is in the transcripts. These are server-output recordings, not web UI screenshots.

Before After
21d6dcb686 68ecc73e35
Before: repeated sweep failures and no healthy runs beside oversized interval After: healthy workflows continue completing after Infinity rejection
Before recording After recording
Oversized server: zero runs. Control: three completed healthy runs, then Infinity accepted and no further runs. 39 sweep failures across both servers. Oversized server: six completed healthy runs and one out-of-range warning. Control: Infinity rejected with a finite-interval error; six healthy runs, including three after rejection. Zero sweep failures.
Full output · Timestamped terminal recording Full output · Timestamped terminal recording

Reproduction and seed driver · Recording renderer · Sanitized server logs, CLI snapshots and workflow files

Not exercised: forge triggers, pull-request watches, or crash-recovery reconciliation; the evidence directly demonstrates definition rejection and continued healthy scheduling.

Not shown:

  • Forge triggers, pull-request watches, and crash-recovery reconciliation were not independently exercised; the supplied reproduction uses interval schedules and definition hot reload.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 29, 2026
@juliusmarminge
juliusmarminge merged commit dd4d426 into pingdotgg:main Nov 29, 2026
60 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 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.

2 participants