Skip to content

fix(cli): route DevMode tunnel traffic through the front-door proxy#1369

Merged
rblalock merged 1 commit intomainfrom
fix/devmode-gravity-frontdoor-ws
Apr 11, 2026
Merged

fix(cli): route DevMode tunnel traffic through the front-door proxy#1369
rblalock merged 1 commit intomainfrom
fix/devmode-gravity-frontdoor-ws

Conversation

@rblalock
Copy link
Copy Markdown
Member

@rblalock rblalock commented Apr 10, 2026

NOTE - I'm not convinced this is the actual solution but it does unblock the issue ive been running in to of the websocket in a sandbox not being able to hit the public tunnel. so leaving this here as an example.


Summary

  • point the DevMode Gravity tunnel at the user-facing front-door proxy port instead of Vite's internal port
  • restore public /api/* websocket routing through ws-proxy to the Bun backend
  • fix sandbox driver bootstrap failures in DevMode public URLs

Root Cause

DevMode starts three listeners:

  • front-door proxy on opts.port
  • Bun backend on opts.port + 1
  • Vite on opts.port + 2

The tunnel process was started with --port vitePort, which sent public traffic directly to Vite instead of the front-door proxy.

That produced a misleading partial failure mode:

  • public HTTP /api/* still worked because Vite proxies normal HTTP requests to Bun
  • public websocket /api/* failed because backend websocket upgrades are not proxied by Vite; they are only routed correctly by ws-proxy

In practice this meant:

  • deployed environments worked
  • local direct websocket connections worked
  • public DevMode websocket connections to /api/ws opened but never received init
  • sandbox drivers timed out waiting for bootstrap and exited before connect

Fix

Start Gravity against opts.port, the user-facing front-door proxy, rather than vitePort.

Verification

  • bun test packages/cli/test/cmd/dev/ws-proxy.test.ts
  • manual live verification against Coder DevMode:
    • public raw wss://<tunnel>/api/ws returned init after the change
    • a real public sandbox session reached leadConnected: true and driverConnected: true

Summary by CodeRabbit

  • Bug Fixes
    • Corrected development server port routing to ensure proper proxy connectivity and WebSocket handling during development sessions.

@agentuity-agent
Copy link
Copy Markdown

agentuity-agent Bot commented Apr 10, 2026

The latest Agentuity deployment details.

Project Deployment Preview Updated (UTC)
docs 🟢 Ready (deploy_eb57258baefc5a25b9aede1845e358c7) - 2026-04-10T12:04:20Z

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2026

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: 85d07e70-3057-414f-afe8-f3d09b2b7250

📥 Commits

Reviewing files that changed from the base of the PR and between b8608fa and 0524dac.

📒 Files selected for processing (1)
  • packages/cli/src/cmd/dev/index.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (5)
packages/cli/src/cmd/**/index.ts

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

packages/cli/src/cmd/**/index.ts: Each command must be structured as a directory in src/cmd/ with an index.ts file as the entry point
Always define interfaces or Zod schemas for command options; never use any type for type safety
Use tui.* helpers (header, info, success, warning, error, table, progress) for formatted TUI output instead of raw console methods
Use ctx.logger for logging instead of console methods; use logger.fatal() for fatal errors which logs and exits with code 1
Always check isJSONMode() before outputting data and provide machine-readable output when in JSON mode
Use requireAuth(ctx) for commands that require authentication or optionalAuth(ctx) for commands that support optional authentication

Files:

  • packages/cli/src/cmd/dev/index.ts
packages/cli/**/*.ts

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

Use Bun.file(f).exists() instead of existsSync(f) for file existence checks

Files:

  • packages/cli/src/cmd/dev/index.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5

Files:

  • packages/cli/src/cmd/dev/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • packages/cli/src/cmd/dev/index.ts
**/index.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use named exports from package index.ts files

Files:

  • packages/cli/src/cmd/dev/index.ts
🧠 Learnings (2)
📚 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/cli/src/cmd/dev/index.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/cmd/dev/index.ts
🔇 Additional comments (1)
packages/cli/src/cmd/dev/index.ts (1)

955-958: Correct tunnel target for DevMode public WS routing.

