feat(sdk): flows deploy --flow, flows versions, flows rollback (cloud#4115) - #597
Conversation
…#4115) A deployed flow's source is immutable on Cloud: a change becomes the next version and the listener points at it. - `flows deploy <file> --flow <name|listener-id>` deploys the source as the next version of an existing flow and changes nothing else. --repo, --on, --approver, --agents, --name and --draft are refused beside it, by name. Output: `DEPLOYED <id> listening · version 4 (was 3)`. - The create form reports the version Cloud recorded, when Cloud returns one. - Bytes that match an earlier version re-activate it, and the line says so: `re-activated version 2 (was 4; active version went down)`. - `flows versions <name|id>` lists versions newest first, the active one marked; `flows rollback <name|id> <version>` moves the pointer. Source loading is shared between the create and version forms (loadDeploySource). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Session-Id: 6ef9d620-3fc8-4bb3-bb0b-593d915c67ea
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f0887c8. Configure here.
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…on-uuid ids; safe version integers Review feedback on #597. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Session-Id: 6ef9d620-3fc8-4bb3-bb0b-593d915c67ea
|
End-to-end against production Cloud (agentrelay.com, cloud#4118 + cloud#4121 live at 55ac3bde9), using this PR's built CLI (head f059813): On a throwaway draft flow, created then deleted:
A real run on the bumped version: Not covered: the dashboard history and rollback UI, and the published npm package (after merge and release). |

CLI side of AgentWorkforce/cloud#4115: immutable flow versions, where the listener points at its active version. Server side: AgentWorkforce/cloud#4118 (data + API) and AgentWorkforce/cloud#4121 (bump,
POST …/versions, rollback). This PR needs #4121 deployed for--flow,versionsandrollback. The version suffix on the create form appears once #4118 is live, and is simply absent before.What changes
flows deploy <file> --flow <name|listener-id>is the one-command update the owner asked for. The cloud#4112 guide printsflows deploy cloud-software-garden.flow.ts --flow 'Cloud Software Garden'.POST /api/v1/flows/listeners/<id>/versions. The body carries only the source, its requirements and any plugins.--repo,--on,--approver,--agents,--nameand--draftare refused beside--flow, by name, before any request, so nobody thinks they took effect.--flowtakes the deployed name (case-insensitive, current workspace) or the listener id. An unknown or ambiguous name is refused with the remedy.Output:
The second line is an orchestrator requirement: when bytes match an earlier version, the active number going down must not read as a failure.
The create form appends the version Cloud reports (
DEPLOYED agent-9 listening · version 1) when Cloud returns one, and is otherwise unchanged.flows versions <name|id>lists versions newest first, with the active one marked.flows rollback <name|id> <version>moves the pointer and rewrites nothing (ACTIVATED <id> listening · re-activated version 2 (was 3; active version went down)). Both support--json.Structure
cloud-versions.ts: resolve flow, read listener, deploy a version, activate.cloud-versions-wire.ts: parse and describe version changes.cli/cloud-versions.ts: the three CLI handlers.cloud-deploy.ts: source loading extracted intoloadDeploySourceso both forms share it, with no behaviour change to the create path.Tests
tests/cloud-deploy.test.ts, 6 new cases against the fetch-mocked Cloud contract:requirements, source, workspaceId;--flowrefused before any request;versions/rollback, including a bad version argument.tests/relay-cli-surface.test.ts: sample invocations for the--flowform,versionsandrollback, as the drift table requires for new verbs. The gate logic is unchanged.cloud-deploy58/58, CLI surface 85/85,tsc --noEmitandtsc -p tsconfig.tests.jsonclean.test:prep(the cargo kernel build), which I skipped, and the run hit my timeout. None of those failures are in files this PR touches; CI is the authority here.Docs:
docs/CLOUD.mdgets a "Versions" section, andREADME.mdone line.Humans merge this repo; I won't.
🤖 Generated with Claude Code
Note
Medium Risk
Changes the cloud deploy CLI and version API client on a production-critical path, though listener-setting flags are explicitly refused and behavior is covered by mocked API tests.
Overview
Adds immutable hosted flow versions on the CLI: ship source updates without recreating the listener, inspect history, and roll the active pointer back.
flows deploy <file> --flow <name|listener-id>posts only source, requirements, and plugins toPOST …/listeners/<id>/versions. Repo, triggers, approver, agents, and budget stay on the listener;--repo,--on,--approver,--agents,--name, and--draftare rejected if passed alongside--flow. Output includes version transitions (version 4 (was 3), re-activation when bytes match an older version, including when the active number goes down).flows versionsandflows rollbacklist recorded versions (active marked) and call activate without deleting history; both support--json. Initial create deploys show a version suffix when Cloud returns one.Implementation splits
cloud-versions/cloud-versions-wireandcli/cloud-versions, withloadDeploySourceshared between create and version deploy paths. Docs inREADME.mdanddocs/CLOUD.md; contract tests incloud-deploy.test.tsand CLI surface samples.Reviewed by Cursor Bugbot for commit f059813. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds
flows deploy <file> --flow <name|listener-id>to make an existing flow's next version without changing its listener, plusflows versionsandflows rollbackto list and move the active version.--repo,--on,--approver,--agents,--name, and--draftare refused beside--flow, by name, before any request.--flowresolves a uuid, a non-uuid listener id the workspace lists, or a unique name in the current workspace; unknown or ambiguous names are refused with the remedy.rollbackaccepts a positive whole number up to nine digits; anything else is refused before any request.Written for commit f059813. Summary will update on new commits.