Skip to content

fix(execution): make function runs rollout-safe - #7143

Open
icecrasher321 wants to merge 1 commit into
stagingfrom
codex/rollout-safe-function-execution
Open

fix(execution): make function runs rollout-safe#7143
icecrasher321 wants to merge 1 commit into
stagingfrom
codex/rollout-safe-function-execution

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • execute trusted Function tools directly in the workflow owner while retaining the compatibility adapter for rolling deployments
  • reconnect E2B and Daytona by stable process identity and make ambiguous launches non-retryable
  • make manual execution observers detachable with Redis push replay, refresh-safe active block state, and no polling fallback
  • extend the existing unit and provider conformance coverage for execution, reconnect, cancellation, and refresh behavior

Runtime behavior

  • no long Sim-to-Sim Function HTTP request for new executors
  • browser SSE is an observer and page refresh rehydrates active pulses and terminal events
  • external sandbox commands are launched once, then observed or reconnected by exact provider identity
  • Trigger.dev executions use the same direct Function path inside their existing task owner
  • the legacy Function route remains temporarily so old-blue tasks can call new-green during this rollout

Testing

  • bun run type-check (26/26)
  • bun run check:audits (33/33)
  • targeted rollout and provider suites (319 passed)
  • real Redis and isolated-vm lifecycle validation, including observer refresh and cancellation
  • live E2B execution validation
  • live Daytona parity: 7 passed, 0 failed, 3 optional fixture skips
  • live Daytona execution validation
  • Sim app suite: 34,705 passed; 16 loopback tests rerun outside the restricted sandbox and passed

The standalone ad hoc rollout harness used for live validation is intentionally not included in this PR.

@icecrasher321
icecrasher321 requested a review from a team as a code owner August 27, 2026 00:44
@vercel

vercel Bot commented Aug 27, 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 Aug 27, 2026 4:03am

Request Review

@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 0666a1f to 8f333f1 Compare August 27, 2026 00:47
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR moves trusted Function execution into the workflow owner while retaining the legacy HTTP adapter for rolling deployments.

  • Adds stable remote-sandbox process reconnection and non-retryable ambiguous-launch handling.
  • Reworks manual execution observation around detachable SSE, Redis replay, and refresh-safe active-block state.
  • Extends cancellation, execution lifecycle, provider conformance, and rollout compatibility coverage.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure eligible for this follow-up review remains.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/function-execution/execute-request.ts Centralizes the extracted Function request execution implementation used by direct and compatibility paths.
apps/sim/executor/execution/engine.ts Replaces continuous durable cancellation polling with signal subscription and reconnect-aware durable checks.
apps/sim/lib/execution/cancellation.ts Adds signal-driven execution cancellation with initial and reconnection durability checks.
apps/sim/app/api/workflows/[id]/executions/[executionId]/stream/route.ts Implements detachable execution observation with event replay, active-block rehydration, and terminal stream closure.
apps/sim/lib/execution/event-buffer.ts Extends Redis-backed event buffering with signaling, terminal metadata, and active-block snapshots.
apps/sim/lib/execution/remote-sandbox/e2b.ts Adds exact E2B process reconnection and ambiguous-launch classification.
apps/sim/lib/execution/remote-sandbox/daytona.ts Adds stable Daytona command identity, log reattachment, and launch ambiguity handling.
apps/sim/executor/handlers/function/function-handler.ts Routes trusted Function blocks through the direct execution boundary instead of a long internal HTTP request.
apps/sim/app/api/function/execute/route.ts Reduces the Function API route to a compatibility adapter for rolling deployments.

Sequence Diagram

sequenceDiagram
  participant UI as Browser observer
  participant Owner as Workflow owner
  participant Buffer as Redis event buffer
  participant Fn as Function executor
  participant Sandbox as Remote sandbox

  UI->>Owner: Start workflow
  Owner->>Fn: Execute trusted Function directly
  Fn->>Sandbox: Launch command once
  Sandbox-->>Fn: Stable process identity
  Fn-->>Owner: Function result
  Owner->>Buffer: Persist and publish execution events
  UI->>Buffer: Observe via SSE
  UI--xBuffer: Disconnect or refresh
  UI->>Buffer: Reconnect with last event ID
  Buffer-->>UI: Replay events and active-block state
Loading

Reviews (11): Last reviewed commit: "fix(execution): make function runs rollo..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 43 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/executor/execution/engine.ts
Comment thread apps/sim/lib/function-execution/execute-request.ts
Comment thread apps/sim/lib/execution/remote-sandbox/e2b.ts Outdated
Comment thread apps/sim/lib/execution/cancellation.ts Outdated
Comment thread apps/sim/lib/execution/cancellation.ts
Comment thread apps/sim/lib/execution/isolated-vm.ts
Comment thread apps/sim/lib/execution/execution-signal.ts
Comment thread apps/sim/app/api/workflows/[id]/executions/[executionId]/stream/route.ts Outdated
Comment thread apps/sim/lib/execution/remote-sandbox/daytona.ts Outdated
Comment thread apps/sim/lib/execution/remote-sandbox/daytona.ts Outdated
@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 8f333f1 to 6651a0f Compare August 27, 2026 01:55
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR. Please re-review commit 6651a0f after the addressed feedback and resolved threads.

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic-dev-ai review this PR. Please re-review commit 6651a0f after the addressed feedback and resolved threads.

@icecrasher321 Incremental reviews are turned off for this repository. Comment @cubic review to run a full review.

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

1 similar comment
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

1 similar comment
@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 6651a0f to c64afa8 Compare August 27, 2026 02:02
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from c64afa8 to 890dd4e Compare August 27, 2026 02:13
@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 890dd4e to 1b2eec6 Compare August 27, 2026 02:14
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 45 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/trigger.config.ts
Comment thread apps/sim/app/api/workflows/[id]/execute/route.ts
Comment thread apps/sim/lib/execution/remote-sandbox/daytona.ts Outdated
Comment thread apps/sim/lib/execution/cancellation.ts Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 45 files

Requires human review: Auto-approval blocked by 4 unresolved issues from previous reviews.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.

Re-trigger cubic

Comment thread apps/sim/executor/handlers/condition/condition-handler.ts
Comment thread apps/sim/lib/execution/remote-sandbox/daytona.ts Outdated
Comment thread apps/sim/lib/execution/cancellation.ts Outdated
Comment thread apps/sim/lib/api/contracts/hotspots.ts Outdated
Comment thread apps/sim/lib/execution/event-buffer.ts
Comment thread apps/sim/lib/execution/isolated-vm.ts
@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 1b2eec6 to 4655ef5 Compare August 27, 2026 02:52
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 47 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/lib/execution/execution-signal.ts
@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 0d02d1b to 2238082 Compare August 27, 2026 03:34
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 47 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/lib/execution/cancellation.ts
@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 2238082 to 79ae70b Compare August 27, 2026 03:45
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 47 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/lib/execution/cancellation.ts
@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 79ae70b to 24767fe Compare August 27, 2026 03:52
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 47 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/lib/execution/cancellation.ts Outdated
@icecrasher321
icecrasher321 force-pushed the codex/rollout-safe-function-execution branch from 24767fe to 4016d8e Compare August 27, 2026 04:03
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic review

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

@cubic review

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 47 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

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