GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(block): Allow wait block to wait up to 30 days by TheodoreSpeaks · Pull Request #4331 · simstudioai/sim

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Reuse human in the loop logic to allow wait blocks to wait up to 30 days. Think this could be useful for things like email automation where you want to send followups after x days.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Tested locally with a wait of 6 minutes. Ran resume and validated that later blocks run.

Checklist

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

Screenshots/Videos

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
waleedlatif1 and others added 30 commits April 3, 2026 23:30
@waleedlatif1
v0.6.23: MCP fixes, remove local state in favor of server state, moth…
0b9019d
…ership workflow edits via sockets, ui improvements
@waleedlatif1
v0.6.24: copilot feedback wiring, captcha fixes
a54dcbe
@waleedlatif1
v0.6.25: cloudwatch, cloudformation, live kb sync, linear fixes, post…
28af223
…hog upgrade
@waleedlatif1
v0.6.26: ui improvements, multiple response blocks, docx previews, ol…
d889f32
…lama fix
@waleedlatif1
v0.6.27: new triggers, mothership improvements, files archive, queuei…
316bc8c
…ng improvements, posthog, secrets mutations
@waleedlatif1
v0.6.28: new docs, delete confirmation standardization, dagster integ…
3f508e4
…ration, signup method feature flags, SSO improvements
@TheodoreSpeaks
v0.6.29: login improvements, posthog telemetry (#4026)
d6ec115
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <[email protected]>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
@waleedlatif1
v0.6.30: slack trigger enhancements, connectors performance improveme…
d7da35b
…nts, secrets performance, polling refactors, drag resources in mothership
@waleedlatif1
v0.6.31: elevenlabs voice, trigger.dev fixes, cloud whitelabeling for…
cf233bb
… enterprises
@waleedlatif1
v0.6.32: BYOK fixes, ui improvements, cloudwatch tools, jsm tools ext…
f8f3758
…ension
@waleedlatif1
v0.6.33: polling improvements, jsm forms tools, credentials reactquer…
3c8bb40
…y invalidation, HITL docs
@waleedlatif1
v0.6.34: trigger.dev fixes, CI speedup, atlassian error extractor
d33acf4
@waleedlatif1
v0.6.35: additional jira fields, HITL docs, logs cleanup efficiency
4f40c4c
@waleedlatif1
v0.6.36: new chunkers, sockets state machine, google sheets/drive/cal…
cbfab1c
…endar triggers, docs updates, integrations/models pages improvements
@waleedlatif1
v0.6.37: audit logs page, isolated-vm worker rotation, permission gro…
4309d06
…ups ui
@waleedlatif1
v0.6.38: models page
8b57476
@waleedlatif1
v0.6.39: billing fixes, tools audit, landing fix
e3d0e74
@waleedlatif1
v0.6.40: mothership tool loop, new skills, agiloft, STS, IAM integrat…
0ac0539
…ions, jira forms endpoints
@waleedlatif1
v0.6.41: webhooks fix, workers removal
3838b6e
@waleedlatif1
v0.6.42: mothership nested file reads, search modal improvements
fc07922
@waleedlatif1
v0.6.43: mothership billing idempotency, env var resolution fixes
3a1b1a8
@waleedlatif1
v0.6.44: streamdown, mothership intelligence, excel extension
46ffc49
@Sg312
v0.6.45: superagent, csp, brightdata integration, gemini response for…
010435c
…mat, logs performance improvements

fix(csp): add missing analytics domains, remove unsafe-eval, fix workspace CSP gap (#4179)
fix(landing): return 404 for invalid dynamic route slugs (#4182)
improvement(seo): optimize sitemaps, robots.txt, and core web vitals across sim and docs (#4170)
fix(gemini): support structured output with tools on Gemini 3 models (#4184)
feat(brightdata): add Bright Data integration with 8 tools (#4183)
fix(mothership): fix superagent credentials (#4185)
fix(logs): close sidebar when selected log disappears from filtered list; cleanup (#4186)
@icecrasher321
Merge pull request #4190 from simstudioai/staging
c0bc62c
v0.6.46: mothership streaming fixes, brightdata integration
@waleedlatif1
v0.6.46: mothership queueing, web vitals
387cc97
@waleedlatif1
v0.6.47: files focusing, documentation, opus 4.7
2dbc7fd
@waleedlatif1
v0.6.48: import csv into tables, subflow fixes, CSP updates
8a50f18
@waleedlatif1
v0.6.49: deploy sockets event, resolver, logs improvements, monday.co…
dcf3302
…m integration, atlassian triggers
@icecrasher321
v0.6.50: ppt/doc/pdf worker isolation, docs, chat, sidebar improvements
bc09865
@waleedlatif1
v0.6.51: tables improvements, billing fixes, 404 pages, code hygiene
5f56e46
@TheodoreSpeaks
TheodoreSpeaks marked this pull request as ready for review April 29, 2026 02:19
@greptile-apps

greptile-apps Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends the Wait block to support durations up to 30 days by reusing the human-in-the-loop pause/resume infrastructure. Waits ≤ 5 minutes continue to execute in-process; longer waits suspend the workflow by writing pauseKind: 'time' pause points to pausedExecutions, and a new per-minute cron endpoint (/api/resume/poll) resumes them when their resumeAt timestamp is reached.

  • P1 — permanently stranded executions on dispatch failure: In route.ts, when enqueueOrStartResume throws for a due pause point, the error is caught but nextRemaining (which controls the rescheduled nextResumeAt) only tracks future points. After the loop, nextResumeAt is set to NULL, so the cron query (isNotNull(nextResumeAt)) never selects the row again and the workflow hangs indefinitely with no retry or alerting.

Confidence Score: 3/5

Not safe to merge until the failed-dispatch silent-strand bug is fixed; any transient error during resume dispatch permanently locks a workflow.

A confirmed P1 defect in the new poll route means any transient DB or lock error during dispatch will permanently orphan a paused execution with no retry or observability. The rest of the implementation (schema migration, in-process vs. suspended branching, UI filtering, cron config) is well-structured and correct.

apps/sim/app/api/resume/poll/route.ts — the failed-dispatch no-retry bug and missing ORDER BY

Important Files Changed

Filename Overview
apps/sim/app/api/resume/poll/route.ts New cron-driven polling endpoint that resumes time-based paused executions; has a P1 bug where failed dispatches permanently strand executions, and lacks ORDER BY on the batch query
apps/sim/executor/handlers/wait/wait-handler.ts Refactored to support in-process (≤5 min) and suspended (>5 min, up to 30 days) waits; implementation is clean but executeWithNode signature is narrower than the BlockHandler interface
apps/sim/executor/types.ts Adds PauseKind union type and pauseKind/resumeAt fields to PauseMetadata and PausePoint; backward compat handled via ?? fallbacks in the manager
apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts Correctly propagates pauseKind/resumeAt through persistPauseResult and computes nextResumeAt from the earliest time-based pause point
packages/db/migrations/0201_brave_kylun.sql Adds next_resume_at column and partial index on paused_executions; migration looks correct
apps/sim/executor/handlers/wait/wait-handler.test.ts Replaces old max-enforcement tests with suspended-workflow tests for hours/days/minutes above threshold; good coverage of the new branching logic
apps/sim/executor/handlers/human-in-the-loop/human-in-the-loop-handler.ts Adds explicit pauseKind: 'human' to pause metadata; single-line change is correct and unambiguous
apps/sim/blocks/blocks/wait.ts Adds hours/days options and updates documentation to reflect the new 30-day ceiling and dual-mode execution
helm/sim/values.yaml Adds a 1-minute CronJob for the new poll endpoint with Forbid concurrency policy; configuration is consistent with other cron jobs

Sequence Diagram

sequenceDiagram
    participant W as WaitBlockHandler
    participant E as ExecutionEngine
    participant M as PauseResumeManager
    participant DB as pausedExecutions DB
    participant C as CronJob (/api/resume/poll)

    W->>W: execute(inputs)
    alt waitMs ≤ 5 min (in-process)
        W->>W: sleep(waitMs)
        W-->>E: {status: 'completed'}
    else waitMs > 5 min (suspended)
        W-->>E: {status: 'waiting', _pauseMetadata: {pauseKind: 'time', resumeAt}}
        E->>M: persistPauseResult(pausePoints)
        M->>M: compute nextResumeAt (earliest time pause point)
        M->>DB: INSERT/UPDATE pausedExecutions {nextResumeAt}
    end

    loop Every 1 minute
        C->>DB: SELECT WHERE status='paused' AND nextResumeAt <= now LIMIT 200
        DB-->>C: dueRows[]
        loop for each dueRow
            loop for each duePoint (pauseKind='time', resumeAt <= now)
                C->>M: enqueueOrStartResume({executionId, contextId})
                M-->>C: {status: 'starting', ...}
                C->>M: startResumeExecution() [fire and forget]
            end
            C->>DB: UPDATE SET nextResumeAt = nextRemaining (null if all done)
        end
    end
Loading

Reviews (1): Last reviewed commit: "restore ff" | Re-trigger Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Apr 29, 2026
View reviewed changes
Comment thread apps/sim/app/api/resume/poll/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/app/api/resume/poll/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/executor/handlers/wait/wait-handler.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

icecrasher321 and others added 3 commits April 29, 2026 10:16
@icecrasher321
v0.6.61: SAP integration, live URLs for browser use, 5xx error catego…
6aa3fe3
…rizations, mothership positional table row insertion, CI improvements, org-external users, file viewer improvements
@TheodoreSpeaks
Merge pull request #4342 from simstudioai/staging
ecbf5e5
v0.6.62: fix new copilot chat creation and selection on refresh
@TheodoreSpeaks
Filter out waits from hitl endpoints
0c32dd4
@vercel
vercel Bot temporarily deployed to Preview April 30, 2026 08:22 Inactive
cursor[bot]
cursor Bot reviewed Apr 30, 2026
View reviewed changes
Comment thread apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@TheodoreSpeaks
Use correct count, filtering out wait blocks
7678245
@vercel
vercel Bot temporarily deployed to Preview April 30, 2026 22:36 Inactive
waleedlatif1 and others added 3 commits May 2, 2026 01:55
@waleedlatif1
v0.6.62: firecrawl parse, new gmail tools, trace improvements, tool f…
2aaf2b7
…ixes, db query optimizations, contract boundaries code hygiene, CORS, toast improvements, tables infinite query, executor robustness, reranker support
@waleedlatif1
v0.6.63: knowledgebase UI, folder search in mothership
d445b9c
@TheodoreSpeaks
Merge remote-tracking branch 'origin/main' into feat/long-waits
c234b01
@gitguardian

gitguardian Bot commented May 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
29606901 Triggered Generic High Entropy Secret a54dcbe apps/sim/providers/utils.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider

  • following these best practices for managing and storing secrets including API keys and other credentials
  • install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.

🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview May 2, 2026 18:46
View deployment
cursor[bot]
cursor Bot reviewed May 2, 2026
View reviewed changes
Comment thread apps/sim/executor/handlers/wait/wait-handler.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@TheodoreSpeaks
improvement(wait): tighten poll route and pause-manager helpers
80202dd
- Parallelize per-row dispatch with Promise.all
- Add status='paused' guard on nextResumeAt rewrite to prevent clobbering concurrent resumes
- Extract computeEarliestResumeAt + PauseResumeManager.setNextResumeAt helpers
- Use canonical PausePoint type in poll route (drop StoredPausePoint)
- Narrow UNIT_TO_MS via as const + WaitUnit guard
- Bump LOCK_TTL_SECONDS above route maxDuration
- Clearer error when allowedPauseKinds rejects a resume
@vercel
vercel Bot deployed to Preview May 4, 2026 19:45
View deployment
cursor[bot]
cursor Bot reviewed May 4, 2026
View reviewed changes
Comment thread apps/sim/app/api/resume/poll/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@TheodoreSpeaks
Merge branch 'staging' into feat/long-waits
491af0e
- Renumber wait migration 0201 -> 0202 (staging took 0201)
- Bump api-validation baseline to 726 (725 from staging + 1)
- Set output.status = 'completed' on time-pause resume so downstream
  blocks see the same status as in-process waits
@vercel
vercel Bot deployed to Preview May 4, 2026 19:56
View deployment
cursor[bot]
cursor Bot reviewed May 4, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 491af0e. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/sim/executor/handlers/wait/wait-handler.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@TheodoreSpeaks
Merge branch 'staging' into feat/long-waits
4d44471
- Renumber wait migration 0202 -> 0203 (staging took 0202)
- Bump api-validation baseline to 727
- Use parseFloat + Math.round so fractional values (e.g. 1.5 days) keep their sub-unit portion
- Pass allowedPauseKinds: ['time'] from poll route for defense-in-depth
- ORDER BY next_resume_at on poll batch so backlog drains fairly
- Widen WaitBlockHandler.executeWithNode signature to match BlockHandler interface
@vercel
vercel Bot deployed to Preview May 5, 2026 23:14
View deployment
@TheodoreSpeaks
TheodoreSpeaks merged commit 09f4c94 into staging May 5, 2026
13 of 14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1 waleedlatif1 mentioned this pull request May 6, 2026
v0.6.68: atlassian service accounts, 30 day wait block, markdown rendering upgrades, data drains, security hardening, paginated dropdowns #4469
Merged
@waleedlatif1
waleedlatif1 deleted the feat/long-waits branch May 7, 2026 05:13
@TheodoreSpeaks TheodoreSpeaks mentioned this pull request May 15, 2026
feat(wait, workflows): Async toggle, chained-wait resume fix, execution status API #4514
Merged
7 tasks done
TheodoreSpeaks added a commit that referenced this pull request May 15, 2026
@TheodoreSpeaks
improvement(wait): hint the wait-amount cap on the input
36f5dfd
Restores the pre-#4331 description on the Wait Amount field so the limit is visible before submit instead of only at runtime. Mentions both the 5 min default and the 30 day cap with Suspend Workflow.
TheodoreSpeaks added a commit that referenced this pull request May 16, 2026
@TheodoreSpeaks
feat(wait): Async toggle, chained-wait resume fix, execution status A…
fffb879
…PI (#4514)

* fix(wait): poll partially_resumed rows so chained waits resume

The chained-pause flow leaves a row in 'partially_resumed' status (wait1 done, wait2 still waiting). The poll's WHERE filter only matched 'paused', so wait2 was never picked up. Include 'partially_resumed' in the filter.

* feat(wait): make in-process threshold env-overridable for local testing

Adds WAIT_INPROCESS_MAX_MS env var (default 300000ms = 5 min). Lower it locally (e.g. 5000) to exercise the suspend/cron-resume path with short waits.

* feat(wait): add Suspend Workflow toggle, restore 5-min in-process default

* fix(wait): address bot review — setNextResumeAt + suspend unit default

- setNextResumeAt now matches paused OR partially_resumed; otherwise the
  cron poller can't null nextResumeAt after dispatching a chained-wait
  row, so it keeps reappearing in every poll batch until execution ends
  (flagged by both greptile and bugbot)
- Suspend mode now defaults missing timeUnitLong to 'minutes' instead of
  falling back to 'seconds' and immediately erroring (flagged by bugbot)

* improvement(wait): hint the wait-amount cap on the input

Restores the pre-#4331 description on the Wait Amount field so the limit is visible before submit instead of only at runtime. Mentions both the 5 min default and the 30 day cap with Suspend Workflow.

* refactor(wait): rename Suspend Workflow toggle to Async

* fix(wait): reword cap errors to say 'async mode'

* feat(workflows): add GET /workflows/[id]/executions/[executionId] status endpoint

Normalized status (pending|running|paused|completed|failed|cancelled)
across workflowExecutionLogs and pausedExecutions in a single response.
Surfaces paused-state details (resumeAt, pauseKind, blockedOnBlockId)
when a row exists in pausedExecutions, and the error string for failed
runs. finalOutput is opt-in via ?includeOutput=true.

* feat(workflows): support ?selectedOutputs= on execution status endpoint

Returns per-block outputs filtered by selectedOutputs paths (same
shape as the execute endpoint). Reads from executionData.traceSpans,
walks children recursively, and resolves dot-paths into each block's
output. Bare blockId returns the full output.

* fix(wait): drop dead tooltip prop on Async switch

Switch sub-blocks return null from renderLabel (sub-block.tsx:238), so
the tooltip never reached the user. The trade-off explanation already
lives in longDescription and bestPractices. Flagged by bugbot.

* docs(api): document GET /workflows/[id]/executions/[executionId]

Adds the WorkflowExecutionStatus schema and the getWorkflowExecution
operation to the OpenAPI spec, including completed/paused/failed
response examples and the includeOutput + selectedOutputs query params.
Registers the page in the Workflows section of the API reference.

* docs(api): tighten getWorkflowExecution descriptions

This branch was successfully deployed

1 active deployment
Preview — 4d444712 Deployed May 5, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments
@cursor cursor[bot] cursor[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@TheodoreSpeaks @waleedlatif1 @Sg312 @icecrasher321
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.