From One Request to a Durable Building Session
The Pro workbench changes the unit of work in OpenMAIC. A classic generation request can return after it has produced a classroom; a durable building session must remain coherent while a worker claims it, a model calls tools, a user sends follow-up instructions, and a process may restart. This chapter traces that lifecycle so the reader can judge what persistence enables, why leases and event history are user-facing features, and which database and model-routing conditions the workbench requires.
A session outlives the browser request
A request-scoped generator is usually organized around a caller waiting for a result. The caller submits requirements, the application performs model work, and the response returns a classroom or an error. If the connection disappears at the wrong moment, the request may be lost or left ambiguous. That is an acceptable shape for a one-shot operation only when the result can be retried without confusing a new attempt with the old one.
The Pro workbench treats course building as a durable session. A session is created in a server-backed store, placed in a queued state, and then claimed by a background worker. The worker's process is not the session's identity. The database holds the authority for who owns the current lease, which attempt is running, which events have been written, and whether cancellation or follow-up work is waiting. The browser can disconnect while the worker continues, and the worker can stop while the session remains available for recovery.
The lease is a time-limited claim, not a permanent ownership transfer. A worker claims a session with an attempt identity and sends heartbeats while it is running. If the worker disappears, another worker can eventually claim the work according to the store's rules. The attempt number helps distinguish a new run from stale writes produced by an earlier one. A late event from a worker that no longer owns the lease must not become the current truth merely because it arrived after a restart.
This is why leases and heartbeats belong in the product explanation. They decide whether a user sees a session resume, fail, or remain queued. They also protect the course document from competing workers.