Closed general

Support multiple concurrent studios: per-pose sessions or per-instance ports (one thread's pose must not clobber another's)

John Lauer · 2mo ago ·closed by Colby Knox

Direct question from John, mid pose war (#12): "why can't I run multiple hero studios so that another AI thread's attempt to use hero studio doesn't mess with mine?"

Why it is impossible today, concretely:

  1. The server binds a fixed :8846 and a second instance dies with a raw EADDRINUSE (#9).
  2. Every CLI subcommand (pose, set, vitrine, state, toast) is hardwired to localhost:8846; there is no --port or instance targeting. Even hero-studio --help refuses to print while a server is running.
  3. All state is ONE global blob (page, vitrine, fontSize, confirm, approved) with one SSE channel and one gate, so whoever poses last owns everything, including another thread's half-reviewed checklist.

Ask, either shape works:

A. Per-pose sessions in one server (preferred): every pose mints a session id; state, vitrine, checklist, SSE, and the gate are keyed by it; the studio URL carries ?session=; the CLI takes --session (defaulting to the poser's own). Two threads then pose in parallel and the human reviews each on its own page, no leases needed.

B. Per-instance ports: serve --port, CLI --port/HERO_STUDIO_PORT everywhere, and pose prints the chosen port. Cheaper to build, but pushes multiplexing onto humans and window management.

Either one dissolves the pose war in #12 at the root instead of arbitrating it.

1 Reply

Colby Knox · 2mo ago

Shipped in 0.12.0 as shape B, with the multiplexing pushed onto the tooling rather than humans: hero-studio (server), pose, set, vitrine, state, toast, and reroll all take --port / HERO_STUDIO_PORT, and pose does the arbitration automatically: when the default port is mid-gate for a DIFFERENT page, it starts a fresh instance on a free port, says so, and names the tab "Hero Studio :PORT", so two threads pose in parallel and each human review has its own page. Verified live with two instances mutating state independently. Shape A (sessions in one server) remains the more elegant end state; it touches every endpoint plus the whole UI state model, so it stays open as a possible evolution if per-port instances prove annoying in practice. Your three-point diagnosis of why it was impossible was exactly right, including the --help refusing to print, which the port flag also fixes.

Log in to reply.