feat(workflows): preserve execution principals - #6891
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryHigh Risk Overview Identity persistence. Snapshots and queued jobs serialize principals with versioning. Legacy jobs/pauses restore only unambiguous identity (session vs actorless External triggers and Credential Groups. Slack webhooks attach a verified Reviewed by Cursor Bugbot for commit dc027f2. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR introduces versioned execution principals and preserves them across synchronous, queued, nested, webhook, and paused workflow execution.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/executor/execution/snapshot.ts | Adds a versioned snapshot codec, strict principal parsing, and bounded compatibility for pre-principal snapshots; the previously reported legacy-resume failure is addressed. |
| apps/sim/executor/execution/snapshot-serializer.ts | Requires and serializes the execution principal when producing durable pause snapshots. |
| apps/sim/executor/execution/executor.ts | Carries the supplied principal into resumed executor context without replacing it with billing or workflow ownership. |
| apps/sim/lib/workflows/executor/execution-core.ts | Propagates snapshot principals through the common execution boundary and nested delegation context. |
| packages/auth/src/principal.ts | Defines the versioned principal serialization, parsing, subject resolution, and attribution contracts used by workflow execution. |
| apps/sim/executor/handlers/credential-group/credential-group-handler.ts | Applies the propagated execution principal to Credential Group delegation and actor-scoped authorization. |
Sequence Diagram
sequenceDiagram
participant Trigger as Authenticated trigger
participant Core as Execution core
participant Exec as Workflow executor
participant Store as Pause snapshot store
participant Resume as Resume pipeline
Trigger->>Core: Input + verified principal
Core->>Exec: Execution metadata + principal
Exec->>Store: Versioned snapshot with serialized principal
Store->>Resume: Persisted snapshot
Resume->>Resume: Parse version and principal
Resume->>Core: Restored snapshot metadata
Core->>Exec: Original principal preserved
Reviews (6): Last reviewed commit: "fix(workflows): resume legacy queued job..." | Re-trigger Greptile
8532691 to
43e2364
Compare
43e2364 to
5aba920
Compare
29b8a6d to
64c4f10
Compare
64c4f10 to
a377050
Compare
|
@cursor review |
41ea290 to
3f85676
Compare
|
@cursor review |
|
@cursor review |
aebf473 to
4489fc2
Compare
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ 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 33caa1f. Configure here.
33caa1f to
dc027f2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort 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 dc027f2. Configure here.
| } | ||
| } | ||
| return { kind: 'system', serviceId: 'internal', workspaceId, workflowId } | ||
| } |
There was a problem hiding this comment.
Legacy pause drops API-key actor
Medium Severity
parseLegacyPrincipal only restores a human actor from sessionUserId, so pre-principal paused runs that recorded the caller via enforceCredentialAccess and userId (personal API key / MCP bridge) become actorless internal principals on resume. The legacy workflow-job decoder already treats that same flag as an unambiguous user actor, so resumed HITL runs lose enrollment-scoped Credential Group access that the original execution had.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit dc027f2. Configure here.


Summary
Type of Change
Testing
bun run lintbun run check:auditsChecklist
Screenshots/Videos
Not applicable; this branch has no new UI.