feat(dsl): dry runs take real call results and name what was made up #4525
<!-- greptile_summary -->
<h2>Confidence Score: 5/5<a href="https://app.greptile.com/api/retrigger?id=126193126&sig=358f29cf6b60c294f0d60ec0c80a180c94576bb9b099eb2b2244d2fc8fdcaaa0"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=parcha&next=%2Fparcha-ai%2Fagentrun%2Fpull%2F4525&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a></h2>
[Medium impact] The PR appears safe to merge; the async fallback issue is fixed.
<h3>Summary</h3>
dryRunWorkflow accepts host answers for calls and names synthesized input and call results when deterministic code throws.
<!-- greptile_confidence_score:5 -->
<sub>Reviews (2) · Last reviewed commit: "fix(dsl): a dry run awaits an async effe..." · Reviewed by Greptile</sub>
<a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Async fallback fails
When an async effects callback resolves to undefined, answered is still a Promise at this check. The dry run skips synthesis, then rejects the resolved undefined against the call's out schema. A host using an async recorded-response lookup therefore cannot leave some calls unanswered as documented.
Await opts.effects?.(request) before checking for undefined, and add an async fallback test.
const answered = await opts.effects?.(request);
if (answered !== undefined) return answered;
Fixed in 70c4c1c692: the dry run awaits opts.effects?.(request) before checking for undefined, and the option's type is unknown | Promise<unknown>. New test: an async callback that resolves to undefined for one call is synthesized and counted as made up, and an async callback that resolves to a result is used (the run passes with the real output).
@greptile-apps please review again
greptile-apps[bot]
claudio-michel[bot]
This PR rebases after #4523 and #4524 merge (it shares
dry-run.tsand the README with them); I'll rebase it and regenerate the contract, then the references, then rebuild.Why
A dry run synthesizes every tool and executor result from the call's
outschema. That is fine for shape checks, but a workflow that joins its input to what a tool returns (look up an order, then find the line item the customer named) fails on made-up data however right it is: the made-up ids never match. The failure then reads like a bug in the workflow. This is a generic host feature: a host that can answer some calls for real (a fixture, a read-only replica, a recorded response) can give the dry run those answers, and every host gets a failure message that says what was made up.What
<details><summary><code>packages/dsl/src/dry-run.ts</code>: host-answered effects</summary>
effectsreceives the same requestrunEffectdoes.</details>
Before / After
A workflow that looks up an order, then finds the price of the line the input names (
s.order.items.find(...).price):Evidence
packages/dsl/test/dry-run-effects.test.mjs, 5 tests: a join over made-up data fails and the message names the input and the call result; with the input and the call answered by the host, the same workflow passes; anundefinedanswer is synthesized and counted; with nothing made up, failures read as before; a host answer is held to the call'soutschema.Test plan
pnpm --filter @parcha/agentrun-dsl run build && cd packages/dsl && node --test test/*.test.mjspnpm run export:source && pnpm run verify:sourceMigration notes
None
Source: no linked issue; a host-integration feature, described under Why.
🤖 Generated with Claude Code
<!-- codesmith:footer -->
---
<a href="https://dashboardbackend.blacksmith.sh/track/run-proof?expires=1798756550&installation_model_id=431113&pr_number=4525&ref=codesmith_pr_footer&repository=Parcha-ai%2Fagentrun&return_to=https%3A%2F%2Fgithub.com%2FParcha-ai%2Fagentrun%2Fpull%2F4525&variant=show_it_working&signature=e21bf37eefbec93de27f0494e287406d6799856bd733ee9877002614c3323e4c"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-show-it-working-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-show-it-working-v2-light.svg"><img alt="Show it working" src="https://pr-comments-assets.blacksmith.sh/codesmith/proof-show-it-working-v2-dark-3x.png" width="140" height="28"></picture></a>
<sup><a href="https://app.blacksmith.sh/Parcha-ai/codesmith/agentrun/pr/4525?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>
<!-- codesmith:autofix:disabled -->
<!-- /codesmith:footer -->