Repository navigation
fix(workflow-code): agent-facing semantics copy for guardrails failures, loop results, and params --full - #10543
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThis PR corrects agent-facing workflow guidance.
The earlier, unnumbered workspace-selection finding is fixed: the printed command preserves Reviews (3) · Last reviewed commit: "fix(sim-cli): keep the typed workspace a..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 13 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…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
0ab8ca8 to
3adffa0
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
This PR fixes text that agents read about guardrails failures, loop and parallel
results, andsource params. It is QA batch B5 for workflows as code.A failed Guardrails check ends the run "completed" with empty output
output.error, and the edge manager only takes a block's normal output whenerroris 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.passed/erroroutput descriptions inblocks/guardrails.ts, which feedparamsand the generated SDK types. Rewroteguardrails.mdxwith 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
resultstype and docs say "one output per iteration"results[i]is the list of outputs from the body blocks of iterationi.core.d.tstyped it asJson[]and said "lists every iteration's output". The cookbook and primer said the same.SubflowOutput.resultsis nowJson[][], with TSDoc that matches the AGENTS.md semantics section. The loop TSDoc, the cookbook comments inagents.tsandcookbook.ts, the primer's Loop line and thejson-fields.tscomment now use the same wording. The primer was already near its byte budget, so its Loop line now just showseach.results[i][0].source paramsJSON drops the pointer to--full--full, but the JSON form, which is the CLI default for agents, did not. Agents downloaded the whole catalog to find enum values instead.next: { command: "<sim> workflows source params <key> --dir <dir> --full", reason }.Type of Change
Testing
packages/workflow-sdk/test/negative/rejected.ts:perLead.results[0].contentmust be a type error, andresults[0][0].contentmust type-check. Red first: withcore.d.tsreverted, it fails with "Unused '@ts-expect-error' directive". It passes after the fix.workflow-source-params.test.ts: the JSON brief names anextcommand. Running that command returns the full reference, and that reference types every optional param in the brief. Red first: with the command file reverted,nextis undefined. It passes after the fix. The existing size-ratio check now compares thebuilderobjects rather than the whole JSON output.ROUNDTRIP_CORPUS_FULL=1typecheck corpus,sdk-examplesandhand-writtenall pass, soJson[][]breaks no corpus workflow.guardrails('Check JSON', { validationType: 'json' })→check.to(valid)andcheck.onError(reject), written the way the new docs say. Input"not json"reached Reject with the parse error incheck.error; valid JSON reached Valid.bun run lint,bun run check:auditsandbun run generatewere run, and the generated files are committed.Risks
Json[][]is stricter than before: a source that readseach.results[0].fieldnow failscheck. That code was already wrong at runtime.core.d.tsis shared with the B1 and B3 batches. The edit here is limited toSubflowOutput.resultsand the loop TSDoc, so a rebase conflict would be small.Checklist
test-auditauthoring gate)