Objective
Allow independent workspaces and safe read-only calls to use Runtime concurrently while preserving strict ordering for conflicting effects within one workspace.
RuntimeBridge currently owns one global re-entrant lock around process selection and tool calls. This serializes unrelated workspaces and prevents the Loop Hub from realizing bounded multi-task throughput.
Required concurrency model
- One lazy Runtime MCP session per canonical workspace identity.
- Per-workspace lifecycle lock for start/reconnect/shutdown.
- Per-resource effect leases for writes.
- Concurrent reads only when advertised safe by Runtime capabilities.
- Global governor only for configured CPU/RAM/process ceilings, not for all calls.
- Fair bounded queues, deadlines, cancellation and backpressure.
Implementation steps
- Define WorkspaceSession state machine: absent, starting, ready, draining, reconnecting, failed, closed.
- Canonicalize workspace identity safely and reject symlink/path replacement attacks.
- Replace the bridge-wide call lock with a concurrent session registry plus per-session locks.
- Add bounded inflight and queue limits per workspace and globally.
- Classify tools as read, write, process or exclusive from the Runtime capability manifest.
- Route conflicting write sets through leases/fencing; permit safe non-conflicting reads.
- Implement request correlation so out-of-order MCP responses are matched correctly.
- Add cancellation at safe boundaries and deterministic timeout results.
- Reconnect with session generation IDs; never replay uncertain writes automatically.
- Drain and close sessions without orphan processes.
- Publish queue depth, wait time, inflight count, reconnects and throttling receipts.
- Benchmark one workspace serial safety and multiple workspace parallel throughput.
Failure tests
- Two simultaneous writes to the same path.
- Reads during a write.
- Independent workspaces under load.
- Runtime crash with queued and inflight calls.
- Timeout followed by late response.
- Cancellation during process execution.
- Workspace deletion/replacement.
- Queue saturation and fairness.
- Shutdown while requests are pending.
- Duplicate idempotency keys across reconnect.
Acceptance criteria
Relations
- Runtime build/resource leases: wesleysimplicio/simplicio-runtime#3035
- Runtime warm serve: wesleysimplicio/simplicio-runtime#2983
Objective
Allow independent workspaces and safe read-only calls to use Runtime concurrently while preserving strict ordering for conflicting effects within one workspace.
RuntimeBridge currently owns one global re-entrant lock around process selection and tool calls. This serializes unrelated workspaces and prevents the Loop Hub from realizing bounded multi-task throughput.
Required concurrency model
Implementation steps
Failure tests
Acceptance criteria
Relations