Skip to content

Commit 02de1d0

Browse files
committed
improvement(workflows): placeholders follow the declared output schema and redact once
A dry-run echo was merged into the sample by the sample's value shape, so a table row declared as bare json came back with the generic sample keys (name: 'Sample Object', status: 'active') beside its data, and every batch row shared the id 'item_1'. The echo is now laid over the sample by the declared schema: field by field where an output declares properties, item by item where it declares array items, and whole anywhere else (an undeclared field is dropped). The table hooks return the row as the routes emit it (data, and placeholder id, position and timestamps, distinct per batch row) with no ignored columns; update's row holds only the fields it patches. Knowledge create echoes only the document name, and file write sizes its text with utf8ByteLength. Value-based masking replaced every occurrence of any string under a secret-named field, however short, so a one-letter reset_token column turned 'a@b.co' into '[REDACTED]@b.co' in the request and in what downstream blocks read; worse, a value masked inside a run secret left the rest of that secret unmatched by the registry. Values shorter than the repo's identifying-literal floor (isNonIdentifyingSecretLiteral) are now masked only by their field, password fields are masked by name like credential-named ones, and the registry projection runs before key and value masking. A stubbed write's request and echo are redacted in one pass, one PII call per write; when that pass cannot vouch for the pair, both are null.
1 parent 414b743 commit 02de1d0

16 files changed

Lines changed: 412 additions & 142 deletions

File tree

‎.agents/skills/add-tools/SKILL.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ search that returns no email or phone, and an email verifier.
236236
fields only on entries that carry one.
237237
- A dry run answers a `write` with a sample of its `outputs`. When downstream blocks read output the
238238
request alone determines (a table write's `row.data`, a created file's `name`), declare a pure
239-
`dryRunOutput(params)` returning just those fields; it gets params with secrets masked, and the
240-
sample fills ids and everything else. Never guess at what the provider would add.
239+
`dryRunOutput(params)` returning just those fields; it gets params with secrets masked. It is laid
240+
over the sample by the declared schema: field by field where an output declares `properties`,
241+
whole anywhere else, so return an undeclared shape (a `json` row) complete, with placeholders for
242+
what the request cannot know. Never guess at what the provider would add.
241243

242244
## Critical Rules for Parameters
243245

‎apps/docs/content/docs/api-reference/build-and-run-workflows.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Apply without `dryRun`. Set `atomic: true` in the body to write nothing when any
166166

167167
## 7. Test the draft [#test-run]
168168

169-
Run the saved draft with `run.source: "manual"` and `run.dry: true`. A dry run sends no writes: every tool call not declared `read` (table writes, sends, HTTP calls, custom and MCP tools) returns a correctly shaped placeholder (a table write echoes the row it would have written, secrets masked, so a block reading `row.data` gets the values it wrote), and the result lists it under `sideEffects.stubbed` with the request it would have sent, credentials, secrets and password fields redacted. Check those payloads instead of cleaning up test data. Reads and model calls run for real, child workflows run dry too, and custom blocks are answered whole. Code runs for real (a Function block's, a Condition's expressions, a While or Do While loop's condition, or code an Agent's model writes) and is listed under `sideEffects.unchecked`. A dry run keeps nothing beyond its own log, which is under the `test` trigger: Agents read their memory but write none, and it raises no workspace event and does not count as a run of the workflow. Human in the loop and Wait blocks are answered whole, so a dry run never pauses, and a test run is never resumed. A failed dry run still returns its `sideEffects`, and only another dry run can use it, or a workflow test's run, as `run.entry.sourceRunId`. Allowing an Agent with `run.allowBlocks` sends only its own tool calls, not a workflow or custom block it calls. A mock is data: it cannot replace a locked block or set a field the run's execution, trace or billing reads (such as `cost`, `tokens`, `model` or a field starting with `_`), and the run records only which blocks were mocked, so a rerun passes `run.mocks` again, while the run's log shows a mocked block's output like any other block's. `run.mocks` names at most 50 blocks. Manual runs are synchronous or streamed, never `async`; a dry run is synchronous only.
169+
Run the saved draft with `run.source: "manual"` and `run.dry: true`. A dry run sends no writes: every tool call not declared `read` (table writes, sends, HTTP calls, custom and MCP tools) returns a correctly shaped placeholder (a table row insert, upsert or update echoes the data it would have written before the table coerces it, secrets masked, so a block reading `row.data` gets the values it wrote), and the result lists it under `sideEffects.stubbed` with the request it would have sent, credentials, secrets and password fields redacted. Check those payloads instead of cleaning up test data. Reads and model calls run for real, child workflows run dry too, and custom blocks are answered whole. Code runs for real (a Function block's, a Condition's expressions, a While or Do While loop's condition, or code an Agent's model writes) and is listed under `sideEffects.unchecked`. A dry run keeps nothing beyond its own log, which is under the `test` trigger: Agents read their memory but write none, and it raises no workspace event and does not count as a run of the workflow. Human in the loop and Wait blocks are answered whole, so a dry run never pauses, and a test run is never resumed. A failed dry run still returns its `sideEffects`, and only another dry run can use it, or a workflow test's run, as `run.entry.sourceRunId`. Allowing an Agent with `run.allowBlocks` sends only its own tool calls, not a workflow or custom block it calls. A mock is data: it cannot replace a locked block or set a field the run's execution, trace or billing reads (such as `cost`, `tokens`, `model` or a field starting with `_`), and the run records only which blocks were mocked, so a rerun passes `run.mocks` again, while the run's log shows a mocked block's output like any other block's. `run.mocks` names at most 50 blocks. Manual runs are synchronous or streamed, never `async`; a dry run is synchronous only.
170170

