Skip to content

Design: Gateway stability, hot config apply, and IM decoupling redesign - #1188

Draft
hazeone wants to merge 1 commit into
mainfrom
cursor/gateway-stability-redesign-7cdd
Draft

hazeone wants to merge 1 commit into
mainfrom
cursor/gateway-stability-redesign-7cdd

Conversation

@hazeone

@hazeone hazeone commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Research-backed redesign proposal for the three coupled stability problems in ClawX today:

  1. Config changes and model switches frequently force a full Gateway restart (minutes of downtime; always on Windows).
  2. IM channels run inside the Gateway process, so every restart drops all IM sessions — while the Gateway is also the process we restart most.
  3. Restarts are slow because unconditional plugin sync, config sanitation, and uv/Python warmup sit on every spawn path, followed by an ~8-minute silent readiness loop.

What's included

  • harness/reference/gateway-stability-and-hot-reload-redesign.md — full design reference:
    • Current-state analysis with exact file/function citations (scheduleGatewayRefresh, FORCE_RESTART_CHANNELS, prepareGatewayLaunchContext, waitForGatewayReady, Windows reload degradation, etc.).
    • Comparative research of NousResearch/hermes-agent (backendPool, single shared runtime), netease-youdao/LobsterAI (Cowork product/runtime split, Main-owned IM gateways), OpenAI Codex App Server (per-turn model/policy parameters, long-lived JSON-RPC server), WorkBuddy (sidecar supervisor fleet), and the closest public matches for "codecode" (Claude Code desktop multi-session daemon, Tencent CodeBuddy-style workspaces).
    • Three-phase target architecture: (1) hot config apply via a single Main-side apply planner + reload RPC for Windows parity, (2) fast/invisible restarts via manifest-hashed prelaunch, background uv warmup, staged readiness milestones, and blue/green swap, (3) IM decoupling via a separately supervised Channel Host process (WorkBuddy/LobsterAI-informed, Option B recommended).
    • Migration steps mapped to concrete files, success metrics, and risks/open questions.
  • harness/specs/tasks/gateway-hot-config-and-im-decoupling.md — spec-driven anchor for the implementation phases under the gateway-backend-communication scenario (per the repo's spec-driven harness rule).

Verification

  • pnpm harness validate --spec harness/specs/tasks/gateway-hot-config-and-im-decoupling.md (with diff, --since origin/main): valid.
  • pnpm run harness:ci: all baseline checks and harness unit tests pass (12/12).

Docs-only change; no runtime behavior is modified in this PR.

Open in Web Open in Cursor 

…tation task spec

Co-authored-by: Haze <hazeone@users.noreply.github.com>
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