Expand description
Durable detached execution, independent of the scheduler and web lifetimes.
A reservation is published before spawn, and the child must take its execution lease and acknowledge that reservation before dispatch. Reconciliation cancels an unacknowledged startup under the same store lock the child needs: a late child can never execute a cancelled operation. Process IDs are diagnostic only. Metadata publication closes its staging handle before atomic replacement. Windows replacement/delete-pending handoffs use the short, bounded lock-file retry policy; failed publication never releases an uncertain reservation.
Structs§
- Generation
- An immutable, content-addressed executable.
- Job
- A durable operation record. Its payload belongs to the started generation.
- Lease
- OS-held lock. Closing it, including on a crash, releases ownership.
Enums§
- Control
- An explicit owner control; upgrades do not send these to task workers.
- Status
- Durable execution state. Starting reservations count as occupied slots.
Functions§
- active
- List live operations and unresolved startups. A missing lease only frees a startup after its deadline and an atomic cancellation fence; PID is irrelevant.
- clear_
control - Clear controls at an explicitly owned new singleton invocation boundary.
- control
- Read the latest durable owner request for a logical operation.
- current_
job - Identify this detached invocation. Helpers inherit its identity, while a newly spawned worker receives its own id before exec; no global environment mutation is required inside the asynchronous handler runtime.
- executable
- Resolve a retained executable strictly by its content identity.
- get
- Load a specific invocation, including a retained terminal result.
- helper_
executable - Resolve helper invocations to this worker’s started executable, not a newly installed binary. Outside a worker, pin the caller’s current executable.
- not_
started - Whether this spawn invocation provably did not execute its handler. This covers preparation failures and a failed OS spawn whose fresh reservation was exclusively leased and durably fenced before this error was returned. Only a fresh operation key makes this proof sufficient to restore a caller’s publication. Unknown startup, existing work, or a failed fence is never tagged.
- observe_
active - Observe execution without creating, repairing, archiving, or locking the writable store. Sandboxed diagnostics need only file reads and a read-only handle for the OS lease probe. Starting reservations remain protected until an authorized writer fences them; a missing running lease is unknown.
- pin_
current - Copy and SHA-256 address the executable. MAGI_WORKER_EXE is an explicit embedding/test override; it is never an in-process execution fallback.
- remember_
current_ executable - Remember the installed executable pathname before an updater replaces it. A web process calls this at startup so Linux’s deleted-executable marker or Windows’s backup rename cannot redirect successor workers to the old binary.
- request
- Persist a stop or park request; the operation’s handler consumes it safely.
- run
- Hidden detached entrypoint. The lease is acquired before acknowledgement and is retained through handler result persistence. Only the recorded generation can acknowledge a reservation, even if a newer CLI is accidentally invoked.
- spawn
- Reserve an exclusive operation and detach its immutable executable. Returns after acknowledgement; a timeout preserves the reservation and never kills the child or silently executes in the caller. Repeated identical requests attach to the existing reservation rather than dispatching twice.
- try_
lease - Try to own a named cross-process singleton, without PID-based stale handling. Names are hashed, so callers may use logical keys containing paths or colons.