Skip to content

improvement(workflows): agent-benchmark fixes for JSON refs, export, subflow moves and rerun-from-block - #10399

Merged
waleedlatif1 merged 9 commits into
stagingfrom
improvement/workflow-code-agent-round14
Nov 25, 2026
Merged

waleedlatif1 merged 9 commits into
stagingfrom
improvement/workflow-code-agent-round14

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Fixes and friction removals found by A/B benchmark runs of agents editing workflows, on both the workflows-as-code path and the operations path.

Correctness

  • Unedited blocks no longer change storage:
    • Editing a Function's code could flip another, unedited block's stored JSON reference from quoted to bare, and the next run failed with invalid JSON.
    • source get now prints a quoted reference bare only when a declaration types it as text: the catalog, a variable, an input or response format, or an env var.
    • A type inferred from a Function's code or a child workflow prints as t`${ref}`, so the source states its own storage.
  • check agrees with apply: W_JSON_REF_UNTYPED is now reported on any block that compiles differently, matching what the server reports on apply.
  • Bare string references in JSON fields: in any JSON field (Response, table rows, API body), a bare reference whose value is a string is now spliced as a JSON string, not raw text.
    • A string that already reads as JSON is still nested as written, so an agent's JSON answer and a numeric env var still work.
    • Behaviour change: a bare reference to a JSON fragment ([<x>] with 1,2,3) now becomes a string.

Agent friction

  • sim workflows export:
    • Includes table, child-workflow and knowledge-base bindings by default. Credentials are still always cleared.
    • --no-include-workspace-bindings gives a copy to share outside the workspace.
    • The stderr note pointing to outline is gone.
  • Moving a block into a loop or parallel (parentId):
    • Existing edges that would cross the boundary are removed and named in a warning, instead of making --atomic refuse the whole batch.
    • Edges the batch itself asks for across a boundary are still refused.
  • Help text:
    • tables create --schema and tables columns create --column help is generated from the zod shape the server validates, so required, unique and the other column fields are documented and can't drift.
    • The API block's request retry fields are titled and described by exactly what they retry, separate from block-level retry.
  • Rerunning from a block:
    • A run that fails in a block prints next, the exact command to rerun the saved draft from that block with this run as --source-run.
    • The hidden raw --run flag is removed; run selection goes only through --manual, --from-block, --source-run and --stop-after.
    • The primers mention rerunning from a block and stay within their 4096-byte budget.
  • Cleanup:
    • The removed-edge warning uses the shared quotedBlockLabel.
    • The now-unused per-flag hidden contract option is removed.
    • DESIGN.md, SYNTAX.md and the syntax docs describe the new splice rule.

Type of Change

  • Bug fix
  • Improvement

Testing

  • Each behaviour change has a test that fails on the old code:
    • workflow-code print/compile round trip after a Function-only edit;
    • CLI check on a bound block that an edit elsewhere makes compile differently;
    • executor resolver with quotes, backslashes, newlines, unicode, JSON text and env values;
    • operations-apply integration (real Postgres) for an atomic move into a loop;
    • CLI export request defaults;
    • run next through the real CLI entry, then executing the printed command.
  • Ran the full local gate:
    • bun run generate, bun run lint, bun run type-check, bun run check:audits (72);
    • check-block-registry.ts origin/staging;
    • root bun run test;
    • bun run test:integration for the three apply-workflow-operations* integration files.

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 4:57am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

This PR fixes JSON references, workspace exports, moves into loops and parallels, and rerun commands.

  • JSON references keep their stored meaning when workflow code changes.
  • Failed workflow runs print a command that starts from the right block.
  • Workflow exports keep workspace bindings unless users ask to clear them.
  • Moving a block across a loop boundary removes and names invalid existing edges.
  • Table column help lists the fields accepted by the server.
  • Request retry waits stop at their configured maximum.

Reviews (4) · Last reviewed commit: "fix(api): keep rerunFromBlockId out of t..." · Reviewed by Greptile

@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 44 files

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

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/blocks/blocks/api.ts Resolved
…upstream code edits cannot flip its storage