171171
<Tabs items={['curl', 'CLI']}>
172172
<Tab value="curl">

‎apps/docs/openapi-v2-workflows.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17758,7 +17758,7 @@
1775817758
"minLength": 1
1775917759
},
1776017760
"dry": {
17761-
"description": "Dry run: every tool call not declared `read` (sends, table writes, HTTP calls, custom and MCP tools) is not sent; it returns a correctly shaped placeholder (a table write echoes the row it would have written, secrets masked) and is listed in `sideEffects.stubbed` with the request it would have sent, credentials, secrets and (when the workspace redacts it) PII redacted. Reads, model calls and credential resolution run for real, and so does code (a Function block's, a Condition's expressions, a While or Do While loop's condition, or code an Agent's model writes), listed in `sideEffects.unchecked`. Child workflows inherit it. Custom, Mothership, Pi, Human in the loop and Wait blocks are answered whole with placeholders. Agents read their memory but write none, and nothing else beyond the run's own log is kept: it raises no workspace event and does not count as a run of the workflow. Logged under the `test` trigger. Synchronous only: cannot be combined with `stream` or `waitTimeoutSeconds`.",
17761+
"description": "Dry run: every tool call not declared `read` (sends, table writes, HTTP calls, custom and MCP tools) is not sent; it returns a correctly shaped placeholder (a table row insert, upsert or update echoes the data it would have written, secrets masked) and is listed in `sideEffects.stubbed` with the request it would have sent, credentials, secrets and (when the workspace redacts it) PII redacted. Reads, model calls and credential resolution run for real, and so does code (a Function block's, a Condition's expressions, a While or Do While loop's condition, or code an Agent's model writes), listed in `sideEffects.unchecked`. Child workflows inherit it. Custom, Mothership, Pi, Human in the loop and Wait blocks are answered whole with placeholders. Agents read their memory but write none, and nothing else beyond the run's own log is kept: it raises no workspace event and does not count as a run of the workflow. Logged under the `test` trigger. Synchronous only: cannot be combined with `stream` or `waitTimeoutSeconds`.",
1776217762
"type": "boolean"
1776317763
},
1776417764
"allowBlocks": {

‎apps/sim/executor/execution/types.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ export interface StubbedToolCall extends SideEffectSite {
348348
/** The request with credentials, secrets and PII redacted; null when that cannot be vouched for. */
349349
request: Record<string, unknown> | null
350350
/**
351-
* The output the tool's `dryRunOutput` derives from that request, redacted like it; null when
352-
* the tool declares none or that cannot be vouched for, so the placeholder is the sample alone.
351+
* The tool's `dryRunOutput` of the masked params, redacted with `request`; null when the tool
352+
* declares none or it cannot be built or vouched for, leaving the placeholder the sample alone.
353353
*/
354354
echoed: Record<string, unknown> | null
355355
}

‎apps/sim/lib/api/contracts/v2/workflows.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ export const v2WorkflowRunSelectionSchema = z.discriminatedUnion('source', [
17091709
.boolean()
17101710
.optional()
17111711
.describe(
1712-
"Dry run: every tool call not declared `read` (sends, table writes, HTTP calls, custom and MCP tools) is not sent; it returns a correctly shaped placeholder (a table write echoes the row it would have written, secrets masked) and is listed in `sideEffects.stubbed` with the request it would have sent, credentials, secrets and (when the workspace redacts it) PII redacted. Reads, model calls and credential resolution run for real, and so does code (a Function block's, a Condition's expressions, a While or Do While loop's condition, or code an Agent's model writes), listed in `sideEffects.unchecked`. Child workflows inherit it. Custom, Mothership, Pi, Human in the loop and Wait blocks are answered whole with placeholders. Agents read their memory but write none, and nothing else beyond the run's own log is kept: it raises no workspace event and does not count as a run of the workflow. Logged under the `test` trigger. Synchronous only: cannot be combined with `stream` or `waitTimeoutSeconds`."
1712+
"Dry run: every tool call not declared `read` (sends, table writes, HTTP calls, custom and MCP tools) is not sent; it returns a correctly shaped placeholder (a table row insert, upsert or update echoes the data it would have written, secrets masked) and is listed in `sideEffects.stubbed` with the request it would have sent, credentials, secrets and (when the workspace redacts it) PII redacted. Reads, model calls and credential resolution run for real, and so does code (a Function block's, a Condition's expressions, a While or Do While loop's condition, or code an Agent's model writes), listed in `sideEffects.unchecked`. Child workflows inherit it. Custom, Mothership, Pi, Human in the loop and Wait blocks are answered whole with placeholders. Agents read their memory but write none, and nothing else beyond the run's own log is kept: it raises no workspace event and does not count as a run of the workflow. Logged under the `test` trigger. Synchronous only: cannot be combined with `stream` or `waitTimeoutSeconds`."
17131713
),
17141714
allowBlocks: z
17151715
.array(z.string().min(1, 'run.allowBlocks entries cannot be empty'))

0 commit comments

Comments
 (0)