Skip to content

feat(agent): add dev/prod deploy targets and runtime switch - #20

Merged
BrianGenisio merged 3 commits into
mainfrom
feature/agent-dev-prod-deploy
Jun 17, 2026
Merged

feat(agent): add dev/prod deploy targets and runtime switch#20
BrianGenisio merged 3 commits into
mainfrom
feature/agent-dev-prod-deploy

Conversation

@BrianGenisio

Copy link
Copy Markdown
Contributor

Summary

Prevents local agent experiments from leaking into the production Cosmo agent by separating dev and prod at two layers, while staying fully backward compatible with existing .env files.

  • Deploy layer (by slug): scripts/deploy-agent.mjs stages a copy of agents/cosmo-tutor/ and rewrites only the slug/name for the target before octavus validate + sync. The prompts and protocol.yaml remain a single source of truth, so dev (cosmo-tutor-dev) and prod (cosmo-tutor) can never drift. Prod requires explicit confirmation (interactive prompt, or --yes for CI).
  • Runtime layer (by agent ID): the server selects the agent via AGENT_TARGET (OCTAVUS_AGENT_ID_DEV / OCTAVUS_AGENT_ID_PROD).
  • New npm scripts: deploy:agent:dev, deploy:agent:prod, validate:agent; npm run dev now targets the dev agent.
  • Docs: README "Agent deployment" section + committed .env.example (placeholders only, no secrets).

Backward compatibility

  • AGENT_TARGET defaults to prod.
  • When the target-specific ID is missing, the server falls back to the legacy OCTAVUS_AGENT_ID.
  • Result: an existing .env that only defines OCTAVUS_AGENT_ID keeps talking to its production agent with no changes required.

Changes

  • scripts/deploy-agent.mjs — slug-rewrite deploy with prod confirmation guard
  • server.jsAGENT_TARGET switch with legacy fallback (default prod)
  • package.jsondeploy:agent:dev|prod, validate:agent, dev targets dev
  • .gitignore — ignore .agent-build/
  • .env.example, README.md — documentation

Test plan

  • npm test — 66/66 pass
  • Lint clean
  • npm run deploy:agent:dev syncs to cosmo-tutor-dev
  • deploy:agent:prod refuses without confirmation
  • ID resolution verified for legacy-only, new-config, and dev scenarios

Made with Cursor

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

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

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: d7937a4c-0335-41a2-b522-5ab547839a35

📥 Commits

Reviewing files that changed from the base of the PR and between 8031778 and e159111.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • server.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • server.js

📝 Walkthrough

Walkthrough

The PR introduces dev/prod agent targeting for the Octavus integration. A new scripts/deploy-agent.mjs script stages a copy of agents/cosmo-tutor into a temporary .agent-build directory, rewrites settings.json with target-specific slug and name values, then invokes octavus validate and octavus sync against the staged directory; production deployments require explicit interactive confirmation. server.js gains AGENT_TARGET-aware AGENT_ID resolution using OCTAVUS_AGENT_ID_PROD/OCTAVUS_AGENT_ID_DEV env vars with fallback to the legacy OCTAVUS_AGENT_ID. package.json scripts are updated to inject AGENT_TARGET and expose deploy/validate commands. .env.example, .gitignore, and README are updated to match.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding development/production deployment targets and a runtime agent selection mechanism.
Description check ✅ Passed The description comprehensively explains the dual-layer separation strategy, backward compatibility approach, and all changes made across multiple files.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

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

@BrianGenisio

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@package.json`:
- Around line 11-12: The start:prod and dev npm scripts use POSIX-style
environment variable syntax (AGENT_TARGET=value) which is not compatible with
Windows cmd.exe or PowerShell. Install cross-env as a dev dependency with
version ^7.0.3 in the devDependencies section of package.json, then wrap the
environment variable assignments in both the start:prod and dev scripts by
prefixing them with cross-env, so that AGENT_TARGET=prod becomes cross-env
AGENT_TARGET=prod and AGENT_TARGET=dev becomes cross-env AGENT_TARGET=dev,
ensuring the scripts work cross-platform on both Unix-like systems and Windows.

In `@server.js`:
- Around line 34-38: The AGENT_TARGET variable assignment accepts any non-'prod'
value as 'dev', which means typos or invalid values will silently fallback to
the dev configuration. Add validation after the AGENT_TARGET assignment to check
that it is either 'prod' or 'dev', and throw an error if an invalid value is
provided. This ensures that configuration mistakes are caught explicitly rather
than silently defaulting to an unintended environment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5095cb2d-0dca-414e-90e0-6324d1e85093

📥 Commits

Reviewing files that changed from the base of the PR and between 4b2921d and 8031778.

📒 Files selected for processing (6)
  • .env.example
  • .gitignore
  • README.md
  • package.json
  • scripts/deploy-agent.mjs
  • server.js

Comment thread package.json Outdated
Comment thread server.js
Brian Genisio and others added 2 commits June 17, 2026 08:53
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@BrianGenisio
BrianGenisio merged commit 9f283e7 into main Jun 17, 2026
1 check passed
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