gateway-proxy-debug
$
npx mdskill add vercel-labs/vercel-openclaw/gateway-proxy-debugDiagnose gateway routing, WebSocket, and token handoff failures.
- Fixes broken OpenClaw UI flows and sandbox communication issues.
- Integrates with /gateway, /api/status, and admin diagnostic endpoints.
- Validates request paths, network traces, and token freshness status.
- Outputs verified-good or verified-bad markers for each failure edge.
SKILL.md
.github/skills/gateway-proxy-debugView on GitHub ↗
---
name: gateway-proxy-debug
description: "Gateway and proxy debugging for vercel-openclaw: /gateway routing, HTML injection, WebSocket rewrite, gateway-token handoff, waiting page, status heartbeat, sandbox port URL cache, and proxy auth. Use when the OpenClaw UI, WebSockets, gateway proxying, or waiting-page flow breaks."
---
# Gateway Proxy Debug
Use this skill when the wrapper can reach a sandbox but `/gateway`, HTML injection, WebSockets, or token handoff is broken.
## Evidence First
Collect:
- Browser URL and failing request path.
- `GET /api/status`.
- `GET /api/admin/sandbox-diag`.
- `GET /api/admin/logs` filtered for `proxy.`, `gateway.`, `sandbox.port_`, `token.`.
- Network trace for `/gateway/*`, WebSocket upgrade, and `POST /api/status` heartbeat.
Keep app auth, deployment protection bypass, gateway token, and AI Gateway auth separate. Do not paste gateway tokens in artifacts.
## Path Diagram
```text
browser -> wrapper auth -> /gateway route -> ensure sandbox running
-> fresh gateway token -> sandbox port URL -> OpenClaw gateway
-> HTML injection -> WebSocket rewrite -> heartbeat POST /api/status
```
Mark each edge `unknown`, `verified-good`, or `verified-bad`.
## Common Failure Splits
- Waiting page is correct because sandbox is not ready yet.
- Proxy auth failed before any sandbox request.
- Cached port URL is stale and needs invalidation.
- Gateway token is stale or not injected.
- HTML injection failed or produced a malformed script.
- WebSocket URL rewrite points at the wrong origin/path.
- Heartbeat is missing and sandbox times out.
## Fix Boundaries
- Primary: `src/app/gateway/[[...path]]/route.ts`.
- Helpers: `src/server/proxy/{proxy-route-utils,htmlInjection,waitingPage}.ts`.
- Lifecycle dependencies: `src/server/sandbox/lifecycle.ts`, `src/server/public-url.ts`.
- Tests: proxy/html injection tests plus lifecycle tests for heartbeat interactions.
- Docs: `lat.md/sandbox-lifecycle.md`, `docs/architecture.md`, `docs/deployment-protection.md`.
## Verification
Run focused tests when available, then:
```bash
node scripts/verify.mjs --steps=test,typecheck
lat check
```
For UI/WebSocket fixes, verify in a browser or with a smoke check that HTML contains the injected script and WebSocket traffic reaches the sandbox.
More from vercel-labs/vercel-openclaw
- admin-ui-debugAdmin UI and operator surface debugging for vercel-openclaw: command shell design, admin actions, request core, status panels, launch verification UI, channel readiness UI, and local read-only production-data workflows. Use when the root admin UI, controls, visual state, or operator copy is wrong.
- auth-store-debugAuth and store debugging for vercel-openclaw: admin-secret mode, Sign in with Vercel, session cookies, CSRF, LOCAL_READ_ONLY, Redis vs memory store, keyspace namespacing, and metadata shape migrations. Use when login, route authorization, Redis persistence, or metadata state is suspect.
- channel-debug-coreChannel webhook triage for vercel-openclaw Slack/Telegram/Discord/WhatsApp issues: prove deployment state, collect admin readiness endpoints, build evidence-first handoff before fixes.
- channel-forward-parityWebhook route parity audit for channel delivery changes: ensure terminal paths log, record lastForward, classify failures, and refresh stale sandbox port URLs.
- cron-watchdog-debugCron and watchdog debugging for vercel-openclaw: Vercel Cron auth, persisted OpenClaw jobs, cron wake keys, token refresh, restore oracle, hot spare, and watchdog reports. Use when scheduled OpenClaw jobs fail to wake or run, watchdog status is wrong, cron persistence is suspect, or /api/cron/watchdog behavior changes.
- discord-deliveryDiscord channel specialist workflow: debug interaction webhooks, Ed25519 signatures, deferred replies, workflow forwarding to /discord-webhook, integration reconcile, and token expiry.
- firewall-ai-gateway-debugFirewall and Vercel AI Gateway debugging for vercel-openclaw: network policy allowlists, OIDC token refresh, AI Gateway transform rules, firewall learning/enforcement, and sandbox.update networkPolicy calls. Use when model calls, egress, token refresh, or firewall policy application fails.
- lat-md>-
- launch-verify-debugLaunch verification and remote smoke debugging for vercel-openclaw: preflight, queue ping, ensureRunning, chatCompletions, wakeFromSleep, restorePrepared, channelReadiness, NDJSON progress, and vclaw create readiness. Use when launch verification, vclaw create validation, or remote smoke checks fail.
- openclaw-bootstrap-debugOpenClaw bootstrap, bundle, config, and restore-asset debugging for vercel-openclaw: openclaw.bundle sidecars, plugin discovery, channel catalog, restart scripts, config hashes, dynamic resume files, and fast restore. Use when setup, gateway boot, plugin loading, or bundle-sidecar compatibility fails.