Repository navigation
improvement(workflow-code): fewer agent turns on the source loop: apply --run, get by name, tail-safe output - #10440
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
[Medium impact] The PR appears safe to merge. SummaryAdds
|
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Confidence score: 3/5
- In
workflow-source-apply.ts, this follow-up reruns the workflow from the start, even when no source block can be entered, so it may repeat unrelated work or produce a rerun with no valid target. Useerror.rerunFromBlockIdand the run ID to build a targeted rerun.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/sim-cli/src/commands/protocol/workflow-source-apply.ts">
<violation number="1" location="packages/sim-cli/src/commands/protocol/workflow-source-apply.ts:304">
P2: This follow-up always reruns the workflow from its start and is emitted even when no source block is enterable. Use `error.rerunFromBlockId` and the run id to build the targeted rerun (the outermost loop/parallel when applicable), and omit `next` when the server provides no enterable block; otherwise upstream blocks run again and input or timeout failures get a misleading source-fix command.
(Based on your team's feedback about choosing an enterable rerun start.) [07afeeb8-4946-46b1-9966-1431082ea3b1]</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
f6b17b3 to
b98ac6b
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 23 files
Confidence score: 3/5
source-primer.tsmay lead agents to treat the default dry run as side-effect-free, even though sandboxed code runs unchecked and generated GET requests are sent. Clarify that agents must inspect the relevantsideEffectssetting before running it.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/sim-cli/src/commands/protocol/source-primer.ts">
<violation number="1" location="packages/sim-cli/src/commands/protocol/source-primer.ts:52">
P1: This run guidance can lead agents to treat the default dry run as side-effect-free even though sandboxed code executes unchecked and code-generated GET requests are sent. State that agents must inspect `sideEffects.unchecked`, use test resources for GET endpoints, and treat `--allow <block>` and `--draft` as real writes.</violation>
</file>
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. |
There was a problem hiding this comment.
All reported issues were addressed across 23 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…ly --run, get by name, tail-safe output
- `source apply|create --yes --run '<input>' [--deploy]`: apply, dry-run the saved draft with
that input, deploy only if the run completed; one result, exit 1 at a failed run with the
failing block mapped to file:line. Reuses the `workflows run --dry` request and the deploy step.
- `source get <workflow>` takes an id or the exact name; none or several matches are refused
with each candidate's id.
- Help chains `get … && cat .sim/AGENTS.md`, so the primer arrives with the get.
- Primer: Retry, Child (`runWorkflow`) and api `.error` lines; edit loop is
`check && apply --yes --run '{…}' --deploy`.
- Output survives `| head` and `| tail`: apply opens with `summary` and ends with
errors, warnings, live, next; block lists are one string per block; deploy ends with `live`;
a lint report keeps only its findings in every format.
- Shorter `sim --help` and `source --help`.
…, tested deploy named in its reason
- get <name> reads every page of matches before deciding exact or ambiguous. - A create whose --run fails names the apply of the created workflow next. - A failed test run carries the server's rerun from its enterable block. - Starters are taught create, not apply (primer, AGENTS.md pointer, root help); --allow keeps its test-resources warning; the standalone test run includes --input. - A deploy answering lint: null prints no lint field. - Record the intended `source get <workflow>` usage change in the docs baseline.
- get <name> --dir looks the name up in the workspace the directory was read from. - A starter's next keeps --run and --deploy. - Guide: flags that imply the draft, and sideEffects.omitted before trusting a list. - Drop the test that compared two help strings.
…s listed when present
67732b3 to
f906574
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
* fix(sim-cli): keep the workflow primer within its byte budget #10440 and #10444 each fit the 4096-byte budget, but together the workflow primer reached 4127 bytes and the primer budget test failed on staging. Tighten two sentences (88 bytes of headroom) without dropping any rule. * fix(sim-cli): keep the primer's note that --run tests the draft
Summary
A transcript analysis of the workflows-as-code benchmark found that a coding agent spends 11.3 turns per task, and each turn costs about 82k tokens. This PR removes the turns that come from how the CLI is shaped:
sim workflows source apply --yes --run '<input json>' --deploy(andcreate) applies the source, dry-runs the saved draft with that input, and deploys only if the run completed. It prints one result. If the run fails, the command exits 1, maps the failing block to file:line, deploys nothing, and itsnextis the same command again. It sends the same request asworkflows run --dry --input(dryRunDraft, extracted from the run command) and runs the existing deploy step. Without--deploy, thenextfor a deployed workflow whose draft now differs is this command; the untested, fingerprint-pinned deploy command is named in itsreason.source get <workflow>takes an id or an exact name. If no workflow or several workflows match, it fails withWORKFLOW_NOT_FOUNDorWORKFLOW_NAME_AMBIGUOUSand lists each candidate with its id. A name never resolves to a workflow whose name only contains it.--helpis nowget <workflow> --dir ./wf && cat ./wf/.sim/AGENTS.md. This removes the separatecatturn without printing the primer twice.workflow.tsis not chained, because at 192 blocks it is 57 KB, and agents grep it instead.runWorkflow) and the api.error/ Function-only.errorMessageline are checked against the cookbook. The edit loop ischeck && apply --yes --run '{…}' --deploy. The primer is now workflow 3913 → 3983 B and workspace 3941 → 4010 B (budget 4096); the space came from trimming the Run line and folding in the Deploy bullet.| headand| tail.applyandcreateprint a one-linesummaryfirst (counts, findings, test run, live) and end witherrors,warnings,liveandnext.added,removedandmodifiedare now one string per block (key (type),key (field, …)).live.sources/sinks(3.5 KB of 5.5 KB at 192 blocks) are no longer printed.sim --help4858 → 4541 B,sim workflows source --help4064 → 3518 B,sim workspaces source --help2868 → 2380 B.Machine-output changes for consumers of
--output json:added,removedandmodifiedare now string lists.lintdropssources/sinks, and is absent when it has no findings.livehas moved from first to last.The
getpositional is now<workflow>. The primer text and the command inventory (the new--runoption, plusexecuteWorkflowandlistWorkflowson apply, create and get) both feed the Mothership grammar sync.Type of Change
Testing
apply --runcompletes, then deploys: checks the request body and order.--runbeside--dryis refused before any request.get <name>: an exact match among substring hits succeeds; ambiguous or missing names are refused and list each candidate's id.bun run generate,bun run lint,bun run type-check,bun run check:audits,bun run check:api-validation:strict,bun run test(the sim-cli suite: 91 files, 1237 tests), andcheck-block-registry.ts origin/staging.Checklist