Skip to content

feat(workflows): dry runs stub code's network writes instead of listing code unchecked - #10412

Merged
waleedlatif1 merged 6 commits into
stagingfrom
feat/dry-run-code-network
Nov 25, 2026
Merged

waleedlatif1 merged 6 commits into
stagingfrom
feat/dry-run-code-network

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • In a dry run, plain JavaScript (Function blocks, Condition blocks, While/Do-While conditions) that runs in the isolate has every outbound fetch decided on the host: GET/HEAD/OPTIONS are sent, any other method (or a GET carrying a method-override header) gets an empty stubbed 200 and is recorded in sideEffects.stubbed with origin, path, query names, header names and a capped body, secrets masked (every env var value counts as a secret)
  • The decision runs after the same URL/egress validation a live fetch gets, on the normalized request that is actually sent; a fetch the code never awaits is still decided
  • Code that runs in a remote sandbox (Python, shell, JS with imports, a selected sandbox) is the only code still listed unchecked; isolate code is no longer listed just for running
  • A Function that fails after stubbed writes says how many and that --allow '<block>' sends them
  • http_request (the API block) sends GET/HEAD/OPTIONS for real in a dry run through a new readsWhen rule; its catalog effect stays write
  • Model-provider access ids (openai_chat, …) count as read in the catalog projections; a block that can call user-chosen tools (a tool-input sub-block) stays write, so Router/Evaluator read and Agent writes
  • Live runs take exactly the old fetch path

Type of Change

  • New feature

Testing

  • dry-run.integration.ts (real Postgres/Redis, real isolate, loopback HTTP server): POST never arrives, lowercase/non-string methods, un-awaited fetch, allowed block, method-override GET, egress refusal, secret in path and body under a non-credential name, loop condition, API GET vs POST; each guard red-proofed
  • tools/side-effects.test.ts, isolated-vm tests, catalog build tests, loop tests, sim-cli follow test; type-check; lint; generate

Checklist

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

An Agent, Router or Evaluator lists the model providers it may call in
tools.access; they are not registered tools, so both catalog projections
labelled them write. A model call changes nothing outside Sim and a dry run
sends it, so one accessIdEffect (blocks/access-effect.ts) labels them read
for both projections, keeping any other unregistered id write. A block that
runs tools its user chooses (a tool-input field, as an Agent has) stays
write whatever its access ids say, so only Router and Evaluator become read.
…ng code unchecked

Isolate code (Function blocks, Condition expressions, While/Do While loop
conditions, an Agent's run code) now meets the run's side-effect policy at
the isolate host's fetch handler. Options are normalized once (the fetch
standard's method normalization), the target is validated as a live fetch
would be (URL length, egress policy), and then a read (GET/HEAD/OPTIONS
without a method-override header) is sent while any other request gets an
empty 200 with x-sim-dry-run: stubbed and is recorded in sideEffects.stubbed
as function_execute. The recorded request keeps the method, a capped URL with
query names only, header names and a capped body, with the code's env and
personal secrets masked alongside the usual redaction. An allowed block sends
everything and is recorded allowed on its first write. Only code in a remote
sandbox is listed unchecked. The policy is trusted in-process state threaded
through executeFunctionTool, executeFunction and executeFunctionRequest into
executeInIsolatedVM.

A Function block that fails after stubbed writes says how many got an empty
response and that --allow '<block>' sends them. http_request declares
readsWhen, so a GET/HEAD/OPTIONS API call without a method-override header is
sent as a read in a dry run while its catalog effect stays write. Contract,
CLI help, workflow-test descriptions and docs updated.
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 25, 2026 8:21pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new blocking issues were found.RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no new blocking issues were found.

Summary

Dry runs now block network writes from isolate code and record the requests they would send.

  • Dry runs send code reads and record stubbed network writes.
  • HTTP request blocks send eligible reads during dry runs.
  • Model-only blocks show as reads, while Agent stays a write.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Isolate fetch] --> B[Validate URL and egress]
  B --> C{Read or allowed write?}
  C -->|Yes| D[Send request]
  C -->|No| E[Mask and describe request]
  E --> F[Record write and return stub]
  G[Code returns] --> H[Wait for pending decisions]
  H --> I[Return result when decisions settle or deadline passes]
Loading

Reviews (3) · Last reviewed commit: "fix(execution): stop waiting for fetch d..." · Reviewed by Greptile

Comment thread apps/sim/tools/side-effects.ts Resolved
Comment thread apps/sim/lib/execution/isolated-vm.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

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 31 files

This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/tools/side-effects.ts Resolved
Comment thread apps/sim/lib/execution/isolated-vm.ts Resolved
An isolate result now waits for fetch-policy decisions still pending, so a
write the code never awaited is recorded before the run reads its side
effects. Remote-sandbox code of an allowed block stays listed unchecked
instead of claiming a sent write. The egress test asserts the refusal itself,
and the CLI and workflow-test guidance name the method-override exception.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/lib/execution/isolated-vm.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 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
Contributor

Choose a reason for hiding this comment

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

No issues found across 32 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit db3bced into staging Nov 25, 2026
87 checks passed

This branch was previously deployed

1 inactive deployment
Preview — c3b3f792 Deployed Nov 25, 2026 by vercel[bot]
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