Skip to content

improvement(deployments): bugfixes for run-block, airtable + external sub management#5680

Open
icecrasher321 wants to merge 7 commits into
stagingfrom
improvement/deployment-bugs
Open

improvement(deployments): bugfixes for run-block, airtable + external sub management#5680
icecrasher321 wants to merge 7 commits into
stagingfrom
improvement/deployment-bugs

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Make deployment status truthful end-to-end: deployments now move through an explicit state machine (preparing → activating → active / failed / superseded) backed by an outbox with inline-first execution, so a version is only reported live once its webhooks, schedules, and external subscriptions actually exist. Webhook registration is rebuilt on stable, generation-fenced rows with create-before-delete cutover — a failed deploy can no longer take down the currently live version, leave ghost registrations that wedge future deploys, or silently swallow provider errors (now surfaced in the deploy modal, versions list, and API responses).

Type of Change

  • Bug fix

Testing

Tested manually

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)

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 15, 2026 9:21am

Request Review

…ment-bugs

# Conflicts:
#	apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx
@icecrasher321 icecrasher321 marked this pull request as ready for review July 15, 2026 00:22
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Touches deployment cutover, webhook registration, and async execution admission—incorrect gating could strand chats on old versions or run workflows against the wrong snapshot.

Overview
Deployment APIs, admin/tools routes, and the deploy modal now treat live as an active version snapshot (activeDeployment / latestDeploymentAttempt) instead of the legacy workflow.isDeployed flag. HTTP success can mean accepted while cutover is still preparing or activating; chat updates return 409 until the attempt is active, and the UI polls and shows Pending/Retrying/Failed states. PostHog deploy/activate events are no longer fired from these routes (expected to come from the deployment outbox).

Execution pins to admitted versions: MCP tool calls require an active deployment version row, pass deploymentVersionId into execute, and reject public callers setting that field; webhook/schedule workers load a specific version, track deploymentOperationId for stale claims, and skip queued webhooks after undeploy. Webhook delivery queries use a shared deliverable predicate; v2 deploy prep adds generation-fenced path claims and prepareStableTriggerWebhooksForDeploy alongside the legacy save path.

Smaller changes: Airtable typecast on all write operations (plus docs); condition blocks use shared isElseConditionTitle (legacy capitalized Else still works); outbox handlers get abort signals on timeout and truncated persisted errors.

Reviewed by Cursor Bugbot for commit 7ffd781. Configure here.

Comment thread apps/sim/app/api/workflows/[id]/deploy/route.ts Outdated
Comment thread apps/sim/background/webhook-execution.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/app/api/chat/manage/[id]/route.ts
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes deployment status follow the real deployment lifecycle. The main changes are:

  • Operation-backed deploy preparation and activation.
  • Generation-fenced webhook registration and cleanup.
  • Pinned MCP execution against deployment snapshots.
  • Updated deployment API responses and UI status states.
  • Airtable typecast support for create and update tools.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/lib/webhooks/deploy.ts Adds stable webhook preparation and version-scoped cleanup for deployment operations.
apps/sim/lib/workflows/deployment-outbox.ts Adds deployment preparation, readiness checkpoints, activation, cleanup, and post-activation side effects.
apps/sim/lib/workflows/persistence/deployment-operations.ts Adds deployment operation generation, status transitions, activation guards, and superseding behavior.
apps/sim/app/api/mcp/serve/[serverId]/route.ts Pins MCP tool execution requests to the active deployment version at call time.
apps/sim/app/api/workflows/[id]/execute/route.ts Restricts deployment snapshot execution to the internal MCP bridge path.

Reviews (2): Last reviewed commit: "address comments" | Re-trigger Greptile

Comment thread apps/sim/lib/workflows/persistence/deployment-operations.ts
Comment thread apps/sim/lib/workflows/deployment-outbox.ts
Comment thread apps/sim/lib/workflows/deployment-outbox.ts
Comment thread apps/sim/app/api/mcp/serve/[serverId]/route.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/ee/workspace-forking/lib/promote/reactivate-in-tx.ts
Comment thread apps/sim/app/api/mcp/serve/[serverId]/route.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7ffd781. Configure here.

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