Branches, PRs & merges

Cloudrizz is versioned like real software. Changes are committed to feature branches, previewed in isolation, and merged into main through a pull request an org admin reviews. Non-overlapping changes auto-merge, even two edits to different parts of the same file, and only overlapping edits are handed to the assistant to resolve, but a human approves what ships.

Why main is protected

You can't commit straight to main, save_version and edit_file refuse it. Work goes on a feature branch and reaches main only via a merged pull request. This keeps production deployable and gives every change a review point.

The flow

  1. Commit to a feature branch, just pick a branch name when calling save_version / edit_file and it's auto-created from main. (manage_branch (action: create) only when forking from a non-HEAD commit.)
  2. deploy_app on the branch to get a live preview URL, backed by the branch's own throwaway sandbox so it can't touch production data.
  3. manage_pull_request (action: open) with a clear title and description. One open PR per branch.
  4. An app admin reviews and merges, via the dashboard or merge_pull_request. If the target hasn't moved the merge fast-forwards; if it advanced but the two branches touched different files, or the same file in non-overlapping places (e.g. opposite ends), Cloudrizz merges them automatically. Only when both sides changed the same lines of a file do you resolve a conflict (below).

When both sides changed the same lines

If main moved on while your branch was open and you both edited the same file, Cloudrizz first tries a line-level merge: if your changes and main's are in different parts of the file, it merges them for you automatically, two branches editing opposite ends of one big file no longer collide. Only when both sides changed the same lines does merge_pull_request return a conflict (with merged: false) listing each clashing file with three versions: the common base, the current main, and your branch. Cloudrizz never auto-resolves overlapping edits with AI, you reconcile those. The loop:

  1. Read the base / main / branch contents in the conflict and write the reconciled version back to your source branch with save_version / edit_file.
  2. Call merge_pull_request again with resolvedAgainstTargetHead set to the targetHead from the conflict, that tells Cloudrizz you've reconciled against that exact state of main.
  3. If main moved again in the meantime you simply get a fresh conflict (or a 409), nothing is merged or lost; re-resolve against the new targetHead.
Want to know in advance? manage_pull_request (action: get) returns canFastForward, false means main has diverged and the branch needs a rebase before it can merge cleanly. The dashboard PR view shows the same.

Managing the PR queue

  • manage_pull_request (action: list/get/close), list open PRs, inspect one (with its canFastForward merge status), or close one without merging.
  • merge_pull_request, the real merge. Disjoint changes, and non-overlapping edits to the same file, auto-merge; only for overlapping edits (the same lines on both sides) does it hand you each file's base/main/branch versions to reconcile. Cloudrizz never AI-generates a merged result.

Coordinating parallel work

Running several assistants against one app at once? manage_branch (action: list) is the shared status board so they don't step on each other. For every branch it returns how far it is ahead of and behind main, behind > 0 means main has moved on since that branch last synced, so pull it up to date with merge_from_main before you drift further. It also lists each branch's migration files and, across all branches, the next free migration number, so two branches don't both grab the same number and clash at merge time.

Previews & cleanup

Each branch gets its own preview instance and its own playground sandbox (a separate database and storage), so parallel branches never share, or contend on, the same data. Merging a PR can tear the branch and its sandbox down for you, and manage_branch (action: delete) removes one on demand (its commits stay on main); abandoned branch previews are cleaned up automatically once the branch is merged or goes stale, and per-user main previews after a period of inactivity. Reset a sandbox anytime with reset_playground (pass a branch to target that branch's data).

Testing a login-gated preview. If your app gates pages behind a login, each successful preview deploy on the dashboard (Deployments, or the “Your staging” card) has an “Open preview (signed in)” button that opens the preview already authenticated, past the login screen, so you can click through without signing in. It works for any login, including an SSO/Entra-only app whose provider won't redirect back to a preview URL. Preview-only (never production); the link is valid ~1 hour. The AI assistant gets the same link automatically on each successful preview deploy.
Roles matter: any member can propose changes, but merging to main requires admin on the app, an org owner/admin, or a member with a per-app admin grant. See the tool reference for which tools mutate.