RA-live: durable business logic in production — host drives the kernel service (LIVE)

Steps 1+2 of RA-live/TA-live, live-verified end-to-end on blog.rose-ash.com.

(1) DEPLOY: docker-compose.dev-sx-host.yml gains an sx_kernel service running next/kernel/serve.sh
(the durable-execution kernel), SX_HTTP_HOST=0.0.0.0 so the host container reaches it at
http://sx_kernel:8930.

(2) HOST AS CLIENT: lib/host/ra.sx gains a KERNEL runner — host/ra--make-kernel-runner drives the
kernel over HTTP (http-request, native primitive; returns {status headers body}). It advertises
{effect,branch,each,suspend}, so select-runner routes a durable DAG to it. host/blog.sx: the DAG
registry + runner fleet are now mutable (register-dag!/add-runner!); emit! records SUSPENSIONS in a
durable pending log; /flows shows suspended instances with a resume link (?resume=<id>) driving
host/ra--kernel-resume. serve.sh wires it: set kernel-base, add the kernel runner, register the
durable 'blog-digest' DAG, declare a DURABLE behavior on article (create→publish SYNC, update→
blog-digest DURABLE), add a 'category' field.

LIVE PROOF: editing a published newsletter article → Update → routes to the kernel runner → POST
/flow/start/newsletter → kernel SUSPENDS (instance 5, shown pending on /flows) → /flows?resume=5 →
host re-drives the kernel → DONE → digest-sent effect + pending cleared. Durable suspend/resume
across separate HTTP requests, on a deployed persistent kernel. urgent edits complete immediately
(digest). http-request works in the serving context. blog 217/217, full conformance green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 19:31:33 +00:00
parent c0d9cb3cf4
commit cb0d866002
4 changed files with 149 additions and 13 deletions

View File

@@ -53,6 +53,29 @@ services:
- default
restart: unless-stopped
# The durable-execution KERNEL (next/kernel/host_kernel.erl) — a persistent next/ service holding
# flow_store across requests (RA-live substrate). The host reaches it at http://sx_kernel:8930 over
# the shared `default` network. SX_HTTP_HOST=0.0.0.0 so the bind is reachable cross-container.
sx_kernel:
image: registry.rose-ash.com:5000/sx_docs:latest
container_name: sx-dev-sx_kernel-1
entrypoint: ["bash", "/app/next/kernel/serve.sh"]
working_dir: /app
environment:
SX_PROJECT_DIR: /app
SX_SERVER: /app/bin/sx_server
KERNEL_PORT: "8930"
SX_HTTP_HOST: "0.0.0.0"
OCAMLRUNPARAM: "b"
volumes:
- ./spec:/app/spec:ro
- ./lib:/app/lib:ro
- ./next:/app/next:ro
- ./hosts/ocaml/_build/default/bin/sx_server.exe:/app/bin/sx_server:ro
networks:
- default
restart: unless-stopped
networks:
externalnet:
external: true