Skip to content

fix(workflow-code): agent-facing semantics copy for guardrails failures, loop results, and params --full - #10543

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/wac-qa-b5-agent-semantics-copy
Dec 1, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/wac-qa-b5-agent-semantics-copy

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes text that agents read about guardrails failures, loop and parallel results, and source params. It is QA batch B5 for workflows as code.

A failed Guardrails check ends the run "completed" with empty output

  • Why: a failed check sets output.error, and the edge manager only takes a block's normal output when error is empty. A Condition placed after the block that tests <guardrails.passed> never runs, so with nothing on the error port the run completes with no output. The block's bestPractices, its output descriptions, the docs page and its three preview workflows all recommended that Condition.
  • What: rewrote the bestPractices and the passed/error output descriptions in blocks/guardrails.ts, which feed params and the generated SDK types. Rewrote guardrails.mdx with a warning callout, and redrew the three previews so a failure takes the error port (red edge) instead of going through a Condition. Executor behaviour is unchanged on purpose, because changing it would alter existing UI workflows. A compile warning for a Guardrails block with no error edge belongs to another batch.

Loop and parallel results type and docs say "one output per iteration"

  • Why: at runtime results[i] is the list of outputs from the body blocks of iteration i. core.d.ts typed it as Json[] and said "lists every iteration's output". The cookbook and primer said the same.
  • What: SubflowOutput.results is now Json[][], with TSDoc that matches the AGENTS.md semantics section. The loop TSDoc, the cookbook comments in agents.ts and cookbook.ts, the primer's Loop line and the json-fields.ts comment now use the same wording. The primer was already near its byte budget, so its Loop line now just shows each.results[i][0].

source params JSON drops the pointer to --full

  • Why: the text form ends with a line that points to --full, but the JSON form, which is the CLI default for agents, did not. Agents downloaded the whole catalog to find enum values instead.
  • What: the JSON brief now carries next: { command: "<sim> workflows source params <key> --dir <dir> --full", reason }.

Type of Change

  • Bug fix

Testing

  • packages/workflow-sdk/test/negative/rejected.ts: perLead.results[0].content must be a type error, and results[0][0].content must type-check. Red first: with core.d.ts reverted, it fails with "Unused '@ts-expect-error' directive". It passes after the fix.
  • workflow-source-params.test.ts: the JSON brief names a next command. Running that command returns the full reference, and that reference types every optional param in the brief. Red first: with the command file reverted, next is undefined. It passes after the fix. The existing size-ratio check now compares the builder objects rather than the whole JSON output.
  • Corpus: ROUNDTRIP_CORPUS_FULL=1 typecheck corpus, sdk-examples and hand-written all pass, so Json[][] breaks no corpus workflow.
  • End to end on staging, in a throwaway workspace: start → guardrails('Check JSON', { validationType: 'json' }) → check.to(valid) and check.onError(reject), written the way the new docs say. Input "not json" reached Reject with the parse error in check.error; valid JSON reached Valid.
  • Package suites pass: workflow-sdk, workflow-code, sim-cli, apps/sim blocks. Type-check passes for workflow-sdk, workflow-code, sim-cli, docs and apps/sim. bun run lint, bun run check:audits and bun run generate were run, and the generated files are committed.

Risks

  • Low. The guardrails changes are copy and docs only. Json[][] is stricter than before: a source that reads each.results[0].field now fails check. That code was already wrong at runtime.
  • core.d.ts is shared with the B1 and B3 batches. The edit here is limited to SubflowOutput.results and the loop TSDoc, so a rebase conflict would be small.

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 Dec 1, 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 Dec 1, 2026 7:04am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

This PR corrects agent-facing workflow guidance.

  • Guardrails guidance sends failed checks to the error port.
  • Loop and parallel results show each body's outputs as a list.
  • The JSON parameter brief points to its full reference.

The earlier, unnumbered workspace-selection finding is fixed: the printed command preserves --workspace.

Reviews (3) · Last reviewed commit: "fix(sim-cli): keep the typed workspace a..." · 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 13 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 Dec 1, 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 13 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

…es, loop results, and params --full

- guardrails block, docs and previews: a failed check leaves through the error port, so handle it there (onError in workflow code), not with a Condition on passed
- loop/parallel results typed Json[][] with the per-iteration wording in core.d.ts, cookbook, primer and json-fields
- source params JSON brief names the --full lookup as next
@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 Dec 1, 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 13 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 e34fbba into staging Dec 1, 2026
156 of 158 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/wac-qa-b5-agent-semantics-copy branch December 1, 2026 07:40

This branch was successfully deployed

1 active deployment
Preview — 3adffa05 Deployed Dec 1, 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