← Back to Pull requests

feat(dsl): dry runs take real call results and name what was made up #4525

Open
claudio-michel[bot] opened this pull request with 108 lines diff across 4 files
View on GitHub
claudio-michel[bot] claudio-michel[bot] commented on Dec 01, 2026 22:35 UTC
Author

This PR rebases after #4523 and #4524 merge (it shares dry-run.ts and 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 out schema. 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

packages/dsl/src/dry-run.ts              effects option; counts made-up results; names them in a failure
packages/dsl/test/dry-run-effects.test.mjs   5 tests
packages/dsl/README.md, changes/dsl-dry-run-effects.md

<details><summary><code>packages/dsl/src/dry-run.ts</code>: host-answered effects</summary>

dryRunWorkflow(wf, { input?, effects? })
  └─ runWorkflow(..., runEffect)
       ├─ via shell                     -> fixed empty result, as before
       ├─ effects(request) !== undefined -> that result, held to the call's out schema like any effect's
       └─ otherwise                      -> synthesized from out, counted as made up
  on a deterministic failure: message + "(on made-up values: the input and N call results came from their schemas, ...)"
  nothing extra when the host supplied both the input and every result

effects receives the same request runEffect does.
</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):

before: deterministic path threw over schema-conforming inputs (at "line price"): <TypeError reading price>
after:  deterministic path threw over schema-conforming inputs (at "line price"): <TypeError reading price> (on made-up
        values: the input and 1 call result came from their schemas, so a lookup that joins them can miss; give the dry
        run input and effects to run it on real ones)
after, with input and effects given: { ok: true, status: "passed" }, output { price: 9.5 }

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; an undefined answer is synthesized and counted; with nothing made up, failures read as before; a host answer is held to the call's out schema.

  • Lean: not needed (dry-run only; the interpreter is unchanged).

  • autoqa and blast-radius: none (library change, no deployment).
  • Test plan

  • pnpm --filter @parcha/agentrun-dsl run build && cd packages/dsl && node --test test/*.test.mjs

  • pnpm run export:source && pnpm run verify:source
  • Migration 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 -->

    Diff: 108 lines (+103 / -5) across 4 files Reviewer: greptile-apps[bot] Review duration: 7067m
    All Vouch review confidence checks passed
    Residual risk 0.07 = Change Risk (0.35) × (1 − Review Confidence (0.79)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 108 lines diff across 4 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.61 · 4 substantive comment(s)
    0.61
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    79%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.281
    Real PR Conversation Timeline
    5 items
    greptile-apps[bot] greptile-apps[bot] commented on Dec 01, 2026 22:37 UTC
    Bot

    <!-- greptile_summary -->

    <h2>Confidence Score: 5/5<a href="https://app.greptile.com/api/retrigger?id=126193126&amp;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&amp;next=%2Fparcha-ai%2Fagentrun%2Fpull%2F4525&amp;utm_source=greptile_review&amp;utm_medium=github&amp;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.

  • Dry runs can use real call answers and explain which values were made up.
  • <!-- greptile_confidence_score:5 -->

    <sub>Reviews (2) · Last reviewed commit: "fix(dsl): a dry run awaits an async effe..." · Reviewed by Greptile</sub>

    greptile-apps[bot] greptile-apps[bot] commented on code on Dec 01, 2026 22:37 UTC
    Code Review
    packages/dsl/src/dry-run.ts:1
    @@ -312,9 +328,14 @@ export async function dryRunWorkflow(workflow: Workflow, opts: DryRunOptions = {
           },
           syntheticEffects: true,
           decisionProviders: syntheticProviders(workflow),
    -      runEffect: async ({ node, schema }) => { await step(); return node.via === "shell"
    -        ? { code: 0, stdout: "{}", stderr: "", truncated: false }
    -        : synthesized(() => synthesize(schema ?? (workflow.schemas || {})[node.out as string] as Record<string, unknown>, (schema?.definitions as Record<string, unknown> | undefined) ?? workflow.schemas ?? {}, 0, spend)); },
    +      runEffect: async (request) => {
    +        const { node, schema } = request;
    +        await step();
    +        if (node.via === "shell") return { code: 0, stdout: "{}", stderr: "", truncated: false };
    +        const answered = opts.effects?.(request);
    +        if (answered !== undefined) return answered;

    <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;
    

    claudio-michel[bot] claudio-michel[bot] commented on code on Dec 01, 2026 22:48 UTC
    Code Review
    packages/dsl/src/dry-run.ts:1
    @@ -312,9 +328,14 @@ export async function dryRunWorkflow(workflow: Workflow, opts: DryRunOptions = {
           },
           syntheticEffects: true,
           decisionProviders: syntheticProviders(workflow),
    -      runEffect: async ({ node, schema }) => { await step(); return node.via === "shell"
    -        ? { code: 0, stdout: "{}", stderr: "", truncated: false }
    -        : synthesized(() => synthesize(schema ?? (workflow.schemas || {})[node.out as string] as Record<string, unknown>, (schema?.definitions as Record<string, unknown> | undefined) ?? workflow.schemas ?? {}, 0, spend)); },
    +      runEffect: async (request) => {
    +        const { node, schema } = request;
    +        await step();
    +        if (node.via === "shell") return { code: 0, stdout: "{}", stderr: "", truncated: false };
    +        const answered = 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).

    claudio-michel[bot] claudio-michel[bot] commented on Dec 01, 2026 22:49 UTC
    Author

    @greptile-apps please review again

    Assignees
    claudio-michel[bot] claudio-michel[bot]
    Labels
    risk: low confidence: 79.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.4% (MEDIUM) · Higher = larger blast radius
    35.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 79.4% · Lower = rushed or shallow review
    79.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 7.3% · Safe to merge
    7.3%