Skip to content

Genesis managed deploy metadata passthrough and rollout_id#1597

Open
potofpie wants to merge 6 commits into
mainfrom
feat/genesis-deploy-rollout-metadata
Open

Genesis managed deploy metadata passthrough and rollout_id#1597
potofpie wants to merge 6 commits into
mainfrom
feat/genesis-deploy-rollout-metadata

Conversation

@potofpie

@potofpie potofpie commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Add --metadata / AGENTUITY_DEPLOY_METADATA passthrough for Genesis managed rollouts (source, channel, rollout_org_ids).
  • Pass optional rollout_id through CLI deploy metadata so Obs-triggered GHA runs fan out under the pre-created admin rollout instead of Ion minting a new id.
  • Surface rolloutId on deploy JSON output when app complete triggers Genesis fan-out.

Test plan

  • bun test packages/cli/test/deploy-rollout-metadata.test.ts
  • After merge + CLI publish: Obs edge deploy → verify polls admin rollout with org deployments
  • Push-to-main genesis deploy without rollout_id still works (Ion generates id)

Made with Cursor

Summary by CodeRabbit

  • New Features
    • Added support for supplying deploy rollout metadata via CLI option (and optional environment variable).
    • Deployment flow now includes additional rollout-related fields on saved deployment records (source, channel, org IDs, rollout ID).
    • Successful cloud deploy structured responses can now include an optional rollout ID.
  • Bug Fixes
    • Deploy metadata is now consistently preserved and carried into the final deployment payload, including for non-child execution paths.

potofpie and others added 5 commits June 22, 2026 14:56
Rollout intent (source, channel, rollout_org_ids) merges onto the deployment
record via --metadata or AGENTUITY_DEPLOY_METADATA; complete may return rolloutId.
Supersedes source_blob_id stdout emission approach.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep both PR metadata passthrough and main's deploy wait/timeout options.

Co-authored-by: Cursor <cursoragent@cursor.com>
Genesis GHA supplies rollout_id in AGENTUITY_DEPLOY_METADATA so Ion fan-out
and verify use the same admin rollout record instead of minting a new id.

Co-authored-by: Cursor <cursoragent@cursor.com>
@agentuity-agent

agentuity-agent Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest Agentuity deployment details.

Project Deployment Preview Updated (UTC)
docs 🟢 Ready (deploy_2a23753d9dc64cadfa962d711976cbce) - 2026-06-25T23:36:28Z

View deployment logs with the Agentuity CLI:

agentuity cloud deployment logs deploy_2a23753d9dc64cadfa962d711976cbce --project-id=proj_5ed7da797bef771d65e1bd6946a052b1

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56ecca5c-8f31-4871-879d-f79b28514777

📥 Commits

Reviewing files that changed from the base of the PR and between f2393df and 771aefd.

📒 Files selected for processing (2)
  • packages/cli/src/deploy-rollout-metadata.ts
  • packages/cli/test/deploy-rollout-metadata.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/cli/test/deploy-rollout-metadata.test.ts
  • packages/cli/src/deploy-rollout-metadata.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Agentuity - docs-docs

📝 Walkthrough

Walkthrough

The PR adds rollout metadata parsing and validation for deploy options and environment metadata, merges that metadata into deploy build payloads, forwards it through the deploy flow, and extends deploy response schemas with an optional rolloutId.

Changes

Deploy rollout metadata propagation

Layer / File(s) Summary
Rollout metadata contract and helpers
packages/cli/src/types.ts, packages/core/src/env.d.ts, packages/cli/src/deploy-rollout-metadata.ts, packages/cli/test/deploy-rollout-metadata.test.ts
DeployOptions accepts JSON metadata, AGENTUITY_DEPLOY_METADATA is typed, and the rollout-metadata schema, parser, resolver, merger, and tests define the supported rollout fields.
Deploy build metadata merge
packages/server/src/api/project/deploy.ts, packages/cli/src/cmd/cloud/deploy/build.ts
BuildMetadataSchema.deployment accepts rollout fields, and both deploy build paths merge parsed rollout metadata into the generated build.deployment object before it is sent onward.
Deploy response rolloutId
packages/server/src/api/project/deploy.ts, packages/cli/src/cmd/cloud/deploy.ts
DeploymentCompleteSchema and the CLI deploy response schema add optional rolloutId; the deploy handler forwards opts.metadata to the forked child process and returns complete?.rolloutId on success.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/genesis-deploy-rollout-metadata

