Skip to content

feat(workflows): allow and mock child-workflow blocks, and mock from a recorded run - #10413

Open
waleedlatif1 wants to merge 2 commits into
stagingfrom
feat/dry-run-child-overrides
Open

waleedlatif1 wants to merge 2 commits into
stagingfrom
feat/dry-run-child-overrides

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • --allow and --mock (v2 run.allowBlocks / run.mocks) also take <workflow>.<block> for a child workflow, resolved through the Workflow blocks the run calls (recursively) or a same-workspace workflow chosen at runtime; the entry applies wherever that workflow runs, with the same refusals as top-level blocks
  • --mock-from <runId> with a bare --mock <block> replays the output that block recorded in an earlier run of this workflow (read through the secret-masked run read; billing/trace fields stripped and reported as droppedMockFields; placeholders a dry source run stubbed are refused)
  • Overrides on loop/parallel containers and disabled blocks are refused; overrides the run never reached are listed in sideEffects.unused; mock fields a block doesn't declare are listed in undeclaredMockFields
  • Mocks are refused on a locked workflow or folder (423, like every other lock) and may not carry large-value references
  • next repeats child allows and reads mocks back with --mock-from <thisRun>, so it runs as printed
  • Selectors are capped at 256 characters and the same-workspace fallback is one query per request

Type of Change

  • New feature

Testing

  • dry-run.integration.ts (real Postgres/Redis): child allow by name and id, grandchild mock, locked child block/workflow, other-workspace id, containers, disabled chains, unused and undeclared fields, mock-from (secret redaction, stripping, 403 hidden vs 409 missing vs 409 running, test-run placeholders), dot shadowing, selector cap; each guard red-proofed
  • sim-cli suite (1178); touched apps/sim unit tests; 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)

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Nov 25, 2026 9:03pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 3/5 · Fix the recorded-output checks and broken next commands before merging.RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The changes affect dry-run execution and reruns across the workflow API and CLI.

Fix the recorded-output checks and broken next commands before merging.

Findings

  1. P1 Suggested reruns request missing outputs ▶
  2. P1 Draft edits change replay checks ▶
  3. P2 Large mock lists throw ▶
  4. P2 Valid child selectors disappear ▶

Summary

Adds child-workflow overrides and replay of recorded block outputs through the API and CLI.

  • Dry runs can control child blocks and reuse earlier recorded output.
  • Failed dry-run commands carry their child allows and mock inputs forward.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI["CLI allow / mock / mock-from"] --> Resolve["Resolve workflow and block"]
  Run["Recorded run"] --> Read["Authorized, masked output read"]
  Read --> Resolve
  Resolve --> Guards["Check locks and mock fields"]
  Guards --> Policy["Shared dry-run policy"]
  Policy --> Root["Root blocks"]
  Policy --> Child["Child blocks at every depth"]
  Root --> Result["Run result and override reports"]
  Child --> Result
  Result --> Next["CLI next command"]
Loading

Reviews (1) · Last reviewed commit: "feat(workflows): dry-run overrides reach..." · Reviewed by Greptile

Comment thread apps/sim/executor/utils/mock-output.ts Resolved
Comment thread apps/sim/lib/workflows/queries.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 23 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/executor/utils/mock-output.ts Resolved
Comment thread apps/sim/lib/workflows/queries.ts Resolved
…n earlier run

--allow and --mock (run.allowBlocks / run.mocks) now also name a block of a
workflow the run calls as <workflow>.<block> (the workflow's id or name, then
the block's id, name or key). A dotted selector names a block of the run's
workflow only by its exact id or display name (keys drop dots, so `slack.send`
never shadows child "Slack" block "Send"); otherwise its workflow part matches
the children Workflow blocks call by a fixed id, at any depth up to the call
chain limit, then, for a child chosen as the run goes, a workflow of the same
workspace by id or exact name, looked up once per request in one query.
Selectors are capped at 256 characters. Matches are deduplicated by workflow
and block; several distinct ones are refused with candidates. Another
workspace's workflow is never found, so its refusal is an unknown id's. A
workflow reachable only as a custom block is refused unless a Workflow block
chooses its child at run time. The policy keys every override by workflow and
block id, so a child's entry applies wherever that workflow runs, at every
depth. The dry-run record adds childAllowBlocks / childMockedBlocks.

Rough edges: loops, parallels, and blocks disabled anywhere up their container
chain are refused as targets; a mock of a block of a locked workflow or folder
returns 423 through requireMutableWorkflow, as any change to one does; a mock
holding a __simLargeValueRef is refused; the duplicate-mock error names both
selectors. sideEffects reports `unused` overrides, `undeclaredMockFields`
(Agent and Function outputs skipped) and `droppedMockFields`, and the CLI
prints a note for each.

run.mocksFrom {runId, blocks} (--mock-from <runId> with a bare --mock <block>)
answers this workflow's blocks with the outputs they recorded in an earlier run
of it, read through readWorkflowRun (read role, logs.trace_spans projection,
secrets redacted). Fields only a block sets are left out and reported. Refused:
a block the run did not execute; one in a loop or parallel unless that run
mocked it; and, from a test run, a block it answered with a placeholder rather
than mocking or allowing it. An unknown run is 404; a running one, or one with
no recorded outputs yet, 409; outputs hidden by the viewer's permission group
403 (readWorkflowRun now says which). A child selector there is refused with a
pointer to run.mocks. Recorded as dryRun.mocksFrom.

next repeats --mock-from; mocks the caller passed to this workflow's blocks are
read back from the failed run itself, and only a child's mock, or one passed
beside --mock-from, comes back as a --mock '<block>=<json>' placeholder, which
the CLI refuses verbatim with a hint to replace it.
… unreached mocks as placeholders in next

- run.mocksFrom checks loop ancestry and placeholder answers against the source run's
  workflow snapshot, not the draft edited since
- next reads a passed mock back with --mock-from only when the run reached it
  (sideEffects.unused); otherwise it prints a <json> placeholder
- refuse <workflow>.<block> selectors whose workflow names match more than the lookup cap
  instead of resolving a partial list
- walk mock outputs without spreading into push

This branch was successfully deployed

1 active deployment
Preview — 620e3928 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