rfc: persistent host processes — astrid:[email protected] (reattachable background processes)#31
Closed
joshuajbouw wants to merge 1 commit into
Closed
rfc: persistent host processes — astrid:[email protected] (reattachable background processes)#31joshuajbouw wants to merge 1 commit into
joshuajbouw wants to merge 1 commit into
Conversation
Adds an additive astrid:[email protected] with an opt-in persistent tier: spawn-persistent returns an opaque, principal-scoped process-id whose backing process lives in a host-owned registry (lifetime = the capsule, not the spawning instance) and is reattachable from any later invocation via attach(id) + id-keyed fns, status/list, read-since cursors, and event-driven watch. Motivated by the pooled-instance reattach gap (a background process dies when its spawning instance resets, so shell's spawn/read-logs/kill split-tool pattern is impossible), generalized beyond shell to MCP-stdio hosts, dev-server supervisors, and log tailers. Per-principal isolated, quota-bounded, sandbox-contained, auditable, fail-secure; @1.0.0 stays byte-frozen.
Contributor
Author
|
Closing — this belonged in the existing host-ABI RFC, not a standalone PR. Nothing has launched (everything is draft), so there is no frozen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
astrid:[email protected], an additive evolution of the host process interface introducing an opt-in persistent tier.spawn-persistentreturns an opaque, unforgeable, principal-scopedprocess-idwhose backing process lives in a host-owned registry (lifetime = the capsule, not the spawning instance) and is reattachable — read / signal / wait / write / stop — from any later invocation of the same(capsule, principal), including a different pooled instance. The frozen@1.0.0ephemeral surface is re-exposed unchanged and composes viaattach(id) -> process-handle.Why
Under the dynamic instance pool, a
spawn-backgroundchild is a wasmtime resource owned by the spawning instance, so it is reaped when that instance resets — before any later, separate tool call could read its logs or kill it. The shell capsule'sspawn_background_process/read_process_logs/kill_processsplit-tool pattern is therefore impossible (it only works today via a carve-out that pins the capsule to one never-reset instance, forfeiting the pool).bash &doesn't help — Linux bwrap reaps orphans on namespace teardown; macOS would leak an untracked process. The fix is a host-owned, id-addressable, principal-scoped registry.Per the design mandate this is built as a general primitive, not just shell's three tools — it also serves MCP-stdio subprocess hosts, dev-server / build-watch supervisors, and log tailers (
read-sincecursors, non-drainingstatus/list-processes, event-drivenwatch).How it was designed
Grounded in the real host code (
ManagedProcessin the instance-owned resource table,ProcessTracker, the bwrap/seatbeltSandboxCommand::wrappath, the frozen-ABI discipline), then run through a multi-perspective design pass (identity/reattach, observability, lifecycle/limits, streams/interactivity, security/isolation, SDK/migration, prior-art) and an adversarial review. Review-found fixes are folded in:persist-unsupportedunless the operator opts in.spawn-persistentrefuses the capsule-owner fallback principal (else tenants share adefaultnamespace).stop(graceful) vsattach(id)?.kill()(immediate) split; bindgen type-identityFrom-mappings.Key open questions (in the RFC)
watchpublish authority — does host-publishedastrid.process.v1.*need a manifest[publish], or is it a kernel-authored topic class? Ties to the topic-grammar work (#809). Fallback: dropwatch, pollstatus+ boundedwait.allow_persistentsub-grant;@1.0.0concurrent-counter relocation.Full WIT + reference semantics + security model + host-impl sketch + drawbacks/alternatives/prior-art are in
text/0000-persistent-host-processes.md. Draft (unnumbered) per the RFC process.