Title: Warm-session proxies: hold CLI/language-server sessions open instead of spawning per request · Issue #480 · developing-today/code · GitHub
Open Graph Title: Warm-session proxies: hold CLI/language-server sessions open instead of spawning per request · Issue #480 · developing-today/code
X Title: Warm-session proxies: hold CLI/language-server sessions open instead of spawning per request · Issue #480 · developing-today/code
Description: Related: #479 adds bin/muse-proxy.mjs, the newest spawn-per-request proxy — this issue is its (and codex-proxy's) v2 design question. Problem: every proxy request pays a full cold start The CLI-backed proxies in bin/ (codex-proxy, and no...
Open Graph Description: Related: #479 adds bin/muse-proxy.mjs, the newest spawn-per-request proxy — this issue is its (and codex-proxy's) v2 design question. Problem: every proxy request pays a full cold start The CLI-bac...
X Description: Related: #479 adds bin/muse-proxy.mjs, the newest spawn-per-request proxy — this issue is its (and codex-proxy's) v2 design question. Problem: every proxy request pays a full cold start The CLI...
Opengraph URL: https://github.com/developing-today/code/issues/480
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Warm-session proxies: hold CLI/language-server sessions open instead of spawning per request","articleBody":"Related: #479 adds `bin/muse-proxy.mjs`, the newest spawn-per-request proxy — this issue is its (and codex-proxy's) v2 design question.\n\n## Problem: every proxy request pays a full cold start\n\nThe CLI-backed proxies in `bin/` (codex-proxy, and now muse-proxy) spawn a fresh CLI process per chat-completions request and flatten the entire message history into a single prompt. Measured on muse-proxy (2026-10-21):\n\n- ~5–8 seconds of latency floor per request before model time — process spawn + runtime boot + agent/session setup dominates; generation is the tail.\n- ~27k input tokens of CLI session context (system prompt, skills) are built and billed on **every** call, trivial prompts included.\n- No context or prompt-cache continuity: request N+1 in a conversation re-sends and re-pays everything request N established.\n\nVerified while filing: `bin/codex-proxy.mjs` contains no session handling at all — no `session`, `resume`, or `conversation` logic anywhere in the file; each request is an independent `codex exec`. muse-proxy is the same shape by design (it mirrors codex-proxy).\n\n## Existing proof of concept in this repo\n\n`bin/antigravity-ls-proxy.mjs` does **not** spawn per request: it attaches to a long-running language-server process (managed LS ports) and multiplexes requests over that warm process. That shape works in production here today. The CLI proxies are the odd ones out.\n\n## Avenues\n\n### (a) Muse — hold a warm `muse serve` host\n\nThe Muse CLI ships `muse serve` (\"Serve an MSP session host over stdio\") and `muse schema` (exports the MSP wire schema, JSON Schema or TypeScript). A v2 muse-proxy could:\n\n- Spawn `muse serve` once and keep it warm for the proxy's lifetime.\n- Open real sessions on the host per conversation, so session state, context, and any server-side caching persist across requests in that conversation.\n- Translate OpenAI chat-completions ⇄ MSP using the exported schema rather than scraping `exec --json` output.\n\nUnknowns to resolve in the spike: MSP session lifecycle (create/resume/close), concurrency model (one in-flight turn per session?), and whether prompt caching actually engages across turns on the plan allowance.\n\n### (b) Codex — key resumable exec sessions by conversation ID\n\nThe Muse's exec sessions are resumable. codex-proxy could:\n\n- Accept/derive a conversation key (client-supplied session/conversation id, falling back to a hash of the system prompt + first message) and map it to a CLI session id.\n- Resume that session for follow-up requests, sending only the new turn instead of the flattened full transcript, so prompt cache and context carry over.\n\nUnknowns: exact resume semantics of the installed CLI version, whether resumed sessions preserve cached prefixes measurably (check usage output across two turns), and session id storage/cleanup.\n\n## Trade-offs to design around\n\n- **Statefulness**: the proxy becomes a session owner. Restarts drop warm sessions; clients must tolerate a cold fallback (re-flatten and start fresh) as a normal path, not an error.\n- **Serialization**: a warm session likely handles one in-flight turn at a time → per-conversation request queues, plus a small pool of warm sessions for concurrent conversations, with sane caps.\n- **Hygiene**: a session's cwd and accumulated context bleed across requests if keying is sloppy. Conversation keys must be strict (never share a warm session across different clients/projects by accident), and idle sessions need a TTL + eviction.\n- **Observability**: keep reporting real per-run usage (the CLIs already emit it) and add warm/cold markers so the win is measurable, not assumed.\n\n## Spike acceptance criteria\n\n- [x] Warm per-request latency measured against the ~8s cold baseline on the same prompt set (report both, same machine, same models).\n- [x] Cache/context continuity demonstrated across two requests in one conversation: the second request answers a follow-up that requires the first turn's context **without** the client re-sending history, and/or usage numbers show the reused/cached input share.\n- [x] Two concurrent conversations stay isolated (no cross-talk of context) and a third waits or cold-starts per the pool policy.\n- [x] Killing the warm host/session mid-conversation degrades to a successful cold request, not a client-visible error.\n- [x] No regression in the OpenAI-compatible surface (`/v1/models`, streaming + non-streaming chat completions) for either proxy the spike touches.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-21T14:09:34Z","url":"https://github.com/developing-today/code/issues/480"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b4b15e20-84e1-4563-d96d-0f3aecec67be |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E4A:3E3AC8:853A08:AD2BEA:6B062D41 |
| html-safe-nonce | be9cc2cdd3b18d7f8ec8e079bdf95db1c4499067fc0029b4a2978980e2041816 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTRBOjNFM0FDODo4NTNBMDg6QUQyQkVBOjZCMDYyRDQxIiwidmlzaXRvcl9pZCI6IjYxNjc1MDkwMTgwNjkwNTI3MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 774758e98bc8b57dab106fd19a3079f2a5f784d81861b74be4190b6510beee74 |
| hovercard-subject-tag | issue:5962163665 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/480/issue_layout |
| twitter:image | https://opengraph.githubassets.com/287a0618855ad5e8683c541ec180469dbf357446de60fe75dcaa32b19265505d/developing-today/code/issues/480 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/287a0618855ad5e8683c541ec180469dbf357446de60fe75dcaa32b19265505d/developing-today/code/issues/480 |
| og:image:alt | Related: #479 adds bin/muse-proxy.mjs, the newest spawn-per-request proxy — this issue is its (and codex-proxy's) v2 design question. Problem: every proxy request pays a full cold start The CLI-bac... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f961de5dd5c5d4aca24d33f8b3ffb3fb8b2ef53d0a4f32f01f0a790e512f6d3 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 494ea0bb1e0feef734a83e2628697647755e8864 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width