Routing Gravity to opts.port (front-door proxy) is the right fix; it ensures public /api/* WebSocket upgrades pass through ws-proxy to Bun instead of being swallowed by Vite-only routing.


📝 Walkthrough

Walkthrough

Modified the Gravity process launch argument in the dev command to use the user-facing proxy port instead of the internal Vite server port for port specification, aligning runtime endpoint connectivity with front-door TCP proxy HTTP and WebSocket routing behavior.

Changes

Cohort / File(s) Summary
Dev Command Port Configuration
packages/cli/src/cmd/dev/index.ts
Changed Gravity process --port argument from vitePort.toString() (internal Vite server port) to opts.port.toString() (user-facing front-door proxy port) to align runtime endpoint connectivity with TCP proxy routing for HTTP and WebSocket upgrades.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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


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

@github-actions
Copy link
Copy Markdown

📦 Canary Packages Published

version: 2.0.9-0524dac

Packages
Package Version URL
@agentuity/auth 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-auth-2.0.9-0524dac.tgz
@agentuity/keyvalue 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-keyvalue-2.0.9-0524dac.tgz
@agentuity/queue 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-queue-2.0.9-0524dac.tgz
@agentuity/postgres 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-postgres-2.0.9-0524dac.tgz
@agentuity/email 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-email-2.0.9-0524dac.tgz
@agentuity/coder 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-coder-2.0.9-0524dac.tgz
@agentuity/core 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-core-2.0.9-0524dac.tgz
@agentuity/react 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-react-2.0.9-0524dac.tgz
@agentuity/workbench 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-workbench-2.0.9-0524dac.tgz
@agentuity/opencode 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-opencode-2.0.9-0524dac.tgz
@agentuity/claude-code 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-claude-code-2.0.9-0524dac.tgz
@agentuity/sandbox 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-sandbox-2.0.9-0524dac.tgz
@agentuity/db 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-db-2.0.9-0524dac.tgz
@agentuity/runtime 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-runtime-2.0.9-0524dac.tgz
@agentuity/schema 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-schema-2.0.9-0524dac.tgz
@agentuity/migrate 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-migrate-2.0.9-0524dac.tgz
@agentuity/task 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-task-2.0.9-0524dac.tgz
@agentuity/frontend 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-frontend-2.0.9-0524dac.tgz
@agentuity/cli 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-cli-2.0.9-0524dac.tgz
@agentuity/vector 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-vector-2.0.9-0524dac.tgz
@agentuity/server 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-server-2.0.9-0524dac.tgz
@agentuity/webhook 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-webhook-2.0.9-0524dac.tgz
@agentuity/coder-tui 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-coder-tui-2.0.9-0524dac.tgz
@agentuity/schedule 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-schedule-2.0.9-0524dac.tgz
@agentuity/drizzle 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-drizzle-2.0.9-0524dac.tgz
@agentuity/evals 2.0.9-0524dac https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-evals-2.0.9-0524dac.tgz
Install

Add to your package.json:

{
  "dependencies": {
    "@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-auth-2.0.9-0524dac.tgz",
    "@agentuity/keyvalue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-keyvalue-2.0.9-0524dac.tgz",
    "@agentuity/queue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-queue-2.0.9-0524dac.tgz",
    "@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-postgres-2.0.9-0524dac.tgz",
    "@agentuity/email": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-email-2.0.9-0524dac.tgz",
    "@agentuity/coder": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-coder-2.0.9-0524dac.tgz",
    "@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-core-2.0.9-0524dac.tgz",
    "@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-react-2.0.9-0524dac.tgz",
    "@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-workbench-2.0.9-0524dac.tgz",
    "@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-opencode-2.0.9-0524dac.tgz",
    "@agentuity/claude-code": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-claude-code-2.0.9-0524dac.tgz",
    "@agentuity/sandbox": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-sandbox-2.0.9-0524dac.tgz",
    "@agentuity/db": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-db-2.0.9-0524dac.tgz",
    "@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-runtime-2.0.9-0524dac.tgz",
    "@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-schema-2.0.9-0524dac.tgz",
    "@agentuity/migrate": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-migrate-2.0.9-0524dac.tgz",
    "@agentuity/task": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-task-2.0.9-0524dac.tgz",
    "@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-frontend-2.0.9-0524dac.tgz",
    "@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-cli-2.0.9-0524dac.tgz",
    "@agentuity/vector": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-vector-2.0.9-0524dac.tgz",
    "@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-server-2.0.9-0524dac.tgz",
    "@agentuity/webhook": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-webhook-2.0.9-0524dac.tgz",
    "@agentuity/coder-tui": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-coder-tui-2.0.9-0524dac.tgz",
    "@agentuity/schedule": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-schedule-2.0.9-0524dac.tgz",
    "@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-drizzle-2.0.9-0524dac.tgz",
    "@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-evals-2.0.9-0524dac.tgz"
  }
}

Or install directly:

bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-auth-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-keyvalue-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-queue-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-postgres-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-email-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-coder-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-core-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-react-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-workbench-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-opencode-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-claude-code-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-sandbox-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-db-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-runtime-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-schema-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-migrate-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-task-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-frontend-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-cli-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-vector-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-server-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-webhook-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-coder-tui-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-schedule-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-drizzle-2.0.9-0524dac.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-0524dac/agentuity-evals-2.0.9-0524dac.tgz

@rblalock rblalock marked this pull request as ready for review April 11, 2026 12:40
@rblalock rblalock requested review from Huijiro and jhaynie April 11, 2026 12:40
@rblalock rblalock merged commit 0aa50a9 into main Apr 11, 2026
18 of 19 checks passed
@rblalock rblalock deleted the fix/devmode-gravity-frontdoor-ws branch April 11, 2026 20:15
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.

2 participants