Comment @coderabbitai help to get the list of available commands.

Validate known Genesis managed fields but forward extra keys to app
complete so new rollout metadata does not require another CLI release.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/cli/src/cmd/cloud/deploy.ts (1)

859-897: 🗄️ Data Integrity & Integration | 🟠 Major

Propagate rolloutId through the forked deploy path

packages/cli/src/cmd/cloud/deploy-fork.ts only persists urls and logs in deployResult, and packages/cli/src/cmd/cloud/deploy.ts only վերադարձs logs/urls from result.deployResult. That drops rolloutId from the JSON output on the fork-wrapper path.

🔧 Persist and return `rolloutId`
// packages/cli/src/cmd/cloud/deploy-fork.ts
 const resultData = {
+	rolloutId: complete?.rolloutId,
 	urls: complete?.publicUrls
 		? {
// packages/cli/src/cmd/cloud/deploy.ts
 return {
 	success: true,
 	deploymentId: initialDeployment.id,
 	projectId: project.projectId,
+	rolloutId: result.deployResult?.rolloutId,
 	logs: result.deployResult?.logs,
 	urls: result.deployResult?.urls,
 };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/cmd/cloud/deploy.ts` around lines 859 - 897, The forked
deploy result currently drops rolloutId because only urls and logs are being
written and returned; update the deploy result handling in deploy.ts (and the
matching deploy-fork.ts result shape if needed) so rolloutId is included in the
serialized result file and in the returned object from the fork-wrapper path.
Use the existing complete?.rolloutId value alongside the current urls/logs
fields so result.deployResult can preserve and surface it end-to-end.
🧹 Nitpick comments (1)
packages/cli/src/cmd/cloud/deploy/build.ts (1)

188-209: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant rollout-metadata merge in the agentuity branch.

Line 209 applies mergeDeployRolloutMetadata(build, resolveDeployRolloutMetadata(deployOptions)) unconditionally to both branches, so the merge at Lines 188-191 inside the isAgentuity branch is redundant — it re-parses deployOptions.metadata (or the env var) and re-merges identical fields. Since the merge is idempotent there's no correctness issue, but the duplicate work and divergent-looking branches are easy to misread.

♻️ Drop the branch-local merge and rely on the shared call
 				if (registeredProjectName) {
 						build.project.name = registeredProjectName;
 					}
-					build = mergeDeployRolloutMetadata(
-						build,
-						resolveDeployRolloutMetadata(deployOptions)
-					);
 				} else {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/cmd/cloud/deploy/build.ts` around lines 188 - 209, The
isAgentuity branch in build() performs a redundant merge of rollout metadata,
since mergeDeployRolloutMetadata(resolveDeployRolloutMetadata(deployOptions)) is
applied again unconditionally after the branch. Remove the branch-local merge
and keep the shared merge after the debug log so both paths use the same single
rollout-metadata merge in build.ts, reducing duplicate work and simplifying the
flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/cli/src/cmd/cloud/deploy.ts`:
- Around line 859-897: The forked deploy result currently drops rolloutId
because only urls and logs are being written and returned; update the deploy
result handling in deploy.ts (and the matching deploy-fork.ts result shape if
needed) so rolloutId is included in the serialized result file and in the
returned object from the fork-wrapper path. Use the existing complete?.rolloutId
value alongside the current urls/logs fields so result.deployResult can preserve
and surface it end-to-end.

---

Nitpick comments:
In `@packages/cli/src/cmd/cloud/deploy/build.ts`:
- Around line 188-209: The isAgentuity branch in build() performs a redundant
merge of rollout metadata, since
mergeDeployRolloutMetadata(resolveDeployRolloutMetadata(deployOptions)) is
applied again unconditionally after the branch. Remove the branch-local merge
and keep the shared merge after the debug log so both paths use the same single
rollout-metadata merge in build.ts, reducing duplicate work and simplifying the
flow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85f4a8d4-46df-44f7-99df-aff752c88799

📥 Commits

Reviewing files that changed from the base of the PR and between 421189f and f2393df.

📒 Files selected for processing (7)
  • packages/cli/src/cmd/cloud/deploy.ts
  • packages/cli/src/cmd/cloud/deploy/build.ts
  • packages/cli/src/deploy-rollout-metadata.ts
  • packages/cli/src/types.ts
  • packages/cli/test/deploy-rollout-metadata.test.ts
  • packages/core/src/env.d.ts
  • packages/server/src/api/project/deploy.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Agentuity - docs-docs
🧰 Additional context used
📓 Path-based instructions (7)
packages/core/src/**/*.ts

📄 CodeRabbit inference engine (packages/core/AGENTS.md)

packages/core/src/**/*.ts: Build TypeScript code using bun run build which compiles with tsc
Run TypeScript type checking with bun run typecheck
Ensure runtime compatibility with both Browser and Node/Bun environments - no runtime-specific code
Use ESNext as build target with TypeScript declaration files
Use TypeScript-first development - all code must be TypeScript
Prefer interfaces for public APIs
Use generics for reusable type utilities
Ensure no framework coupling - code must work in any JavaScript environment
Many exports are type or interface only - use type keyword for type-only exports
Ensure all exports are pure with no side effects or global mutations
All relative imports in TypeScript files MUST include the .ts extension for proper ESM module resolution

Files:

  • packages/core/src/env.d.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Run bun run format using Biome with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5

Files:

  • packages/core/src/env.d.ts
  • packages/cli/src/deploy-rollout-metadata.ts
  • packages/cli/src/types.ts
  • packages/cli/test/deploy-rollout-metadata.test.ts
  • packages/cli/src/cmd/cloud/deploy.ts
  • packages/server/src/api/project/deploy.ts
  • packages/cli/src/cmd/cloud/deploy/build.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript in strict mode with ESNext target and bundler moduleResolution
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/core/src/env.d.ts
  • packages/cli/src/deploy-rollout-metadata.ts
  • packages/cli/src/types.ts
  • packages/cli/test/deploy-rollout-metadata.test.ts
  • packages/cli/src/cmd/cloud/deploy.ts
  • packages/server/src/api/project/deploy.ts
  • packages/cli/src/cmd/cloud/deploy/build.ts
packages/cli/src/**/*.ts

📄 CodeRabbit inference engine (packages/cli/AGENTS.md)

packages/cli/src/**/*.ts: Use tui.* helpers for formatted output (header, info, success, warning, error, table, progress)
Use ctx.logger for logging; logger.fatal() logs and exits with code 1
Use await readFile(p, 'utf-8') and await writeFile(p, content) from node:fs/promises for file I/O
Import pathExists from node-compat/fs for file existence checks instead of using Node's built-in
Do not use Bun globals (Bun.file, Bun.spawn, Bun.color, Bun.stringWidth, etc.) in production source code; tsconfig.json type checking enforces this
Imports must use explicit .ts extensions for relative paths (e.g., from './foo.ts', not from './foo'); TypeScript's rewriteRelativeImportExtensions will rewrite them to .js in output
Always check isJSONMode() for machine-readable output in command handlers
Use requireAuth(ctx) or optionalAuth(ctx) for authenticated commands

Files:

  • packages/cli/src/deploy-rollout-metadata.ts
  • packages/cli/src/types.ts
  • packages/cli/src/cmd/cloud/deploy.ts
  • packages/cli/src/cmd/cloud/deploy/build.ts
**/packages/*/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/packages/*/test/**/*.{ts,tsx}: Place tests in test/ folder parallel to src/ directory, never inside src/ or under __tests__/
Import from ../src/ in test files
Use @agentuity/test-utils for shared mocks in tests

Files:

  • packages/cli/test/deploy-rollout-metadata.test.ts
packages/server/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/server/AGENTS.md)

All code must be TypeScript

Files:

  • packages/server/src/api/project/deploy.ts
packages/server/src/**/*.ts

📄 CodeRabbit inference engine (packages/server/AGENTS.md)

packages/server/src/**/*.ts: Use zod for runtime validation
Always use .ts extensions in relative imports (e.g., from '../api.ts', not from '../api'). This is required for Node.js ESM compatibility — tsc rewrites .ts.js in compiled output, but leaves extensionless imports untouched, which breaks Node.js module resolution. This is enforced by the useImportExtensions Biome lint rule.

Files:

  • packages/server/src/api/project/deploy.ts
🧠 Learnings (6)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.

Applied to files:

  • packages/core/src/env.d.ts
  • packages/cli/src/deploy-rollout-metadata.ts
  • packages/cli/src/types.ts
  • packages/cli/test/deploy-rollout-metadata.test.ts
  • packages/cli/src/cmd/cloud/deploy.ts
  • packages/server/src/api/project/deploy.ts
  • packages/cli/src/cmd/cloud/deploy/build.ts
📚 Learning: 2026-02-17T14:23:15.448Z
Learnt from: potofpie
Repo: agentuity/sdk PR: 974
File: packages/cli/src/cmd/git/account/list.ts:39-40
Timestamp: 2026-02-17T14:23:15.448Z
Learning: In the Agentuity CLI framework (packages/cli), when a subcommand declares requires: { auth: true }, the framework will automatically call requireAuth() before invoking the handler. Do not call requireAuth(ctx) manually inside command handlers. This applies to all TypeScript command files under packages/cli/src, including paths like packages/cli/src/cmd/git/account/list.ts.

Applied to files:

  • packages/cli/src/deploy-rollout-metadata.ts
  • packages/cli/src/types.ts
  • packages/cli/src/cmd/cloud/deploy.ts
  • packages/cli/src/cmd/cloud/deploy/build.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.

Applied to files:

  • packages/cli/test/deploy-rollout-metadata.test.ts
📚 Learning: 2026-01-13T04:32:02.691Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 565
File: packages/cli/src/cmd/cloud/region-lookup.ts:14-26
Timestamp: 2026-01-13T04:32:02.691Z
Learning: Enforce sandbox identifier prefixes in new code within the CLI cloud region lookup: new sandboxes must use the sbx_ prefix. The snbx_ prefix may appear in legacy code or examples, but do not use snbx_ for new sandboxes. When reviewing changes in packages/cli/src/cmd/cloud/, ensure any created sandbox identifiers use sbx_ and remove or migrate any snbx_ usages in newly added code.

Applied to files:

  • packages/cli/src/cmd/cloud/deploy.ts
  • packages/cli/src/cmd/cloud/deploy/build.ts
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.

Applied to files:

  • packages/server/src/api/project/deploy.ts
📚 Learning: 2025-12-30T00:13:37.849Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 355
File: packages/server/src/api/sandbox/util.ts:2-6
Timestamp: 2025-12-30T00:13:37.849Z
Learning: In the packages/server tree, treat code as runtime-agnostic between Node.js and Bun. Ensure TypeScript files (e.g., util.ts) import and use APIs in a way that works under both runtimes. It is acceptable to rely on Bun’s Node.js compatibility for built-ins accessed via the node: namespace (e.g., node:events, node:stream, node:buffer). During reviews, prefer patterns and imports that remain compatible with Bun's environment, and flag any hard dependencies on runtime-specific globals or non-portable Node APIs.

Applied to files:

  • packages/server/src/api/project/deploy.ts
🔇 Additional comments (7)
packages/cli/src/types.ts (1)

622-627: LGTM!

packages/core/src/env.d.ts (1)

178-180: LGTM!

packages/cli/src/deploy-rollout-metadata.ts (1)

3-79: LGTM!

packages/cli/test/deploy-rollout-metadata.test.ts (1)

8-46: LGTM!

packages/server/src/api/project/deploy.ts (1)

215-222: LGTM!

Also applies to: 318-321

packages/cli/src/cmd/cloud/deploy.ts (2)

171-174: LGTM!


413-413: LGTM!

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