A stored quoted token in a JSON field printed as the bare reference whenever refValueKind typed it
a string, including when that type was only inferred from a Function's code or a child workflow's
Response data. The printed source then left the field's storage to code in another block: an edit
there that made the type unreadable compiled every unedited reader bare, so a string value broke
the JSON at run time. The printer now prints a quoted token bare only when a declaration types it a
string (refDeclaresString), and as t`${ref}` otherwise, which stores quoted whatever the code returns.

The local check scoped W_JSON_REF_UNTYPED to blocks the lock does not bind, while the server reports
it for any field that compiles differently than stored; it now reports it on any block the edit
changed, including one an edit elsewhere makes compile differently.
…SON string

A reference outside any string literal in JSON text (a Response body, table row data, an api
body) spliced a string value raw, so `{"error": <check.message>}` produced invalid JSON for any
message that was not itself JSON. Such a string now lands JSON-encoded; a string that already
reads as one JSON value (an agent's JSON answer, a numeric env var) still splices as written,
and a reference inside a string literal keeps its existing escaping.

The api block's request retry params now say what they retry (timeouts, connection resets, 429
and 5xx, for GET/HEAD/PUT/DELETE unless non-idempotent retries are on), what fails at once (an
unresolvable or refusing host, other 4xx), and that the block retry setting is separate and
reruns the whole block after any failure. Their titles read "Request retries", "Request retry
delay (ms)" and "Max request retry delay (ms)".
…es, documented table columns

- `sim workflows export` keeps workspace bindings (table, knowledge base, child workflow ids) by default, so a table block prints its tableId; `--no-include-workspace-bindings` clears them for a copy to share. The stderr note pointing at `workflows outline` is gone.
- Moving a block into or out of a loop or parallel removes the stored edges the move leaves crossing the boundary and names them in `warnings`, instead of recording them as skipped items that made `atomic` refuse the batch. Edges the batch itself asks for across a boundary are still refused. Operations help states this.
- `tables create --schema` and `tables columns create --column` list every column field (required, unique, options, multiple, currencyCode, id, position) generated from the shape the server validates.
- A failed run (workflows run, runs get, runs wait) whose failure names a block now carries
  `next`: `sim workflows run <workflowId> --from-block <blockId> --source-run <runId>`, so an
  agent fixes the block, applies, and reruns only the failing part on that run's upstream outputs.
  Parallel-branch ids and ids outside the issued format get no command.
- The raw hidden `--run` JSON flag is gone; the run selection is built only from --manual,
  --trigger, --mock-payload, --from-block, --source-run and --stop-after.
- `workflows run --help` and the --from-block/--source-run descriptions say what the rerun reuses;
  both source primers name the rerun flags in Run and debug, within the 4096-byte budget.
- paused-run.ts becomes run-next.ts now that it names the next command for failed runs too.
…lag-hidden option, and align the splice docs
… retry delays and docs

- A failed run's error carries rerunFromBlockId: the failed block, or the outermost loop or
  parallel holding it, since a run cannot start inside one. Execute reads it from the graph the
  run executed, Get workflow run from the saved draft. The CLI prints next from it instead of
  the failed block id, so a failure inside a loop no longer prints a rerun the server refuses.
- Edge validation names why it dropped an edge (missing block, annotation-only, trigger target,
  scope); the removed-edge warning adds loop and parallel wiring advice only for a scope crossing.
- backoffWithJitter never waits longer than maxMs: jitter at the cap only shortens the wait, so
  an api block's max request retry delay is a real maximum.
- source check help: W_JSON_REF_UNTYPED scope sentence rewritten.
- cross-kind integration expects a child-result text ref printed as t`${...}`.
- Docs baseline hashes for the operations apply edge help fence.
@waleedlatif1
waleedlatif1 force-pushed the improvement/workflow-code-agent-round14 branch from c892fed to 643d245 Compare November 25, 2026 04:38
@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.

Comment thread packages/utils/src/retry.test.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 63 files

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

Turn on auto-fix | Re-trigger cubic

@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 63 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

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 63 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 43d2b8c into staging Nov 25, 2026
95 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/workflow-code-agent-round14 branch November 25, 2026 09:55

This branch was successfully deployed

1 active deployment
Preview — 3f5f38f1 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