feat(workflows): sim trigger, logs v2 block, toolbar renaming#4941
Conversation
…low SQL scoping Code-review fixes: read the canonical workflowIds param in logs_v2 (the serializer deletes the source pair ids), aggregate failure-rate in the DB and switch rule windows to the indexed startedAt column, clamp rule config to the legacy contract bounds, push no_activity watch scoping into SQL before the LIMIT, fix the generated sim icon-map key, normalize docs wording, and drop dead exports. Co-authored-by: Cursor <cursoragent@cursor.com>
…splay module hygiene Second-pass review fixes: round integer rule fields so fractional input never reaches SQL LIMIT, gate workflow-name readiness on a successful non-placeholder load in both editor and preview (errored loads mislabeled valid workflows as deleted), lazily read the variables store in preview rows, move the filter-field JSON preview into the shared display module and unexport its single-consumer helpers, and align >= boundary copy (failure rate, error count, cooldown window) with implementation. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/notifications.tsx # apps/sim/app/workspace/[workspaceId]/logs/logs.tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryHigh Risk Overview Adds docs and icons for the Sim trigger and Logs block (query run IDs + get run details), and retargets External API docs away from notification webhooks toward the Sim trigger pattern. Platform hardening and UX: internal Reviewed by Cursor Bugbot for commit 140da44. Configure here. |
Greptile SummaryThis PR replaces the notifications system with a Sim trigger block (workspace-event-driven workflow execution) and adds a Logs v2 block for log-driven automations. All notification UI, APIs, tables, and background jobs are removed; migration 0231 drops the two notification tables and creates
Confidence Score: 5/5Safe to merge; the new event emission path is fully fire-and-forget and cannot affect existing execution flows. The core event system (emitter, rules, state, subscriptions) is well-structured with correct atomic cooldown claiming, keyset-paginated no-activity polling, and loop-prevention guards. The only findings are non-blocking style observations — the two DB queries added per execution completion are fire-and-forget and do not affect correctness. No files require special attention. The emitter and display resolver comments flag improvement opportunities but not correctness issues. Important Files Changed
Sequence DiagramsequenceDiagram
participant Exec as ExecutionLogger
participant Emitter as workspace-events/emitter
participant DB as Database
participant Queue as Job Queue
participant Subscriber as Subscriber Workflow
Exec->>Emitter: emitExecutionCompletedEvent(log) [fire-and-forget]
Emitter->>DB: getActiveWorkflowContext(workflowId)
Emitter->>DB: fetchSimTriggerSubscriptions(workspaceId)
loop for each matching subscription
Emitter->>DB: readLastFiredAt(workflowId, blockId, scopeKey)
alt within cooldown
Emitter-->>Emitter: skip
else
Emitter->>DB: evaluateRule(eventType, config, context)
Emitter->>DB: claimCooldown (atomic upsert)
alt claimed
Emitter->>Queue: processPolledWebhookEvent
Queue->>Subscriber: execute workflow
end
end
end
Note over Emitter,DB: no_activity handled separately by pollNoActivityEvents() cron
Note over Emitter,Queue: loop prevention: log.trigger === 'sim' → early return
Reviews (2): Last reviewed commit: "fix(workspace-events): skip no_activity ..." | Re-trigger Greptile |
A fixed LIMIT 500 with no ORDER BY silently starved subscriptions beyond the cap once the global count exceeded it. The poll now pages by webhook id so every subscription is visited each cycle; pagination bounds memory, not total work. Co-authored-by: Cursor <cursoragent@cursor.com>
The 500-row LIMIT silently and deterministically excluded high-id workflows from no_activity coverage in watch-everything subscriptions on large workspaces. The scan now pages by workflow id, mirroring the subscription scan; per-workflow checks move into a helper so the pagination loop stays flat. Co-authored-by: Cursor <cursoragent@cursor.com>
…n-completion path no_activity is poller-owned and can never fire from a completed execution, but it passed into the rule branch and cost a pointless cooldown point-read per subscription on the hottest path. Early-continue alongside the workflow_deployed guard. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@greptile |
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 140da44. Configure here.
…iled runs Co-authored-by: Cursor <cursoragent@cursor.com>
It's a Sim-native capability (registry enrichments over a managed provider cascade, like Search), not a third-party integration. Moves it to Core Blocks in the toolbar, out of the integrations catalog, and relocates its docs page to blocks/ with the icon-map allowlist keeping the docs card icon. Co-authored-by: Cursor <cursoragent@cursor.com>
…rations External-system connectors with host/credential auth belong under Integrations, not Core Blocks — consistent with MongoDB, Redis, ClickHouse, and the other datastore integrations. They already carried integrationType and /tools docsLinks; the regenerated docs pages turn those previously-dangling links into real pages, and the blocks join the integrations catalog and icon maps. Co-authored-by: Cursor <cursoragent@cursor.com>
… blocks, re-shown DB integrations Staging's simstudioai#4941 added the Sim workspace-event trigger (hand-written page adopted into Core Triggers), the Enrichment and Logs blocks (category 'blocks' — added to NATIVE_RESOURCE_BLOCK_TYPES so they live in the integrations catalog like table/knowledge/memory), and re-categorized mysql/postgresql/sftp/smtp/ssh back to visible tools (their pages return to the catalog). Generator sets merged as the union of both sides (sim in HANDWRITTEN_TRIGGER_DOCS + SKIP_TRIGGER_PROVIDERS, enrichment in the icon allowlist). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… blocks, re-shown DB integrations Staging's simstudioai#4941 added the Sim workspace-event trigger (hand-written page adopted into Core Triggers), the Enrichment and Logs blocks (category 'blocks' — added to NATIVE_RESOURCE_BLOCK_TYPES so they live in the integrations catalog like table/knowledge/memory), and re-categorized mysql/postgresql/sftp/smtp/ssh back to visible tools (their pages return to the catalog). Generator sets merged as the union of both sides (sim in HANDWRITTEN_TRIGGER_DOCS + SKIP_TRIGGER_PROVIDERS, enrichment in the icon allowlist). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Summary
Replace the notifications feature with a Sim trigger block — deployed workflows now run as side-effects of workspace events (execution success/error, deploys, and the ported alert rules: consecutive failures, failure/latency/cost thresholds, latency spikes, error counts, inactivity) with per-block cooldowns, credit-denominated thresholds, and loop prevention; all notification UI, APIs, tables, and background jobs are removed (migration 0231, requires the workspace-events-poll cron repoint in infra).
Add a Logs v2 block and canvas polish — Query Logs (run IDs with the full Logs-page filter set) + Get Run Details (trace spans, credit costs) for building log-driven automations; toolbar renamed (Blocks → Core Blocks, Tools → Integrations), multi-select inputs now summarize with +N chips, and shared subblock display resolvers keep editor/preview hydration consistent.
Type of Change
Testing
Tested manually
Checklist