Fouria
On this page
2026.10.29
Features
- fouria: expose gateway RSS and add a dev-gated memory watchdog (#526) (441fdae)
- fouria,moltlazy: reconcile declared software on demand and report its real state (#525) (5476899)
- fouria: renew durable snapshot leases (#512) (5a38cd5)
- fouria-dispatch,fouria: scale fleet fan-out and make catalog writes conflict-safe (#510) (c4ef484)
- fouria: checkpoint durable tenant jobs and harden the backup step budget (#509) (2114c1f)
- lerma,fouria: price semantic billing actions with trace precedence (#507) (85f8701)
Bug fixes
- lerma: make dispatch deploys idempotent around migrated DO classes (#516) (#520) (d3c2f60)
- fouria: stop the idle-sleep snapshot loop and reconcile dev heartbeats (#518) (9b324bc)
- fouria: make backup catalog reads pure and healing explicit (#511) (7470376)
- fouria: keep environment repair available while the gateway is down (#506) (1321226)
- fouria: defer repairs until the restored gateway is up (#505) (579532b)
Chores
2026.10.21
Features
- website: add FourIA Terms of Service page (#499) (892282c)
- observability: ingest Cloudflare OTLP destinations + uptime stats (#337) (#478) (1a4630b)
- fouria,lerma: backup before container deprovisioning (#456) (54ef3f6)
- fouria: Telegram webhook ingress with cold-start message queue (#364) (#449) (b95acd8)
- fouria,moltlazy: declarative software provisioning for agent skills (#459) (a7b623b)
- fouria: dev→production agent push (promotion) + local two-worker E2E (#453) (3dc5863)
Bug fixes
- fouria: defer request-scoped restores and stop only on inactivity (#503) (7171192)
- observability: decompress gzip OTLP destination batches (#337) (#484) (7bd792b)
- gateway: soft reload targets the server and keeps OPENCLAW_NO_RESPAWN (#463) (#477) (a883054)
- fouria: durable maintenance jobs over WebSocket, release promotion, homepage crash (#468) (90680ba)
- fouria: run SQLite integrity + doctor repair as durable jobs (#467) (f841ac4)
- fouria,moltlazy: mitigate dev sandbox memory OOM (#462) (132355e)
Tests
- expand auth backup and billing coverage (#471) (43a8b18)
- e2e: drop cctr-incompatible ‘#’ corpus headers and add a guard (cc95f96)
Chores
- observability: enable production destination export (#337) (#486) (98078dc)
- release: adopt Changesets for semver versions and changelogs (#483) (67a91ed)
- openclaw: migrate to 2026.10.5 (#476) (9991907)
- deps: bump the bun-all group across 1 directory with 56 updates (#474) (471ddad)
- fouria: pin cctr to the 0xCAB0/cctr fork (0.31.0-paso4.1) (9b5ea28)
- fouria: enable software provisioning on staging via MOLTLAZY_FEATURE_FLAGS (#464) (dd3c417)
Other changes
- Feature/dev instances can emit billable (#502) (d8bc76d)
- Feature/enhance fouria builder (#501) (95a1107)
- Feature/migrate dev to vite plugin (#475) (a8cad6f)
- Fixed healtz quick endpoint (7e76734)
- Moved components snapshot from Healthcheck endpoints (b2d9679)
Historical changes (imported from apps/fouria/AGENTS.md)
These entries predate the generated release sections above. They were maintained
by hand in apps/fouria/AGENTS.md and are kept here verbatim for traceability.
New entries belong in a changeset (see docs/VERSIONING.md); the sections above
are generated by scripts/release.mjs.
- Adversarial/fuzz pass on the Sandbox v1 critical pipelines closed six defects. A second attack run against zero data loss, secrets, memory and boot found: (1)
v1CreateSnapshotcould race an operator restore (it only checked container liveness; the worker’s maintenance window covers route-driven calls but not the primitive) — it now returnsskipped: 'restoring', so a half-swapped directory can never become the recovery point. (2)startGatewayOwnerre-checks#restoringbefore the launch and inside the readiness loop, so a boot that overlaps a restore aborts retryably instead of launching over the swap or reporting readiness for a gateway the restore is about to kill. (3)v1ProcessOutputdecoded whatever a process wrote after the SDK had buffered it in the DO isolate — reads are now truncated atMAX_PROCESS_OUTPUT_BYTES(1 MiB per stream) withtruncated: true. (4) Astart-openclaw.sh startwrapper that exits 0 (lost startup lock) with no gateway process anywhere waited the wholetimeoutMs(up to 5 min); afterSANDBOX_V1_ZERO_EXIT_GRACE_MS(default 15s,0disables) the DO proves the absence of an owner (pgrep -fon the setup wrapper or the gateway) and fails fast, while a booting lock winner resets the grace and is adopted. (5) A failed conversion left the streamed squashfs and the partial extraction in/tmp(~2× the archive on a 4–12 GB disk), so retries could ENOSPC the container: failures now clean up best-effort and rethrow the original error. (6) The durablemigration:convert-statusand its log storederror.messageverbatim;redactSecrets(known env values ≥ 8 chars, longest-first) scrubs both before they are written. Tests:src/sandbox-v1-adversarial.test.ts(restore/snapshot overlap, restore retry + in-progress refusal, 12-snapshot → 24-restore → boot round-trip fuzz, R2 secret scan, redacted conversion failure, output cap, zero-exit fast-fail / live-peer adoption),src/sandbox-migration/conversion.test.ts(scratch cleanup, cleanup failure never masks the original error),src/logging.test.ts(redactSecrets, 60 fuzz-embedded credentials,envSecretValues); fuzz harnessbun run --cwd apps/fouria test:fuzz:sandbox-v1 -- 4000(all invariants held); corpustest/business-rules/operational-modes.txt; docsdocs/plans/sandbox-v1-adversarial-fuzz.md,docs/ENV-VARIABLES.md. - Sandbox v1 presents gateway traffic as direct-remote when the Gateway refuses proxy attribution (
proxy_attribution_required). Every dev instance deployed on the v1 runtime served{"error":{"type":"proxy_attribution_required"}}on the root HTML/WS proxy (and the admin-RPC reads fell back to the CLI): OpenClaw attributes proxy-shaped traffic (anyForwarded/X-Forwarded-*/X-Real-IP) againstgateway.trustedProxiesbefore Gateway auth and rejects a source it cannot trust, and moltlazy’s heal can only list the ranges the legacy runtime reaches the container from (the Cloudflare Sandbox bridge,10.1.0.x). The v1 transport forwards throughctx.container.getTcpPort(port)from theSandboxV1Durable Object, whose ingress address is owned by the platform — not an address any tenant config can know (and blindly unioning more private ranges is unsafe: a range that swallows theX-Forwarded-Forwalk makes attribution worse). A direct-remote request, by contrast, is always attributed and is served with the same token/device auth, soSandboxV1.fetch()now probes attribution once per gateway incarnation (GET /with the rebuilt forwarded headers — exactly the Gateway-authenticated route that fails) and, when the Gateway refuses it, strips every proxy-shaped header before forwarding. The verdict is cached for the DO lifetime and re-probed afterv1KillGateway/v1Destroy/startGatewayOwner, so a healedgateway.trustedProxiesrestores client-IP (rate-limit/audit attribution) fidelity without a Worker deploy; requests with no forwarded headers skip the probe, and a probe that cannot reach a booting Gateway leaves the modeunknown(traffic keeps its headers) and is retried.src/gateway/proxy-attribution.tsowns the header set and the payload classifier (403 +type/message) so the proxy, the admin-RPC path and the transport cannot drift. Structured event:sandbox.v1.proxy_attribution.direct(warn). Tests:src/gateway/proxy-attribution.test.ts,src/sandbox-v1.test.ts(gateway proxy attribution: direct fallback, cached verdict, accepted attribution keeps headers, failed probe never degrades traffic, no probe without forwarded headers, re-probe after destroy); corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md§ “Sandbox v1 gateway proxy attribution”,packages/moltlazy/AGENTS.md. - Sandbox v1 waking/sleep policy and automation wake are lifecycle-correct (audit follow-up). Four gaps between the legacy policy and SDK 1.0’s
durable_objectlifecycle are closed. (1) Production keep-alive is real:resolveInactivityPolicy()now returns the 6h maximum +keepAlive: truefor billable production instead ofnull— with no timeout the platform stops the container shortly after the DO goes inactive, so the old “never sleeps” contract was the opposite of what it claimed. A keep-alive purpose (sandbox-v1:keepalive-pending) shares the DO alarm slot, re-applies the timeout and re-arms attimeout/2; the cadence and a queued conversion keep their own markers, and clearing one purpose never deletes another’s alarm. (2) Wake keeps the provisioned size:startContainer()readsCONTAINER_INSTANCE_TYPE(allowlist, fallbackstandard-1); lerma deploys it from the instance type. (3) No empty recovery point:v1CreateSnapshotskips a stopped container ({ state: 'skipped', reason: 'not-running' }) instead of callingensureRunning()and archiving an empty/home/openclaw;/controlfreeze/backup/checkpoint,/debug/*and the scheduler’s snapshot job report the skip. (4) Reliable automation wake: the occurrence guard (wokenFor) survives mirror writes and resets only when the next run advances; a woken occurrence that does not advance backs off 5m→30m instead of re-waking every 60s, and a failed wake/read keeps the schedule with a bounded retry instead of deleting it. The durable boot job mirrors the schedule right afterlaunchRestoredState(no dashboard poll needed); on v1 the wake enqueues that boot job (deduped) and returns{ ready: false }instead of blocking the alarm turn on a restore + launch, so no CLI read runs against a booting container (legacy keeps the fastwaitForReady:falsepath). Activity re-arms go through the shared combined alarm, and the alarm’s memory watch is gated onisRuntimeActive()so a diagnostic never starts a stopped v1 instance. The task buffer and Telegram ingress queue resolveresolveRuntimeIntent()before acquiring a sandbox (they defaulted to legacy on a converted tenant). Operators get a non-wakingGET /debug/lifecycle(policy +keepAliveArmedAt/snapshotCadenceArmedAt/stableRecordId) andPOST /api/admin/activity/refresh(mirror the CLI schedule deterministically). The live drillapps/fouria/test/e2e-v1/03_passive_health_and_wake.txt(bun run --cwd apps/fouria test:e2e:v1:live, skip unlessE2E_V1_LIVE=1) covers idle stop → automation wake, freeze/backup on the sleeping tenant, and billable keep-alive on a temporary billable binding. Tests:src/sandbox-v1.test.ts(keep-alive, instance type, stopped-snapshot skip, lifecycle),src/activity/{alarm,scheduler}.test.ts(occurrence guard/backoff, no give-up, boot mirror, durable v1 wake, non-waking memory watch),src/index.test.ts(freeze/backup skip on a stopped v1 tenant),src/routes/api/activity.test.ts,src/tasks/index.test.ts(v1 wake),src/telegram-ingress/queue.test.ts(explicit runtime); lermatenant_provisioner_pipeline_test.exs; docsWORKER-DEVELOPMENT.md,ENV-VARIABLES.md,sandbox-v1-scaffold.md,TESTING.md,test/e2e-v1/README.md. - A tenant can be provisioned directly on the Sandbox v1 runtime (“born v1”), with no conversion. Until now the only path to v1 was
migrate, so a brand-new instance always started legacy. A fresh tenant is now identified by a durable marker written by Lerma at provisioning (sandbox-migration/<canonical-slug>/runtime.jsoninBACKUP_BUCKET:{ version: 1, tenant, runtime: "v1", mode: "fresh", provisionedAt }, create-only before the script deploy; the Worker only reads it).src/sandbox-migration/runtime-marker.tsowns the contract:runtimeMarkerKey, a strict validator (version 1,runtime: v1,mode: fresh, a tenant matching the scope it was read from, an ISO 8601 timestamp with an explicit zone), tri-statereadRuntimeMarker(bucket, scope)via the sharedreadJsonObject, andreadFreshRuntime(env)for the routes (no bucket ⇒absent, unresolved identity ⇒unknown).resolveRuntimeIntentresolvesabsentintent +presentmarker →v1;unknownmarker →unknown;absentmarker withSANDBOX_RUNTIME=v1→pending(fail closed: the instance asked for v1 but was never provisioned for it, so it must never boot the legacy container and create legacy state); otherwiselegacy. The conversion intent still wins over a marker (the C8 record+pointer barrier decides when a converted tenant serves)./controlmigrateon a fresh tenant answers409 MIGRATION_ALREADY_V1(“there is nothing to convert”) without addressing the DO or enqueuing (an unreadable marker →503 SANDBOX_V1_RUNTIME_UNKNOWN, since converting a tenant that may already be v1 is destructive), andmigration-statusanswers200 { state: 'absent', mode: 'fresh' }without touching the DO (a converted tenant reportsmode: 'converted').restoreTenantStateIfNeeded()returnsfalsefor a pointer-less, record-less container so the tenant onboards in the v1 container withOPENCLAW_RESTOREDunset, and the first recovery point is taken right after that first successful boot:v1EnsureGatewaydispatchesrunInitialSnapshot()detached (ctx.waitUntil, never awaited, so readiness is not delayed), only whenverifyRecoveryPointispointer-absentandconversion.jsonis absent — a converted tenant, a tenant that already snapshotted (cadence/backup/checkpoint-park), an unreadable/inconsistent pointer and a parked tenant are left alone, and a stopped container is never woken. A single-flight promise folds concurrent boots (owner run + adopted-gateway path) into one attempt, a settled flag keeps the adopting boot path at one R2 read per incarnation, andtakeOwnedSnapshot()gives the cadence and this attempt one shared owner so they cannot snapshot the directory concurrently (the loser skips; the cadence keeps its alarm). Failures are caught and logged assandbox.v1.initial_snapshot_failedwith the boot stillready, and retried on a later boot (a new DO incarnation immediately, the same one afterINITIAL_SNAPSHOT_RETRY_MS= 10 min); success logssandbox.v1.initial_snapshot. The committedDirectoryBackup+stable.jsonpointer becomes the recovery point for park/restore/boot (retention applies; the cadence stays the backstop for the few seconds between readiness and the archive committing). Policy is unchanged: the matrix returnslegacyoutsideWORKER_PLATFORM === "staging", and the reservedclientslug is never provisioned with a marker (the Worker treats a marker as authoritative for serving). Tests:src/sandbox-migration/runtime-marker.test.ts,src/sandbox-migration/intent-gate.test.ts(full matrix),src/index.test.ts(fresh serving,409,absent+fresh, pending without a marker, unreadable marker),src/sandbox-v1.test.ts(fresh onboarding withoutOPENCLAW_RESTORED; first recovery point committed after the boot, once under concurrent boots, a failed attempt tolerated + retried on a later boot, and skipped for a converted tenant with a complete pointer or a parked tenant); corpustest/business-rules/sandbox-v1-cutover.txt; docsdocs/WORKER-DEVELOPMENT.md§ “Provisioning an instance directly on Sandbox v1”,docs/ENV-VARIABLES.md. - The ROOT debug tools work on Sandbox v1.
/debug/*(DEBUG_ROUTES=true, ROOT) runs against whatever client the request acquired, so on a converted tenant every route that touched the container was audited againstV1SandboxClientand fixed where the legacy call has no v1 equivalent. A sharedreadFinishedProcessLogs()tries the legacylogs()stream and falls back tooutput()(the v1 handle has no replayable log stream), so/processes?logs=trueand/logs?id=report a finished process’s stdout instead ofFailed to retrieve logs; the gateway log routes tail/tmp/gateway-stdout.logand now returnpath+runtime./restart-openclawgained a v1 branch (maintenance window →killGateway→resetStartupCache/clearPersistenceCache/resetV1GatewayStart, no legacy checkpoint and norestore-needed— a v1 restart destroys nothing);/reprovisioncheckpoints withv1CreateSnapshotand treats a restorable copy as the C8verifyRecoveryPoint(notbackups/<id>/meta.json), returningrecordId;/backup/:modesnapshots through the DO and never boots a gateway on v1;/destroy-containeralso clears the startup cache and the isolate start dedupe;/envreportssandbox_runtime_actual. One refusal:/debug/sleepanswers503 { code: 'SANDBOX_V1_SLEEP_UNSUPPORTED' }because v1 has no stop primitive (the tenant sleeps on the platform inactivity timer) — a202would claim work that never happens. One caveat:/rescue-containerdiagnoses/destroys, but v1containerFetchnever wakes a stopped container, so a sleeping tenant reads as unreachable. Process ids are per DO incarnation (empty list after an eviction → use/debug/gateway-logs). Tests:routes/debug.test.ts(Sandbox v1 (converted tenant) debug routes, 15 cases with a__fouriaSandboxV1-branded double) plus the dashboard card test; corpustest/business-rules/sandbox-v1-serving.txt; compatibility matrix indocs/WORKER-DEVELOPMENT.md§ “Debug tools on Sandbox v1 (ROOT diagnostics)”, QA drill indocs/plans/sandbox-v1-migration-report.md§ 10. - Sandbox v1 idle snapshot cadence (PER-2). A converted tenant’s container is owned by
SandboxV1, and rawctx.containerhas no eviction hook (the legacyonActivityExpired→ archive → stop path does not exist on SDK 1.0), so the platform’s inactivity stop silently dropped everything written since the last committed record. The DO now runs its own cadence:startContainer()arms a durable purpose marker (snapshot:cadence-pending) plusctx.storage.setAlarm(never postponing an earlier alarm, so a queued conversion keeps its slot),alarm()runsrunConversionAlarm()thenrunSnapshotCadence(), andv1Destroy()clears both (unless a conversion is queued).resolveSnapshotIntervalMs(env, inactivityTimeoutMs)resolvesSANDBOX_V1_SNAPSHOT_INTERVAL_MS(ms,0disables) → else the configuredBACKUP_INTERVAL_MINUTES→ else 1h, capped at half the inactivity timeout (staging 7.5m, dev 1h), so it never fires after the container would have slept. The turn never wakes a stopped container, skips while#restoring, skips when the recovery point (stable.json) is newer than the interval (deduping with theActivityScheduler’s interval-gated v1 snapshot), then callsv1CreateSnapshot({ trigger: 'backup' })and re-arms; failures logsandbox.v1.snapshot.cadence_failed/cadence_arm_failedand never throw.selectRecordsToPrunenow breaks a same-millisecondcreatedAttie by record id, so retention is deterministic for back-to-back snapshots. Tests:src/sandbox-v1.test.ts(arm, disable, fire + re-arm, dedupe, never-wake, destroy),src/sandbox-migration/records.test.ts(tie-break); corpustest/business-rules/sandbox-v1-persistence.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 idle snapshot cadence),docs/ENV-VARIABLES.md. - Sandbox v1 restore by record id (PER-2).
POST /api/admin/storage/restore/:idon a converted tenant no longer falls into the legacy.sqshpath: the route opens the durable maintenance window (restore) first (the v1ensureGatewaybranch honors it, so a request cannot restart the gateway under the swap), thenSandboxV1.v1RestoreRecordstops the single gateway owner, restores the catalogued record’s directory intoHOME_DIR(SDK atomic swap), and by default advances the stable pointer so a cold boot restores the chosen record (?setCurrent=0applies without promoting). An unknown/unreadable record fails closed (404) without touching the container, a restore already in progress is refused by an in-DO flag, and the Worker then boots the restored state and reportsgatewayReady(a boot failure never undoes the restore). v1 restores are synchronous — there is no legacy job queue for the record format. Tests:src/sandbox-v1.test.ts(restore + promote, no-promote, unknown record),src/routes/api/storage.test.ts(v1 branch, 404, maintenance window),src/gateway/process.test.ts(maintenance guard); corpustest/business-rules/sandbox-v1-persistence.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 restore by record id). - Sandbox v1 outbound virtual hosts (OCM-1 / BIL-1). A converted tenant could not reach the Worker-owned virtual hosts:
TenantSandbox.outboundByHostis a static on the legacySandboxclass, and SDK 1.0 has no such statics, soSandboxV1’s container had no intercept forotel.internal(OTLP export / AI cost attribution), the*.r2.internalbridges (leads/docs/software) orcdp.internal(Browser Rendering via the container’s local CDP proxy). The host map now lives insrc/sandbox-outbound.ts(SANDBOX_OUTBOUND_ROUTES), used by both runtimes: the legacy class installs it as itsoutboundByHoststatics, andSandboxV1.startContainer()registers every host withctx.container.interceptOutboundHttp(host, ctx.exports.SandboxOutboundGateway({ props: { host } })). Intercepts belong to the container instance, so they are re-registered on every start (including a restarted DO that finds the container running); a bundle without the export warns and keeps direct egress instead of failing the boot. Each intercepted request is dispatched by host to the existing bridge handler; an unknown host answers a structured404rather than throwing (an escaping exception surfaces in the container asECONNRESET). Tests:src/sandbox-outbound.test.ts,src/sandbox-v1.test.ts(one intercept per host, re-registered on restart, missing export warns); corpustest/business-rules/sandbox-v1-serving.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 outbound virtual hosts). - Sandbox v1 rollout park (SEC-3). A converted tenant can be parked for a container replacement.
/controlcheckpoint-parkon v1 drains live sessions toread-only(over the v1 gateway WS bridge, recording the previous modes durably), commits the recovery point withv1CreateSnapshotfail-closed (502 SANDBOX_V1_PARK_SNAPSHOT_FAILED, so no rollout starts without a restorable copy), and only then opens the durable park (maintenance/replacement.json{ parked: true }) and arms the exec lock; a stopped container is already parked (skipped: 'not-running'). The existing guards block writes (tenantParkGuard→409 TENANT_PARKED,/controlrefuses every action exceptresume/checkpoint-park,assertTenantExecAllowed), reads stay available.resumeclears the park, unlocks exec, boots through the v1 DO and applies the recorded session modes after a real/healthprobe (or reportssessionModes: "pending"); resuming an unparked tenant never wakes it.killGatewaystays process-scoped on v1. Tests:src/index.test.ts(park → 409 + durable record, resume, unparked no-op); corpustest/business-rules/sandbox-v1-cutover.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 rollout park). - Sandbox v1 boot, owner and repair (OCM-2). The durable lanes that run outside a request now resolve the tenant’s runtime themselves.
ActivityScheduler.sandbox()is async and callsresolveRuntimeIntentbeforeacquireSandbox(..., runtime); apending/unknowntenant is skipped (activity.sandbox.skipped) instead of being acted on. Previously the scheduler always acquired the legacy client, so after a conversion an alarm-driven wake or a scheduled snapshot would have booted the old container, archived the legacy filesystem and advanced the legacystable-backup.json— silent divergence from the v1 recovery point. Asnapshotbackup job on a converted tenant now callsSandboxV1.createSnapshot({ trigger: 'backup' })(DirectoryBackup + catalog + pointer + retention) instead of the legacy stage/archive/finalize pipeline; v1restore/deprovisionjobs reportskippedwith an explicit reason. The DO’sstartGatewayOwnermirrors the legacy boot guards: it races the supervised launch’s exit against the/healthpoll (a non-zero exit before the port opens fails in seconds; a zero exit is ignored as the lost-race path), tails/tmp/gateway-stdout.log, and queues the durabledoctor-repair(gateway-launch-state-database) with a retryable error when the log matches a SQLite corruption signature. Tests:src/activity/scheduler.test.ts(v1 acquisition, v1 scheduled snapshot),src/sandbox-v1.test.ts(early exit fails fast, corrupt DB queues the repair); corpustest/business-rules/sandbox-v1-cutover.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 boot, owner and repair). - Sandbox v1 snapshots and the recovery point (PER-2). A converted tenant now has a v1 persistence path of its own.
src/sandbox-migration/records.tsis the catalog:records/<id>.jsonper committedDirectoryBackupentry plus the sharedstable.jsonpointer, withverifyRecoveryPointas the single C8 read (pointer→record:pointer-absent,record-absent,record-unknown,pointer-record-mismatch, orcomplete).SandboxV1.v1CreateSnapshot()writes the record throughbackupDirectory(post-encrypted in place with F4E1, failing closed onBACKUP_ENCRYPTION_REQUIRED), catalogs it immediately, advances the pointer, and prunes oldest-first beyondBACKUP_MAX_VERSIONS(default 3) while protecting the record just taken; a failed snapshot never stops the container./controlbackup/checkpointon a v1 tenant are served by the DO (SANDBOX_V1_SNAPSHOT_FAILEDon error) and never enter the legacy.sqshorchestration; other control actions still answer503 SANDBOX_V1_CONTROL_UNSUPPORTED. Cold boot restores what the pointer names (falling back toconversion.jsonfor pre-catalog records) and refuses a conversion record without a pointer instead of onboarding over converted state. Tests:src/sandbox-migration/records.test.ts,src/sandbox-v1.test.ts(snapshot + prune, pointer restore, pointerless refusal),src/index.test.ts(/controlv1 snapshot); corpustest/business-rules/sandbox-v1-persistence.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 snapshots and the recovery point). - Sandbox v1 conversion orchestration (S5 / PER-3).
/controlwithX-FourIA-Control: migratestarts the legacy → v1 conversion, and the Dispatch Worker forwardsmigrate(CONTROL_ACTIONS). The entry is queue-only: it callsv1RequestConversion()on theSandboxV1DO and answers immediately — the conversion streams the legacy squashfs, extracts it in the v1 container and uploads aDirectoryBackup, which is minutes of work that no Worker request can survive. The contract is202 { state: 'queued' | 'running' },200 { state: 'committed', recordId },502 { state: 'failed', error, code: 'SANDBOX_V1_CONVERSION_FAILED' }for a durably recorded failure, and503 SANDBOX_V1_UNAVAILABLEwhen the binding is missing or the DO is unreachable (nothing recorded → safe to retry); the staging/reserved-slug gate (403/409) still runs in middleware before any DO access and the route logssandbox.v1.conversion.requested. The conversion runs on the DOalarm(): conversion first, cadence second, each wrapped so one cannot starve the other, and the gateway is launched afterwards withOPENCLAW_RESTORED=true. The job is durable (migration:convert-requestmarker +migration:convert-status, with a 1-basedattempt) and idempotent (committed via DO state or the R2 record, queued/running in flight, new work only from absent/failed);alarm()ordersrunning→committedbefore dropping the marker and before the launch, so a launch failure never retracts the commit, and a failure recordsfailedwith a bounded message instead of throwing. A lost alarm self-heals:v1ConversionState()/v1RequestConversion()/v1Status()/v1EnsureGateway()callensureConversionArmed(), which re-arms only a non-terminal job and never wakes the container;armConversionAlarm()never postpones an earlier pending alarm (the cadence shares the slot, so conversion arming wins);#conversionRunis the single owner so overlapping alarm turns cannot start a second destructive conversion.migrateis an idempotent enqueue (it starts work fromabsent/failed), so polling reuses a separate read-only action,migration-status(X-FourIA-Control: migration-status; dispatchCONTROL_ACTIONS+ echo ofstate/recordId, no snapshot CPU budget, no tenant-cache invalidation): it calls onlyv1ConversionState()— neverv1RequestConversion()— so it cannot enqueue, start work or wake the container, and answers200 { state: absent | queued | running | committed | failed, recordId?, error? }(absentfor a legacy tenant without addressing a v1 DO;503 SANDBOX_V1_UNAVAILABLEwhen the binding is missing or the read fails), never202. There is no synchronous conversion entry point —v1ConvertNowwas removed from the DO, the RPC surface andV1SandboxClient. Tests:src/sandbox-v1.test.ts(queue/arm, alarm commit, cadence-after-conversion, failed recording, new attempt from failed, overlapping alarms, re-arm after a DO restart, no re-queue),src/index.test.ts(202 queued/running, 200 committed, 502 failed, 503 unreachable/binding, no inline conversion, converted-tenant migrate),src/sandbox-v1-client.test.ts(no inline method),workers/fouria-dispatch/test/unit/control.test.ts(status forwarding + echo); corpustest/business-rules/sandbox-v1-cutover.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 conversion orchestration),docs/plans/sandbox-v1-migration-report.md(drill 12),docs/plans/sandbox-v1-scaffold.md. - Sandbox v1 serving parity (S3 / OCM-1). A converted tenant is now served by
SandboxV1instead of failing closed.src/sandbox-v1-client.tsaddsV1SandboxClient(aSandbox-shaped client over theSandboxV1DO) with HTTP/WS transport (stub.fetch→ctx.container.getTcpPort(port).fetch, never waking a stopped container;503 SANDBOX_V1_SLEEPING),isRuntimeActive/status, a process RPC shim (exec/getProcess/listProcesses+output/waitForExit/kill),killGatewayanddestroy; unsupported legacy operations throwSandboxV1UnsupportedOperationErrorwithSANDBOX_V1_UNSUPPORTED_OPERATION.acquireSandbox(env, id, options, runtime)selects legacy/v1 from the durable intent and fails closed onunknown;index.tsacquires the v1 client for a converted tenant and returns503 SANDBOX_V1_CONTROL_UNSUPPORTEDfor/controlactions until S4.ensureGatewaydelegates to the DO (v1EnsureGateway), which adopts a healthy gateway, restores the committed v1DirectoryBackupinto an empty container (OPENCLAW_RESTORED=true), and runsstart-openclaw.sh startas the single owner;killGatewaydelegates tov1KillGateway.getHealthSnapshothas v1 parity (non-wakingsleeping, real/healthreadiness, 503-until-ready). Tests:src/sandbox-v1-client.test.ts,src/sandbox-v1.test.ts,src/gateway/health-probes.test.ts,src/gateway/process.test.ts,src/sandbox-contract.test.ts,src/index.test.ts; corpustest/business-rules/sandbox-v1-serving.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Sandbox v1 serving),docs/plans/sandbox-v1-scaffold.md. - Sandbox v1 conversion (S2). The v1 DO now owns the legacy→v1 data migration and the conversion barrier.
src/sandbox-migration/state.tsis a tri-state reader (absent/present/unknown; only explicit absent permits legacy),intent.tswrites the per-tenant write-ahead intent, andlease.tsis a per-tenant R2 lease (create-only acquire, etag-CAS takeover, owner-scoped renew/release, fail-closed parse, TTL is liveness only).SandboxV1.convertToV1()acquires the lease, writes/validates the intent, opens the legacy recovery point (stable-backup.json, F4E1-decryptingdata.sqsh.enc), streams the squashfs into the v1 container, extracts it withunsquashfs -f -d /home/openclaw, takes a v1DirectoryBackup, writessandbox-migration/<tenant>/conversion.json+stable.json, and verifies the pointer/record barrier (C8). The Worker refuses legacy routing/serving with503 SANDBOX_V1_RUNTIME_PENDINGandensureGatewaythrowsSandboxV1RuntimePendingErroronce the intent is present/unreadable (C5).Dockerfile.v1installssquashfs-tools; the v1 serving path/readiness is S3 and durable job orchestration is S5. Tests:src/sandbox-migration/{state,intent,lease,conversion,intent-gate}.test.ts,src/index.test.ts,src/gateway/process.test.ts; corpustest/business-rules/sandbox-v1-persistence.txt; docsdocs/plans/sandbox-v1-scaffold.md,docs/WORKER-DEVELOPMENT.md. - Sandbox v1 release tooling and deploy surface restored. The
v1-sandboxtrack now carries the P5b release tooling (scripts/release-manifest.mjs,release-registry-digest.mjs,validate-runtime-image-pins.mjs+ tests),Dockerfile.v1copiessandbox-shimfromcloudflare/sandbox:1.0.3(matchingcatalog.@cloudflare/sandbox), andwrangler.jsoncrestores theSandboxV1durable_objectcontainer application (fouria-sandbox-v1local/production,fouria-sandbox-v1-stagingstaging) plus theSandboxV1DO binding in all three environments.bun scripts/validate-runtime-image-pins.mjspasses (3 v1 apps, 3 legacy apps). This is a deliberate reversal of audit finding F9 for the migration track only: the v1 image must be buildable/publishable for the staging lane, but no route selectsSandboxV1and no tenant is converted. Tests:scripts/*.test.ts; docsdocs/plans/sandbox-v1-scaffold.md. - Sandbox v1 migration gate (S1). The cutover now has its authority and identity gate.
src/sandbox-migration/platform.tsexposes the singlecanMigrate(env)predicate (true only for the trustedWORKER_PLATFORM === "staging"binding) andmigrationRefusal(env), which resolves the canonical tenant withtenantSlugFromEnvand refusesnull/defaultand the reservedclientslug. The/controlentry runs the gate in a middleware before the sandbox stub is acquired, so a refusedX-FourIA-Control: migrateperforms no R2 write and no DO/container addressing (403 MIGRATION_PLATFORM_FORBIDDEN,409 MIGRATION_SLUG_UNRESOLVED,409 MIGRATION_RESERVED_CLIENT); an allowed staging request stops at501 MIGRATION_NOT_IMPLEMENTEDuntil S2 addsconvertToV1. The gate is migrate-only, so freeze/unfreeze/backup/checkpoint/resume keep their behavior on every platform and onclient.sanitizeCustomerSlugnow rejects thedefaultsentinel in every resolver branch (C10), and Lerma provisionsWORKER_PLATFORM(fromcf_environment) plusSANDBOX_V1_CUTOVER=false. Tests:src/sandbox-migration/platform.test.ts,src/sandbox-tenant.test.ts,src/index.test.ts(sandbox v1 migration gate), corpustest/business-rules/sandbox-v1-cutover.txt, Lermatenant_provisioner_pipeline_test.exs; docsdocs/ENV-VARIABLES.md,docs/WORKER-DEVELOPMENT.md,docs/OPERATOR-GUIDE.md(§2.6). - Local containers no longer look like a platform bug, and the memory watchdog never races a boot. A local restore failed with
Container failed to startwhiledocker psshowed only a…-proxysidecar churning every ~20 s; the app container was never created. That isnet.ipv4.conf.all.src_valid_mark=1(which Tailscale sets) making workerd’s egress sidecar drop its own marked handshake (cloudflare/workerd#6860), not a FourIA defect. The dev server now warns before it builds images —src/dev-container-preflight.ts(puredescribeContainerNetnsProblem+readContainerNetnsSettings, unit-tested) reads the two relevant sysctls and prints the fix (preferred:net.core.devconf_inherit_init_net = 2, which keeps Tailscale working; one-session alternative:src_valid_mark=0) plus the stale-sidecar cleanup;FOURIA_SKIP_CONTAINER_PREFLIGHT=1silences it for CI hosts. The same investigation exposed a real race: the durable memory watch sampled/procwithsandbox.exec— which auto-starts a stopped container — while a restore was probing it, producinggateway.memory-read failed (launch-failed)and a workerdjsgInternalErrorthat abortedcontainer.start().checkGatewayMemoryHealth()now takes the bounded non-wakingisRuntimeActive()read first and returns{ action: 'skipped', reason: 'runtime-inactive' }when the runtime is off, andActivityScheduler.runMemoryWatch()returns before sampling while a boot/backup/maintenance job is active (queued/running/retrying), so observability never participates in a boot. The persistence lease acquire is now bounded too: a conditionalbackup-lockwrite that never settles is reported aspersistence.lock.write-timeoutand treated as a lost acquire, instead of holding the durable step (6 min of silence, thenjob-step.interrupted) — observed locally when taking over an expired lease. Tests:src/dev-container-preflight.test.ts,src/gateway/memory.test.ts,src/activity/scheduler.test.ts,src/persistence.test.ts; corpustest/business-rules/operational-modes.txt; docsdocs/DEVELOPMENT.md§ “Local containers never start”,docs/TESTING.md§ “E2E Tests (Local)”,apps/fouria/docs/WORKER-DEVELOPMENT.md§ memory watchdog. - The loading page’s terminal shows the formatted durable job status instead of an empty
/tmp/startup.log./tmp/startup.logdoes not exist during the durable boot job’s restore phase (nostart-openclaw.shprocess yet) and can stay quiet while the gateway binds its port, so the terminal sat blank next toStill working on "Starting OpenClaw Gateway" (188s)— exactly when an operator wanted to know what the platform was doing.src/activity/job-status-log.ts(pure, unit-tested) formats the state the Worker already reads intojobLoglines: theActivitySchedulerboot job (Boot running — launching the gateway (step 2/2, attempt 1/3), 4m in this step), the restore-progress record (Restore — Decrypting the backup (32%), with the existing idle/terminal annotations), and an active repair (Repair running — openclaw doctor --fix, attempt 1/3), including a retry wait and a truncated failure reason./api/startup/wspushesjobLogon every frame and the non-passive not-yet-ready/api/health//api/health-snapshotcarries it (plusboot/repair) for the HTTP polling fallback.loading.htmlrenders the container log when it has content and otherwise the job log, labels the terminal source (/tmp/startup.logvsboot job status), and keeps the terminal visible during the whole restore phase — the brand logo now only appears when there is nothing at all to show. Tests:src/activity/job-status-log.test.ts,src/assets/loading.test.ts,src/routes/public.test.ts; docsapps/fouria/docs/WORKER-DEVELOPMENT.md§ Startup Progress. - The agent browser reaches Cloudflare Browser Rendering through a private
cdp.internalbridge, with no Cloudflare Access bypass. The tenant/cdproute is behind the host Access application (302), so it is no longer the agent transport. The container runscdp-proxy.mjs(127.0.0.1:9223), a WS↔HTTP proxy that serves CDP discovery and forwards commands to the Worker’scdp.internalhandler (TenantSandbox.outboundByHost). The handler calls the tenant’s Sandbox Durable Object (cdpCommand/cdpClose), which launches the browser fromenv.BROWSERand keeps the session across OpenClaw’s per-action WebSockets (serialized command queue).src/cdp-session.tsreuses the/cdphandleCDPMethod, so the transports cannot drift; the Browser Rendering credential never enters the container. Moltlazy writes a fill-only remote-CDP profile (browser.profiles.cloudflare.cdpUrl=http://127.0.0.1:9223,defaultProfile=cloudflare) and addstools.alsoAllow: ["browser"](thecodingprofile excludes it); restored boots re-apply--only gateway,browser. Tests:src/cdp-session.test.ts,src/sandbox-cdp-bridge.test.ts,src/index.test.ts(host registration/health),packages/moltlazy/tests/config/browser.test.ts,tests/config/tools.test.ts, E2Etest/e2e/r_browser_remote_profile.txt(registration,open, cross-calltabs). Docs:apps/fouria/docs/WORKER-DEVELOPMENT.md§ Browser Rendering,apps/fouria/docs/OPERATOR-GUIDE.md§8.2,docs/TESTING.md,packages/moltlazy/AGENTS.md. Known limit: Playwright-backedsnapshot/evaluatestill need CDP session multiplexing; rawopen/tabs/navigation/screenshots work. - A wedged container is no longer read as an empty one, and memory pressure is observed from the durable alarm.
tenant-tarjetero-devlost ~7 h 45 m of work on 2026-11-03: the Sandbox DO could not open a control session to a starved container (ContainerControlConnection.fetchUpgradeAttempt→AbortError),containerHasState()swallowed every probe error and returnedfalse, and the recovery path therefore started a destructive 450 MB restore over a live filesystem. It timed out at 180 s, wroterestore-target.json { outcome: 'unknown' }, and every later boot was refused withRestoreInFlightError (restore-outcome-unknown)for 11 min at a time. Two defects fixed and one policy added (design: docs/plans/graceful-shutdown-and-emergency-checkpoints.md). (1) Absent ≠ unknown:probeContainerState()returnspresent | absent | unknown;restoreIfNeededrestores only onabsentand throws the retryableContainerStateUnknownErroronunknown, without writing therestore-neededlatch (a runtime with noexists()probe keeps the historical “assume empty” reading). (2) Continuous observation:checkGatewayMemoryHealth()is the single sampler for/api/health*and theActivityScheduleralarm (runMemoryWatch()), so memory is sampled even when no browser polls health — the reasongateway-resourceshad no rows for ~17 h through the incident. Every fresh sample also writesgateway-memory-sample(state: running|absent, container limit) so a gap means “nobody sampled”, andhealthWsHandlernow passes itsexecutionCtx(the detached watchdog promise was previously cancelled with the frame). (3) Two-stage policy:decideMemoryAction()checkpoints at 60 % of the cgroup limit and restarts at 75 %, escalating tocheckpoint-and-restartwhen the newest archive is older thanGATEWAY_MEMORY_LOSS_BUDGET_MS(15 min); the alarm enqueues the checkpoint as atrigger: 'memory-pressure'snapshot job before restarting, andmaybeRestartGatewayForMemorydelegates to the same policy so thresholds cannot drift. Tests:src/persistence.test.ts(probeContainerStatepresent/absent/unknown/malformed, restore refused with no latch),src/gateway/memory.test.ts(decideMemoryActionladder,resolveMemoryCheckpointBytes),src/metrics.test.ts(trackGatewayMemorySample); corpustest/business-rules/operational-modes.txt; docsdocs/plans/graceful-shutdown-and-emergency-checkpoints.md. - Platform docs are versioned per channel, and instances read the one that matches them.
webs/fouria-docsnow publisheslatest(built from the newestv*release tag;/latest/, aliased by the root) andstaging(built fromdevelop;/staging/). Each build runs with its ownbase_urland a channel-awaresync-docs.ts(--channel/--base-path), so pages, assets, and/llms/**mirrors never cross channels;versions.jsonrecords the channel, commit, and component versions. A newrelease-notes/section is compiled from each component’sCHANGELOG.md, making the notes factually compatible with the channel.build-deploy-tree.tsassembles both channels from their own checkouts (the release tag for latest, develop for staging) and the production deploy carries both, so/stagingnever lags.buildEnvVarsforwardsFOURIA_DOCS_CHANNEL/FOURIA_DOCS_BASE_URL/FOURIA_DOCS_FALLBACK_URL/FOURIA_VERSION(src/docs-channel.ts), and thefouria-docsskill + dev personas confirm the build viaversions.jsonbefore quoting release notes. Tests:src/docs-channel.test.ts,src/gateway/env.test.ts,webs/fouria-docs/scripts/channel.test.ts; docswebs/fouria-docs/README.md,docs/ENV-VARIABLES.md,docs/VERSIONING.md,docs/TESTING.md,apps/fouria/docs/WORKER-DEVELOPMENT.md. - OTLP ingest and promotion are private transports — neither has a public route. A staging capability run could not emit OTLP (
302to the Access login) or push a release, and the first attempt at a fix (path-scoped Accessbypassapps + aPROMOTION_PUSH_TOKEN+ a DispatchisMachinePathexemption) still left two internet-facing endpoints gated only by a bearer. Replaced with the two transports the runtime already uses. (1) OTLP → sandbox bridge: the container exports tohttp://otel.internal/v1/{traces,metrics}, resolved byTenantSandbox.outboundByHostinside the Worker (src/sandbox-otel-bridge.ts), so the traffic never leaves the sandbox ↔ Worker control plane;/api/otelis no longer mounted, the ingest logic moved tosrc/otel-ingest.ts(framework-free, constant-time secret compare, no query-string token), andbuildEnvVarsalways points the exporter at the bridge.OTEL_SHARED_SECRETis kept as the bridge’s inner credential. (2) Promotion → R2: the dev instance stages the sanitized bundle in its own bucket (promotion/staged/<id>.tar.gz+promotion/pending.json), and the production instance reads it through a read-onlyPROMOTION_SOURCE_BUCKETbinding to its sibling dev bucket (services/promotion/r2-source.ts). Both buckets stay separate; there is noimportroute, no push token, no cross-host fetch. Production applies the pending release on boot, after the restore barrier and before the launch, or onPOST /api/admin/releases/apply; the apply runs under the shared persistence lease (withPersistenceLease), is skipped while the tenant is parked or while a maintenance window/restore is in flight, and is idempotent (the container release pointer, which is part of the snapshot, is the applied marker — a restore cannot silently roll it back). Lerma provisions the sibling binding (promotion_source_bindings/2inInstancesandTenantProvisioner) only forenvironment: "production"and ensures the dev bucket exists before binding it. Removed:PROMOTION_PUSH_TOKENeverywhere,AccessPolicy.ensure_machine_access/1and its path apps, the DispatchisMachinePathexemption,/api/oteland/api/admin/releases/import. Tests:src/sandbox-otel-bridge.test.ts+test/otel-e2e.test.ts(bridge routing/auth/tenant scoping/limits),test/otel-e2ereworked for the virtual host,src/services/promotion/r2-source.test.ts(stage, pending validation, target gating, idempotency, park/busy/skip reasons, applied pointer),src/routes/api/releases.test.ts(stage 202, dev-only 409, apply+checkpoint, status availability),src/gateway/env.test.ts,src/index.test.ts(bridge registered, 401 without secret),tenant_provisioner_pipeline_test.exs(PROMOTION_SOURCE_BUCKETbinding); corpustenant-isolation.txt,operational-modes.txt; docsENV-VARIABLES.md,OPERATOR-GUIDE.md(§5.4f),WORKER-DEVELOPMENT.md,TESTING.md,apps/lerma/README.md,secrets-manifest.schema.json. - A recovery point whose TTL lapsed is healed on the restore path, and a terminal boot failure is no longer presented as a retry.
staging-client-devsat onRestore attempt failed during "Restoring the backup" — retrying — no progress for 10 min: not a slow restore, but three ~250 ms failures followed by silence. The SDK refuses an archive pastcreatedAt + meta.json.ttl(BackupExpiredError) before touching the container, and all three catalogued archives carried the old 7-day TTL (expired 2026-10-29) — the 10-yearSNAPSHOT_ARCHIVE_TTL_SECONDS+extendArchiveTtlrepair from #523 only runs as therepairstep of a snapshot job, which a tenant that cannot boot never gets (chicken-and-egg).ensureArchiveRestorable(src/persistence.ts) now widensmeta.json.ttlright afterrestore-target.jsonis published, in bothrestoreIfNeededandrestoreBackupById, and the SDK’s expiry wording (Backup <id> has expired (…), the code lives on the error object, not the message) is classified byisUnrecoverableArchiveErrorso a rewrite that cannot take effect drops the dead entry instead of looping. The page-side wedge is fixed too:readRecoveryStatestops reporting arestore-target.jsonwithoutcome: "failed"asrestoring, theActivitySchedulerrecordsdescribeRestoreTerminalFailurewhen the boot job (or a manual restore job) exhausts its attempts — labelRestore failed — <reason>,terminal: true, no idle annotation, cleared by the nextboot.start— andloading.htmlgives afailedboot precedence over the leftover progress bar and renders the reason (Boot failed after N attempts: <reason>. Refresh the page to retry.). Operator lever (R2-only, works with the gateway down):POST /api/admin/storage/reconcile— note the-X POST;GETfalls through to the gateway proxy and answers503 Gateway not ready. Tests:src/persistence.test.ts(ensureArchiveRestorablebefore the SDK call, already-widened untouched, expiry classified;readRecoveryStatefailed/unknown),src/activity/restore-progress.test.ts,src/activity/scheduler.test.ts(terminal label, cleared on a new boot),src/assets/loading.test.ts; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md(§4.4, §5.4e). - A gateway launch blocked by a corrupt OpenClaw state database now queues a
doctor --fixrepair and relaunches, instead of looping on “Starting OpenClaw Gateway”. A restored tenant can come back with a damagedstate/openclaw.sqlite: OpenClaw’s schema preflight fails withdatabase disk image is malformed(readSqliteUserVersion→inspectStateDatabaseSchema) and the gateway exits within seconds, so relaunching can never help. Two fixes. (1) The crash is detected immediately: the readiness wait now races a third signal,watchGatewayEarlyExit— the atomic cold startexecs the gateway, so a non-zero exit of the supervised process before the port opens is a terminal launch failure (previously each attempt waited out the fullSTARTUP_TIMEOUT_MS, the ~5-minute stale step and 311s page counter). A zero exit stays ignored (the “lost the startup-lock race to a healthy owner” path is decided by the existing port/lock adoption check), andwaitForExitplumbing errors (a DO code update resets the control session) park the watcher instead of failing a healthy boot. (2) The documented repair is queued:src/gateway/state-db.tsclassifies the launch diagnostics (database disk image is malformed,file is not a database,SQLITE_CORRUPT, …) andensureGatewayenqueues the durabledoctor-repairjob withreason: 'gateway-launch-state-database', then throws the retryableGatewayStateDatabaseRepairError. That reason makes the job (a) skip the post-restore gateway gate inpreflight(awaitRestoredGatewayBeforeRepair({ requireGateway: false })— waiting for a gateway the corruption blocks is a permanent deferral; the active-restore / maintenance-window checks stay) and (b) re-queue the durable boot when the repair succeeds, since the failed launch would otherwise never be retried; re-requests fold into the active job (MAINTENANCE_JOB_BUSY) and theACTIVITY-less (local dev) path reportsno-schedulerinstead of throwing. The loading page follows it:/api/startup/wspushesrepair(ActivityScheduler.getActiveMaintenanceJob, a cheap read) and the page renders “Repairing the OpenClaw state database (openclaw doctor –fix, attempt N)…” and suppresses the slow-step notice, instead of the container’s stale launch step. Structured events:gateway.launch.state-database-repair(outcomequeued/busy/no-scheduler/failed+signature) andsandbox.process.failedwithfailureReason: 'state-database-corrupt' | 'gateway-exited'. Tests:src/gateway/state-db.test.ts,src/gateway/process.test.ts(corrupt launch queues the repair, early non-zero exit is a fast failure, a transport-dropped exit watch does not fail a healthy boot),src/activity/maintenance-jobs.test.ts(reason persists, active-job read),src/activity/scheduler.test.ts(no gateway gate for the reason, boot re-queued after success, ordinary repair unchanged),src/routes/public.test.ts(repair pushed/omitted),src/assets/loading.test.ts; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md(§5.4f). - A restored container no longer re-runs the setup body when the launch happens in a different isolate than the restore. Instances recovered from a recovery point (rollout/reprovision, idle-sleep wake) were launching
start-openclaw.sh startwith the full setup body — re-onboarding and re-installing the plugins over a snapshot that is supposed to be authoritative. The zero-data-loss signal was keyed on the in-memory restore status (getRestoreStatus()→hadBackup && restored), which only exists in the isolate that ran the restore. The launch frequently runs elsewhere: the durable boot job is two steps (restore, thenlaunchin a later alarm, so a DO eviction loses_restoreState), any request that wins the startup lock during the restore→launch window launches from its own isolate (whererestoreIfNeededonly runs the cheap request-scoped check and records nothing), andclearPersistenceCache()(freeze / resume / stale recovery) resets it. NewhasRestoredTenantState(sandbox)(src/persistence.ts) combines the in-memory result with the durable container-state probe (containerHasState— the restoredopenclaw.json, legacy/rootor v1/homelayout); the image ships no config, so “state present” is exactly “already initialized/restored”.ensureGatewaynow setsOPENCLAW_RESTORED=truefrom that decision, and a brand-new tenant (no state, no backup) still gets the full setup body. Tests:src/persistence.test.ts(hasRestoredTenantState: in-memory fast path, container-state fallback, brand-new container, probe failure),src/gateway/process.test.ts(launch env); corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - Zero-loss container rollouts: the tenant is parked before an image rollout and resumed after the replacement (
checkpoint-park/resume). A container replacement always starts from a fresh disk, so it restores the checkpoint taken just before the rollout — anything written after that archive was produced was lost. The Worker now offers a park variant of the verified checkpoint:POST /control { X-FourIA-Control: checkpoint-park }takes the same snapshot but leaves the tenant drained and write-blocked, andX-FourIA-Control: resumereleases it. Enforcement is two-layered (src/tenant-park.ts):tenantParkGuardmiddleware refuses mutating (POST/PUT/PATCH/DELETE)/api/admin/*and/debug/*requests with409 { code: "TENANT_PARKED" }(reads stay available; the durable record is the cross-isolate source of truth), andstartShellcallsassertTenantExecAllowedbefore the launch RPC so background/spawned work that never passes a route cannot start a process either. The park’s own path (quiesce/snapshot/restore) runs insidewithTenantExecBypass, the only way past the lock.maintenance/replacement.jsongainedparked: true(beginMaintenance(..., { parked: true }),isTenantParked); an incomplete park un-arms the lock, closes the window and restores service exactly like a failed plain checkpoint, and the 15-minute TTL stays the crash backstop.resumedeliberately does not passskipRestore(the replacement container is empty and must rehydrate), clears the stale in-memory restore barrier (clearPersistenceCache, asfreezedoes), and is a no-op that never wakes a sleeping tenant. Other control actions (backup/freeze/unfreeze) are refused while parked. The Dispatch Worker allows/forwards both actions (CONTROL_ACTIONS/isControlAction), keeps the raised inline-snapshot CPU budget forcheckpoint-park, and whitelists theparked/resumedecho fields. Lerma’s@upgrade_pipelinenow parks at:checkpoint(fail-closed: an unavailable checkpoint aborts before the container is replaced; a sleeping instance is exempt), resumes at a new:resumestep immediately after:dispatch_deploy, and resumes best-effort on both error paths. The bundle-only pathInstances.upgrade_instance/3(used by the staging validation promotion API) follows the same contract: parked checkpoint first, a failed or non-parked (parked: false) response aborts before the script upload, the park is released after the rollout settles and on every error path, and a sleeping instance skips the park entirely (no resume is sent). Live sessions are switched to read-only first and given a turn to finish: before the quiesce,drainLiveSessions(src/gateway/session-drain.ts, oneoperator.read+operator.writeGateway WS) readssessions.list, patches every session topermissionMode: 'read-only'(exec denied, managed mutation tools omitted), and polls until the running turns end (bounded bySESSION_DRAIN_TIMEOUT_MS, 120 s — an outliving turn is reported assessionsDrained: falseand the park proceeds, so a slow turn never blocks a release; every write it made is already in the snapshot). Sessions already read-only are skipped and new sessions are untouched (the mode is per existing session, never a default). Because the mode lives on the session row it is inside the snapshot, so the previous modes are recorded outside the container (maintenance/session-modes.json,recordPendingSessionModes) and restored once a gateway is serving —resumewaitsSESSION_MODE_RESTORE_WAIT_MSand applies them, andlaunchRestoredState(post-restore.ts) applies them after any restore (the map is cleared only when every session was restored, so it retries on the next boot). An aborted park also restores them immediately. Telegram users are told by the ingress, not the model: while parked,POST /telegram-webhook/:accountsendsTELEGRAM_PARKED_NOTIFY_MESSAGEdirectly via the Bot API (notifyTenantParked), records aparkedingress event and returns200without enqueuing or waking; the queue consumer answers an already-queued update the same way and acks instead of retrying for the whole rollout. Tests:src/tenant-park.test.ts,src/maintenance.test.ts,src/gateway/sandbox-exec.test.ts,src/gateway/session-drain.test.ts,src/gateway/session-mode-restore.test.ts,src/telegram-ingress/{notify,status,route,queue}.test.ts,src/index.test.ts,workers/fouria-dispatch/test/unit/control.test.ts,apps/lerma/test/lerma/cloudflare/containers_test.exs,tenant_provisioner_pipeline_test.exs; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md(§ Rollout park),apps/fouria/docs/OPERATOR-GUIDE.md(§2.5),apps/lerma/README.md. Not covered (separate work): the post-rollout readiness gate and fleet cohort/abort policy. - The dev memory watchdog is instance-aware, and new tenants default to a viable instance.
GATEWAY_RSS_RESTART_BYTESwas a hardcoded 3 GiB (justified as “3 of 4 GiB”); on a resizedstandard-3(8 GiB) that is only 37% of the limit, so the watchdog would restart a healthy gateway. The threshold is nowresolveMemoryRestartBytes()— 75% of the container’s cgroup memory limit (memory.max, with a cgroup v1 fallback), read in the same/procexec as the RSS sample: 3 GiB on a 4 GiBstandard-1, 4.5 GiB onstandard-2, 6 GiB onstandard-3, 9 GiB onstandard-4. Because the limit is re-read on every sample, an instance-type rollout updates the threshold without a Worker deploy. Instances below 3 GiB are skipped (instance-too-small) —basic(1 GiB) cannot hold a healthy gateway (~1.1 GiB steady state), so a restart there can only loop; the gate sits under the 4 GiBstandard-1class so a cgroup that reports slightly less than nominal still gets a watchdog.Lerma.Instances.InstanceTypes.default/1, theInstanceschema default, andContainers.deploy_script_and_container/1’s fallback now default tostandard-1instead ofbasic(1 GiB), which OOM-looped any instance provisioned without an explicit type. Resizing is a Cloudflare rollout (change_instance_type/2→full_autowithtarget_configuration) that replaces the container, so plan one cold start + R2 restore per tenant.OPENCLAW_NO_RESPAWN=1is kept (inert on every instance size); a real process-level replacement would needOPENCLAW_SUPERVISOR_MODE=external+ a supervisor that preserves the single-owner startup lock. Tests:src/gateway/memory.test.ts,src/routes/public.test.ts,apps/lerma/test/lerma/instances/instance_types_test.exs,apps/lerma/test/lerma/instances_test.exs; docsdocs/plans/sandbox-memory-usage.md,apps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md,apps/lerma/README.md. - Phase 1 captures a Tier 1 workspace snapshot on eviction (flag-gated).
TenantSandbox.onActivityExpired()now takes a platform filesystem snapshot immediately before eviction whenWORKSPACE_SNAPSHOT=trueand commits the handle atworkspace/snapshot.json(versioned, image-pinned, one head handle). Capture never throws:captured/unsupported/failed/skippedbecome aworkspace-snapshotAnalytics Engine row, and the archive-then-stop path runs unchanged — Phase 1 never boots from the handle. Runtime prerequisite: Cloudflare only supports snapshots on a container application withscheduling_policy: "durable_object"; the tenant container is still on thedefaultpolicy (the legacy SDK callscontainer.start()without an image), so the API is unavailable there and every attempt reportsunsupported.SandboxV1(alreadydurable_object) implements the samesnapshotWorkspace(), so the capability is real where the runtime allows it; the flag stays off until the tenant app is migrated. Tests:src/workspace-snapshot.test.ts,src/sandbox-do.test.ts,src/sandbox-v1.test.ts,src/metrics.test.ts; corpustest/business-rules/cost-tracking.txt; docsdocs/plans/persistent-workspace-phase1.md,apps/fouria/docs/WORKER-DEVELOPMENT.md§“Workspace snapshots on eviction”. - Persistence policy is measured before it is reworked (Phase 0). The backup-policy rework (two tiers: native container snapshots as the routine save path, the F4E1 archive as the recovery and portability tier) starts with telemetry and no behaviour change. Three Analytics Engine events now describe the current system:
persistence-snapshot(end-to-end vssandbox.createBackup()duration, captured bytes read once from the archive’smeta.json,trigger, and a skip/failure reason —interval-not-elapsed,unchanged,not-running,backup-lock-busy),persistence-restore(duration, bytes,recovery-pointvsexplicit, andarchive-unusablerecorded as a skip rather than a generic failure), andbackup-change-window(continuous dirty time fromdirtySinceplus scan time, with the watch decision).SnapshotPhaseContext.triggerlabels every snapshot;SnapshotArchive.sizeBytesis the one added metadata read. No snapshot, restore, retention, or eviction decision reads these rows. Queries and the Phase 1 gates:docs/plans/persistent-workspace-phase0.md. Tests:src/metrics.test.ts,src/persistence.test.ts,src/activity/scheduler.test.ts,src/backup-watch/watch.test.ts; corpustest/business-rules/cost-tracking.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md§“Persistence policy telemetry (Phase 0)”. - OpenClaw migrated to 2026.10.9 (
catalog.openclaw+ the@openclaw/gateway-client/@openclaw/gateway-protocolpins in the rootpackage.json; the plugin repo tracks and publishes the same release). 2026.10.9 is a security patch release (vulnerable dependency remediations, credential handling, workspace-only restrictions for Gateway-built delegation and media tools, malformed MCP address rejection) with no config-schema changes — the moltlazyopenclaw config validatecctr contract passes unchanged, so nopackages/moltlazysource change was needed. The Node engine floor stays>=24.22.1 <25 || >=26.12.1, soapps/fouria/Dockerfilekeeps Node v24.22.1. The same PR hardens the sandbox memory limits in moltlazy:agents.defaults.compactionnow usesmaxActiveTranscriptBytes: '8mb'(from 20mb),keepRecentTokens: 12000(from 20000), andmidTurnPrecheck.enabled: true;session.maintenancenow enforcesmaxDiskBytes: '512mb'/highWaterBytes: '384mb',maxEntries: 500,pruneAfter: '14d',resetArchiveRetention: '14d', andcoldStorage: { enabled: true, afterDays: 7 }(OpenClaw’s 10 GB / 5000-entry / 30-day defaults do not fit a 4–12 GB container). Research findings: OpenClaw exposes no knob for the worker-thread pool or the RSS threshold, andbasic(1 GiB) is below the gateway’s ~1.1 GiB steady-state RSS, sostandard-1is the practical instance floor and a hard restart remains the only RSS reset (seedocs/plans/sandbox-memory-usage.md). No component CalVer bump — the release train handles that. - Runnable end-to-end example for declared software across a restore.
test/e2e/fixture/software/gog-goplaces.jsonis the example manifest for a gateway whoseopenclaw/openclaw/gogand.../goplacesskills (ClawHub:@steipete/gog/@steipete/goplaces) need thegogcli(gog) andgoplacesbinaries, neither of which is in the image. It installs each binary from its pinned GitHub release (curl … | tar -xz -C /usr/local/bin,gog --version/goplaces --versionasverify), so the packages are outside the/home/openclawsnapshot root and do not survive a container replacement. Two proofs: the local-only harness suitetest/e2e-backup/zzz_software_binaries_restore.txt(%skipunlessE2E_LOCAL=true: upload viaPUT /api/admin/software/manifest→POST /api/admin/software/provision→openclaw skills install @steipete/{gog,goplaces} --global→ backup (?inline=1) →/debug/destroy-container→ restore → binaries back with an advanced reportstartedAt, skills still listed), and the dependency-freescripts/software-restore-smoke.sh(bun run test:software:smoke), which drives the same contract directly against the sandbox image (provision → install skills → snapshot → fresh container → restore → assert binaries gone/skills back → re-provision → assert versions and a fresh report) and passes locally in ~2 min. Docs:test/e2e-backup/README.md,docs/TESTING.md. - Gateway memory is observable from the Worker, and a dev instance self-heals before the container limit. Investigating a
tenant-tarjetero-dev“reboot” required SSH-ing into the container to read/proc,dmesgand the gateway log, because nothing exposed the gateway’s RSS. (1) Observability (plan Phase 1):src/gateway/memory.tsreadsVmRSS+Threadsfrom/proc/<pid>/statusfor the gateway server (pgrep -x 'openclaw-gatewa', the same exactcommthe soft reload targets, zombies skipped) in ONE shell exec, throttled toGATEWAY_RESOURCE_SAMPLE_INTERVAL_MS(60s) so the frequent health poll adds at most one exec per interval.attachGatewayResources()(routes/public.ts) attaches it to/api/health,/api/health-snapshotand/api/health-wsasgateway: { pid, rssBytes, threads }— only while the snapshot isrunning, so a sleeping tenant is never woken — and writes agateway-resourcesAnalytics Engine row (double1= RSS bytes,double2= threads). (2) Watchdog (plan Phase 2.4): on a dev instance (isDevAgentsEnabled) atGATEWAY_RSS_RESTART_BYTES(3 GiB of the 4 GiB container) the gateway is replaced viakillGateway+resetStartupCache+ensureGateway({ skipRestore: true, bypassMaintenance: true })— the only lever that reclaims the per-worker_threadV8 heaps — with a 30-minute cooldown claimed before acting so concurrent health polls cannot double-restart, dispatched detached so a multi-minute replacement never delays a health response. Deliberate design: the threshold guards the container limit, not OpenClaw’s 1.5 GiBrss_thresholdwarning (which fires permanently on a healthy ~2.1 GiB dev gateway and would make the watchdog a restart loop), and there is no soft-reload step (a measured in-processSIGUSR2restart does not reclaim RSS: 1.14 → 1.38 → 1.18 GiB). Production is excluded. Tests:src/gateway/memory.test.ts,src/metrics.test.ts(trackGatewayResources),src/routes/public.test.ts(sample attached + AE row, one read per interval, no sample when not running, no watchdog on a non-dev instance); corpustest/business-rules/operational-modes.txt; docsdocs/plans/sandbox-memory-usage.md,apps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md(§5.4d). - OpenClaw migrated to 2026.10.8 (
catalog.openclaw+ the@openclaw/gateway-client/@openclaw/gateway-protocolpins in the rootpackage.json; the plugin repo tracks and publishes the same release). 2026.10.8 is a bug-fix/security release: plugin lifecycle repairs (older plugins can process incoming messages again after an upgrade, scheduled plugin work no longer stops after startup/reload, and Gateway startup repairs stale managed plugin links left by an external OpenClaw reinstall — the state a warm R2 restore can produce), session-store fixes (relative session-store paths no longer fork a second database;openclaw doctor --fixrepairs an already-split store), Doctor robustness on very large retained session histories (stack overflow / retained memory), and a trusted-proxy browser-auth fix that no longer writesgateway.auth.passwordor restarts the Gateway on first browser use. It also hardens POSIX exec allowlists (test -v/[ -vare no longer auto-trusted; moltlazy writes no exec allowlist, and the dev-onlysecurity.installPolicy allowis unaffected). No config-schema changes — the moltlazyopenclaw config validatecctr contract passes unchanged, so nopackages/moltlazysource change was needed — and the Node engine floor is unchanged at>=24.22.1 <25 || >=26.12.1, so no Dockerfile change. No component CalVer bump — the release train handles that. - Software provisioning is now usable mid-life and honest about its state. Three gaps closed around the
softwareProvisioningfeature. (1) On-demand reconcile:POST /api/admin/software/provision(ADMIN/ROOT) re-materializes the current R2 manifest, runsmoltlazy software provisionto completion (bounded bySOFTWARE_PROVISION_RUN_TIMEOUT_MS, 5 min) and returns the fresh report, so a manifest uploaded or corrected mid-life no longer waits for the next cold start;409 { code: 'disabled' | 'no_manifest' }and502 { code: 'failed', error }are distinct outcomes. (2) No cross-boot tick bleed:runSoftwareProvisiontruncates/tmp/software-progress.logbefore every run (resetProgressLog) —/tmpsurvives an in-place/debug/restart-openclaw, so the boot terminal used to interleave ticks from earlier boots. (3) Truthful dashboard states:GET /api/admin/software/{manifest,report}now returnenabled(the flag), and the homepage widget separates “provisioning is disabled”, “instance is asleep”, “no report yet” and “no software declared”, with a Run provisioning button (ADMIN/ROOT) that renders the on-demand report and surfaces its error.parseSoftwareReportmoved intosrc/gateway/software-provisioning.tsso the report, run and route paths share one shape check. Tests:src/gateway/software-provisioning.test.ts,src/routes/api/software.test.ts,src/client/pages/__tests__/HomePage.test.tsx,packages/moltlazy/tests/software/run.test.ts(progress-log reset), E2Etest/e2e/zzz_software_provisioning.txt(on-demand run must install the new package and skip the already-installed one); corpustest/business-rules/dashboard-api-contract.txt,operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - OpenClaw migrated to 2026.10.6 (
catalog.openclaw+ the@openclaw/gateway-client/@openclaw/gateway-protocolpins in the rootpackage.json; the plugin repo tracks and publishes the same release). 2026.10.6 is a security patch release (eMudhra certificate-compromise remediation, Windows setup/Doctor/Gateway startup fixes, Discord command and iPhone Talk fixes) with no config-schema changes: the moltlazyopenclaw config validatecctr contract passes unchanged, so nopackages/moltlazysource change was needed. It does raise OpenClaw’s Node engine floor from>=24.16.0 <25 || >=26.1.0to>=24.22.1 <25 || >=26.12.1, soapps/fouria/Dockerfilenow installs Node v24.22.1 (from v24.20.0) and its version gate compares major/minor/patch (24.22.0 is rejected). No component CalVer bump — the release train handles that. - Idle-sleep no longer re-archives an unchanged tenant, and deprovision snapshots reset the cadence.
TenantSandbox.onActivityExpired()used to enqueue a fulldeprovisionsnapshot on every idle expiry; on a 422 MB tenant the snapshot’s own RPCs renewed the DO activity window, sostopIfIdle()refused, the next expiry snapshotted again, and the container never stopped (observed ontenant-tarjetero-dev: three 422 MB archives at 02:35/02:39/02:44 UTC plus three more at 05:39/05:43/05:49, ~3 GB/day, containerrunningsince Oct 21). The hook now reads the catalog first (hasRecentSnapshot()insrc/persistence.ts, a pure read): a committed snapshot inside the idle window (resolveSleepAfterMs()— staging 15m, dev 2h, production 6h) already covers the unchanged filesystem, so it stops inline throughstopIfIdle()without a new archive; no bucket or a read failure falls back to the durable backup-then-stop job (fail closed). Deprovisionfinalizenow passesstampScheduled: truetoo, so a committed archive resetslastScheduledBackupand the next cron tick does not archive the same state again. Tests:src/sandbox-do.test.ts(recent snapshot stops inline, probe failure snapshots, no bucket skips the probe),src/persistence.test.ts(hasRecentSnapshot),src/activity/scheduler.test.ts(deprovision stamps),src/build-sandbox-options.test.ts(resolveSleepAfterMs); corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - The dev Fouria Builder heartbeat is reconciled to its intended cadence. OpenClaw 2026.10.5 retired
agents.entries.*.heartbeat: heartbeats are ordinary automation jobs, and config reloads/restarts never rewrite an existing job. The migratedheartbeat-fouria-builderjob therefore kept the default 30-minute cadence for 9 days ontenant-tarjetero-devdespite moltlazy’sheartbeat.every: 12h, running full agent turns on the main session (~317k tokens each) until the OpenCode subscription hit 0% (402 Insufficient account funds→agent-runner-failure).start-openclaw.shgains a dev-onlyensure_dev_heartbeat_cadence(post-start) that readsopenclaw automations get <id> --json, comparesschedule.everyMs/sessionTarget/payload.lightContext, and only then edits the job to--every 12h --session isolated --light-context(split so a rejected--light-contextcannot lose the cadence fix). Idempotent: a matching job is never touched, so the schedule anchor is not reset on every boot. Docspackages/moltlazy/AGENTS.md,apps/fouria/docs/WORKER-DEVELOPMENT.md. - Backup catalog reads are pure; catalog healing has an explicit entry point (audit finding F3).
GET /api/admin/storage/backups(getBackupHistory) used to runreconcileOrphanedBackupson every dashboard poll — listingbackups/, readingmeta.json, adopting orphans, deleting over-cap archives, and writingbackup-handle.jsonfrom aGET. It now performs three parallel reads (getPersistenceStore,getStableBackup,isRecoveryHeld) and nothing else. The write path isreconcileCatalogState(adoption + retention prune inside the etag-CAS mutation, reporting the ids it changed) →repairBackupCatalog(sweep metadata-less uploads + in-place encryption) → refreshed history, exposed asreconcileBackupCatalog; the durablerepairstep now runs it before thegatestep of every scheduled snapshot, so the catalog still self-heals after a killed invocation (issue #344). Restore/schedule keep their inline reconcile,debug/reprovisionreconciles before deciding nothing is restorable (a crashed upload must not look unrecoverable), and operators getPOST /api/admin/storage/reconcile(ADMIN/ROOT). The history panel pollsGET /api/admin/storage/jobs/:id(getBackupJobStatus) while a snapshot is in flight instead of re-listing the catalog every 5s, falling back to the history diff when no job id is returned. Tests:src/persistence.test.ts,src/persistence-encryption.test.ts,src/routes/api/storage.test.ts,src/activity/scheduler.test.ts,src/routes/debug.test.ts,src/client/components/__tests__/BackupHistoryPanel.test.tsx; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md,docs/plans/durable-agents-rules-audit.md. - A config repair is deferred until a restore settles and the gateway is up on the restored state, and the restored config becomes the stable/latest config version. A restore replaces the writable layer but launches nothing, so a
doctor --fixapplied around it was silently overwritten by the next re-apply of the recovery point (suspected ontenant-tarjetero-devafter a config fix). (1) Every successful restore (restoreIfNeeded,restoreBackupById) writes a durablerestore-config-pending.jsonmarker. (2) The boot job, the durable restore job, and the sync/async-fallback admin restore route finish through the sharedlaunchRestoredState(src/post-restore.ts):ensureGateway({ waitForReady: true })on the restored state, thencaptureRestoredConfigVersionwritesconfigs/<ts>.json+stable/config.json(the newest/stable version) and clears the marker. A gateway-launch failure does not re-run the destructive restore: restore jobs succeed withdetail: "gateway-launch-pending", the sync route returnsgatewayReady: false, and the marker drives the next tick. (3)doctor-repairchecks an active restore job,getPersistenceBusyReason(maintenance window / restore in flight), and the pending marker before running; when blocked it throwsMaintenanceJobDeferredError, andrunMaintenanceJobAlarmreschedules it every 60s without consuming an attempt (previously three deferrals would have failed the job before the restore finished). Tests:src/activity/maintenance-jobs.test.ts,src/activity/scheduler.test.ts,src/persistence.test.ts,src/routes/api/storage.test.ts; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md. - Diagnostics dashboard is skip-not-park and non-blocking.
DiagnosticDashboardonly dispatches its container reads (/api/admin/config/raw,/api/admin/config) while the gateway is actually running (useGatewayRunning()—snapshot.readiness.ok, ignoring the ROOT breaker bypass) and re-runs them when it comes back; the debug-routes flag (Worker-local) still loads. Every load is deferred after paint (scheduleAfterPaint→requestIdleCallback,setTimeout(0)fallback), so no widget waits on a container response:ConfigSectiongained agatewayReadyprop and now keeps its tabs/editor visible with a non-blocking “Loading configuration…” / “Waiting for the gateway to start…” notice instead of swapping the whole panel for a spinner; devices render a waiting state; config loads never clobber text typed before the response arrived. Gateway-only actions (device list/approve, config save, channel probe) are guarded, and the Debug Tools that only make sense against a live gateway (gateway-api,stop-gateway) are skipped with an inline explanation — container diagnostics (logs/processes/version/sqlite) and recovery actions (restart/rescue/destroy) stay available so a down gateway can still be inspected and revived. Repair stays available outside the editor:doctor --fixis the recovery action for a down gateway, sorunRepairno longer requires a running gateway, a dedicated Repair Environment bar (data-testid="repair-environment-button", ADMIN/ROOT) sits above the widgets and is disabled only while a repair is in flight, andConfigSection’s repair button stays enabled whilegatewayReadyis false. Tests:src/client/pages/__tests__/DiagnosticDashboard.test.tsx,src/client/components/__tests__/ConfigSection.test.tsx,src/client/GatewayHealthContext.test.tsx; corpustest/business-rules/dashboard-api-contract.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,docs/TESTING.md. - Billable emission: staging always emits,
BILLABLE_EVENTSopts a dev instance in. Both emit sites (POST /api/otel/v1/tracesand theCRON_BILLABLE_DRAINcron drain) previously gated on the strict billable cost axis (resolveInstanceDimensions(env).billable= production platform + production environment), so staging and dev instances could never exercise the billing pipeline. They now callisBillableEventsEnabled(env)(src/dev-mode.ts): billable production always emits and cannot be opted out, the staging platform always emits in every environment (mirroring production so billing is validated before release; the rows land in the staging Analytics Engine dataset), and a dev environment emits only withBILLABLE_EVENTS=true. Emission only:getCostContextkeeps the realplatform/environmentdimensions (staging/devremain non-billable cost axes) andshouldAutoSleepis untouched, so staging keeps its 15m idle timeout and an opted-in dev instance its 2h one. The emitting path omits the guard’sbillable: falsemarker (the local-E2E skip, whose worker is a dev instance viaDEV_MODE, is unaffected). Tests:src/dev-mode.test.ts,src/routes/otel-traces.test.ts(staging emits, dev opt-in emits),src/index.test.ts(cron drain: dev drops, staging and dev-with-override emit),src/build-sandbox-options.test.ts(sleep policy unchanged); corpustest/business-rules/dev-expense.txt; docsdocs/ENV-VARIABLES.md,docs/TESTING.md,apps/fouria/README.md,apps/fouria/docs/WORKER-DEVELOPMENT.md,.dev.vars.example. - Request paths never run a destructive archive restore, and a container stops only on verified inactivity (investigated on
tenant-tarjetero-dev, which appeared to “reboot” while in active use). (1) The container instance had not restarted (started_at00:18, stillrunning); what died was the gateway process ([Gateway] Gateway process … has terminal state: exited), and the follow-up boot ran a 350 MB archive restore under request execution contexts.sandbox.restoreBackupwas aborted at ~30.1 s (backup.restore error … The operation was aborted (30177ms), plussandbox.exec … The operation was aborted (30001ms)for health probes/umountand the workerd “promise resolved in a different request context” warning) because Cloudflare cancels a request’s background continuations shortly after the response — so the restore never finished and every reload re-attempted it (6 boot jobs + 8 restore errors in one hour). Fix:restoreIfNeeded(..., { restoreOwner: 'request' })(theensureGatewaydefault) performs only the cheap non-destructive checks (therestore-neededlatch +containerHasState()) and otherwise throwsRestoreDeferredToBootJobError;ensureGatewayrequests the durable boot job and throwsGatewayBootPendingError(proxy answers 503/loading). Durable callers (ActivitySchedulerboot/wake jobs, the queue consumer) passrestoreOwner: 'durable'. The proxy’s three inlinerestoreIfNeededcalls (proxy.request,proxy.websocket-recovery,proxy.fetch-recovery) were removed. (2) A container is now stopped only after a stop-time inactivity check:TenantSandbox.stopIfIdle()re-reads the DO’s own idle window (renewed by every request) and the process list, and the deprovision job calls it after its multi-minute snapshot instead ofsandbox.stop(); if the tenant became active meanwhile the job isskipped(active:<reason>). Refusals:activity,transient-activity,probe-failed,billable-production,not-running. Tests:src/sandbox-do.test.ts(stopIfIdlecases),src/activity/scheduler.test.ts(stop-time skip),src/gateway/process.test.ts(deferral +restoreOwner),src/persistence.test.ts(request deferral / state-present short-circuit),src/index.test.ts(proxy no longer restores); corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md,webs/fouria-docs/.../worker-development.md,operator-guide.md. - OpenClaw migrated to 2026.10.5 (
catalog.openclaw+ the@openclaw/gateway-client/@openclaw/gateway-protocolpins in the rootpackage.json; the plugin repo tracks the same release). One breaking change hit moltlazy: the 2026.10.5 config schema retiredagents.defaults.compaction.enabled(embedded auto-compaction is no longer toggleable) and retiredcompaction.truncateAfterCompaction(“byte-triggered compaction now opts in viamaxActiveTranscriptBytesalone”) —openclaw config validaterejects both keys withInvalid input, which broke the moltlazy cctrconfig-savecontract.AGENT_DEFAULTS.compactionnow emits onlymaxActiveTranscriptBytes: '20mb'+keepRecentTokens: 20000, preserving the sandbox OOM transcript bound. The runtime zod schema still accepts the retired keys, so only theconfig validatecontract (and the published schema) caught it. Tests:packages/moltlazy/tests/agents.test.ts(asserts neither retired key is emitted); docspackages/moltlazy/AGENTS.md. - Local development runs on the Cloudflare Vite plugin instead of
wrangler dev.bun run dev:worker/bun startstart the Worker withvite dev(vite.config.ts), the same pluginbun run buildalready used;bun run devserves the admin SPA fromvite.ui.config.ts(:8787) and proxies to the Worker (:8788). Local E2E fixtures (test/e2e/fixture/server/start-local,start-local-pair) launchvite dev, pass the old--varoverrides through the plugin’sconfighook (E2E_WORKER_NAME,PERSIST_STATE_PATH,VITE_CACHE_DIR,VITE_INSPECTOR_PORT), installtest/e2e/.dev.varsinto the Worker config directory for the run (the plugin has no--env-file;stop-local*restores the developer’s file), and fire cron ticks through/cdn-cgi/local/scheduledinstead of/__scheduled.--envis gone from the deploy/dry-run scripts:CLOUDFLARE_ENV=…selects the environment at build time andwrangler deploydiscovers the generateddist/fouria/wrangler.jsonvia.wrangler/deploy/config.json. Docs:README.md,docs/DEVELOPMENT.md,docs/TESTING.md,apps/fouria/README.md,apps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md,test/e2e*/README.md. /healthzis now a real, fast liveness route. It previously fell through to the gateway-proxy catch-all (app.all('*')), which ranrestoreIfNeeded+ensureGateway+ awaitForGatewayReadyport wait — on a cold/sleeping instanceGET /healthztook ~108 s and was killed by the platform before responding (Workers Observability ontenant-client-dev:GET /healthz→ 503 @ ~108 s avg, 348 requests in 2 h). The newGET /healthzdoes exactly one non-wakingisRuntimeActive()read and returns200 { ok, ts, status }(active|idle) sub-second, never warming the container or probing the gateway; readiness stays on/api/health. It sits on the tenant hostname, so it stays behind the host Access app (not public). Tests:src/routes/public.test.ts(/healthz200 + noensureGateway/exec/listProcesses;idlewhen the runtime is off); docsapps/fouria/README.md,apps/fouria/docs/WORKER-DEVELOPMENT.md,docs/WORKER-HEALTH.md.- Browser health endpoints moved to Access-safe sibling paths (
/api/health-ws,/api/health-snapshot,/api/health-components). On tenant hostnames every browser WebSocket andfetch()under/api/healthor/api/health/*failed (WebSocket connection to 'wss://…/api/health/ws?passive=1' failed, plus CORS/redirect failures onGET /api/health/componentsandGET /api/health): the path-scopedFourIA Health - <slug>Access app shadows those paths and its AUD is distinct from the host app’s (Cloudflare ignores a requestedaudon create and update — verified against the live API — so the AUDs cannot be unified). A browser logged into the host app therefore gets a cross-origin 302 login redirect to*.cloudflareaccess.comon/api/health*, which WebSocket handshakes cannot follow and browserfetch()rejects on CORS. The sibling paths/api/health-ws,/api/health-snapshot, and/api/health-componentssit outside the health app’s path prefix, so the host-app session the browser already holds passes (verified against livestaging-client-dev.fouria.io:/api/health-*resolves to the host appkid, while/api/healthand/api/health/*resolve to the health appkid). The Worker mounts the handlers at both path sets (healthHandler,healthComponentsHandler,healthWsHandlerinsrc/routes/public.ts);api.ts(subscribeHealth,getHealth,getCloudflareComponents) andloading.htmluse the-sibling paths, while/api/health,/api/health/ws, and/api/health/componentsremain for headless service-token clients (lerma). Tests:src/routes/public.test.ts,src/assets/loading.test.ts, UI stubstest/ui/support/api.ts+test/ui/cloudflare-components.spec.ts; docsapps/fouria/README.md,apps/fouria/docs/WORKER-DEVELOPMENT.md,docs/WORKER-HEALTH.md,docs/TESTING.md; lermaaccess_policy.exdocuments the constraint. - Telegram ingress queue observability: notification-bell entry + home status widget. The per-tenant
TelegramIngressDO now records every ingress event (bounded counters + last 20) —queued(a cold update was enqueued and woke the container),forwarded(hot path),delivered, andfailed— viatelegram-ingress/status.ts, wired from the webhook route (queued/forwarded) and the queue consumer (delivered/failed).GET /api/admin/telegram-ingress/statusreturns the snapshot andGET /api/admin/telegram-ingress/wsstreams it (a frame per change,TELEGRAM_INGRESS_WS_POLL_INTERVAL_MS, rotated). The admin shell’sTelegramIngressProvideropens the socket only while the feature is in use (an account is registered or activity exists) and raises a notification-bell entry (“Telegram message queued — waking your instance”, or a delivery-failure alert); the newTelegramIngressWidgeton the home page shows state + queued/delivered/failed + last event, hidden until in use. Tests:src/telegram-ingress/status.test.ts,src/routes/api/telegram-ingress.test.ts,src/client/__tests__/telegram-ingress-context.test.tsx,src/client/components/__tests__/TelegramIngressWidget.test.tsx,src/client/pages/__tests__/HomePage.test.tsx; corpustest/business-rules/dashboard-api-contract.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - Homepage no longer crashes with
Cannot read properties of undefined (reading 'length').GET /api/admin/software/reportrancat <report> 2>/dev/null || echo '{}', so a tenant whosemoltlazy software provisionhad never run got a truthyreport: {}; the homepage Software widget then readsoftware.packages.lengthand threw on render (only for ADMIN — ROOT lands on diagnostics). The route now returnsreport: nullunless the payload is a real report (an object with apackagesarray), andHomePagereadssoftware?.packages ?? []defensively. Tests:src/routes/api/software.test.ts(missing/partial report →null),src/client/pages/__tests__/HomePage.test.tsx(truthy{}renders the empty state instead of crashing). - Release CD promotes the already-built artifacts instead of rebuilding.
deploy-fouria.ymlused todocker buildthe container image from source and re-build the wrangler bundle at release time; it now promotes what CI already built: it resolves the release’s develop-mainline build commit (git rev-list -n1 --first-parent --invert-grep --grep='^chore: release' <tag> -- apps/fouria/ .github/workflows/test.yml), retags the Cloudflare registry imagefouria:unstable-<sha>→fouria:<tag>+latest(minting short-lived pull+push registry credentials viaPOST /accounts/{id}/containers/registries/{host}/credentials, mirroring Lerma’sImageRegistry), and copies the CI bundlefouria-bundles:unstable-<sha>/fouria.mjs→<tag>/+latest/in R2.deploy-dashboard.ymlnow tags the develop build with an immutablelerma:sha-<sha>in addition to:latest-pre, and itspromotejob pins to that per-commit image (resolving the release’s lerma build commit the same way) instead of the floating:latest-pre(falling back only for the first release after the tag is introduced). Docs:docs/DEVELOPMENT.md,docs/TESTING.md,apps/lerma/DEPLOY.md,apps/fouria/docs/WORKER-DEVELOPMENT.md. Both workflows validated withactionlint. - Durable
doctor-repair/SQLite jobs start immediately, and their status streams over a WebSocket instead of 2s polling. Adoctor-repairjob enqueued at 12:57:30 only began at 13:02:11 — exactly the previous boot job’s 14-minute lease — because theActivitySchedulerowns one alarm and a stale arm (the alarm handler’s trailing re-arm, or a warm-pathrefresh) could read “no pending job”, then execute itssetAlarm(later)/deleteAlarm()after the just-enqueued job’ssetAlarm(now), postponing it.scheduleCombinedAlarmnow writes througharmWithGenerationGuard(activity/alarm.ts): it bumps a stored generation, and a superseded arm abandons its stale write so the newest arm (fresh read) owns the alarm. The dashboard no longer pollsGET /api/admin/config/fix/jobs/:idevery 2s (one request + Worker log line per tick for the whole multi-minute repair): a newGET /api/admin/config/fix/jobs/:id/ws(and the/debug/sqlite-integrity/jobs/:id/wsvariant) streams the job (routes/api/maintenance-ws.ts) — a frame only on status change, close1000when terminal, and arearm()self-heal while active. The client’ssubscribeMaintenanceJobis WS-first with a slow HTTP fallback only while the socket is down, andDiagnosticDashboardrenders a liveMaintenanceJobModal(queued/running/attempt/elapsed, run-in-background) instead of a bare spinner, with a banner to reopen it after backgrounding. Tests:src/activity/alarm.test.ts,src/activity/scheduler.test.ts,src/routes/api/maintenance-ws.test.ts,src/client/__tests__/maintenance-job-subscription.test.tsx,src/client/pages/__tests__/DiagnosticDashboard.test.tsx; corpustest/business-rules/dashboard-api-contract.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - Sandbox memory OOM mitigation (dev instance). A dev instance grew RSS past OpenClaw’s 1.5 GiB
rss_threshold(worker-thread V8 heaps + native arenas, not the main isolate) driven by cron-replayed heavyagentTurnjobs. (1)packages/moltlazyAGENT_DEFAULTS.compactionsetsenabled: true,maxActiveTranscriptBytes: '20mb',keepRecentTokens: 20000so a provider-side-managed session can no longer grow its persisted transcript unbounded (thefouria-builder:main~407k-token session inflates the SQLite history and worker heaps). (2) The dev-only Fouria Builder entry setsheartbeat.every: '12h'plusisolatedSession: true/lightContext: true— OpenClaw’s default 30m heartbeat is a full agent turn ~48×/day that also triggers memory-core dreaming reconciliation. (3)start-openclaw.shslows memory-core’s dreaming sweep to weekly (frequency: "0 3 * * 1", dev-gated) — the ~6-min daily sweep is replayed on every wake (cron: running missed jobs after restart) and produced the 1.6 → 2.08 GiB RSS spike. (4)ensure_opencode_credits_automationdedupes viaopenclaw cron list --all --jsonin addition to the legacyautomations list(which missed a prior boot’s job, creating two duplicateopencode-credits-checkcron jobs). Tests:packages/moltlazy/tests/agents.test.ts; docspackages/moltlazy/AGENTS.md,apps/fouria/docs/WORKER-DEVELOPMENT.md. - Boot log streams gateway-launch progress (fixes “Launching the gateway — no progress for 6 min”).
start-openclaw.shnow starts astart_boot_log_streammirror inlaunch_gateway_processthat tails the gateway’s own--verbosestdout (/tmp/gateway-stdout.log) into the curated boot log (/tmp/startup.log) — so the loading page can follow SQLite migration → plugin load → port bind instead of going blank the momentstart/launchexecs the gateway.post-start/fullstop the mirror (stop_boot_log_stream) and truncate the buffer at readiness. The Worker’s/api/startup/wsstream now reads the boot log whileprocessType === 'gateway'(not just'script'), andloading.htmlshows the log panel during gateway startup — restyled as a vintage CRT terminal (title bar + traffic lights + phosphor text + scanlines) — instead of hiding it behind the logo. Tests:src/assets/loading.test.ts,src/routes/public.test.ts; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - Loading page no longer gives up on its own.
loading.htmlhad two client-side budget specs — a 5-error retry cap (maxConsecutiveErrors,Retrying... (n/5)) and an 8-minute wall-clock deadline (MAX_WAIT_MS/deadline→runDoctorAndShow()). Since the cold boot moved to the durableActivitySchedulerboot job (which owns retries and terminal failure), the page’s self-imposed give-up only interrupted a legitimately long startup: it now waits indefinitely (WebSocket push, with an unlimited 5s HTTP-poll fallback) and reports terminal failure solely fromboot.status === 'failed'and permanentdegradedcontainer errors. Removed the now-deadrunDoctorAndShow/showStructuredError/showErrorhelpers. Tests:src/assets/loading.test.ts; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - Restore decrypt no longer exhausts the Worker CPU budget, and interrupted restores are labelled honestly. A large recovery archive (
tenant-tarjetero-dev) was killed withWorker exceeded CPU time limitmid-Decrypting backup …and retried in a loop.encryptStream/decryptStream(src/crypto/backup-encryption.ts) grew each 4 MiB chunk withconcaton every ~64 KB R2 read, recopying the pending chunk ~64× over; aByteQueuenow copies each byte once (96 MiB decrypt: 1.5 s → 0.14 s at 64 KB reads, 5.6 s → 0.14 s at 16 KB). The R2 binding delivers the archive in 4 KiB reads (64 MiB → 16,385 reads), which is why the per-read copy dominated; each restore now logs[crypto] Decrypt read profile(reads, bytes, max/avg read, chunks) so the pattern can be checked on a live tenant. The loading bar also showed the last durable phase (Waiting for the backup lock 3%) as if still live: a failed attempt is now labelledRestore attempt failed during "<phase>" — retrying(recordRestoreFailure), and an idle record gets— no progress for N min(describeRestoreProgressIdle); the fraction never moves backward. Tests:src/crypto/backup-encryption.test.ts,src/activity/restore-progress.test.ts,src/activity/scheduler.test.ts; docsdocs/WORKER-DEVELOPMENT.md. - Recovery progress bar synchronized with the durable object’s events. During a restore the loading page showed a generic spinner; it now shows a progress bar driven by the
ActivitySchedulerDO’s own phase events, not a client-side timer.restoreIfNeeded/restoreBackupByIdcall theironProgress(phase)hook on everypersistence.phase; the DO wires it torecordRestoreProgress, which maps the phase to a label + a monotonic fraction (describeRestoreProgressinactivity/restore-progress.ts, cumulative phase weights) and exposes it viagetRestoreProgress()./api/startup/ws(and non-passive/api/health, plus/api/admin/boot-state) pushrestoreProgress: { phase, label, fraction };loading.htmlrenders the bar and hides the stepper while a restore is in flight, then switches back to the container’sstartup-progress.jsonstepper once the gateway launch begins (an indeterminate bar covers a request-scoped restore with no DO feed). Also declaresgetBootJob/getRestoreProgressonActivitySchedulerStub(fixing thepublic.tstype error). Tests:src/activity/restore-progress.test.ts,src/activity/scheduler.test.ts,src/routes/public.test.ts,src/routes/api/misc.test.ts,src/assets/loading.test.ts; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md. - Restore legibility: name the backup + date being loaded (and mark the recovery point). A cold restore showed only a generic “Restoring data from backup…” spinner, so an operator could not tell which snapshot was loading. (1) Durable recovery state.
restoreIfNeeded/restoreBackupByIdnow writerestore-target.json(the archive being applied) just beforesandbox.restoreBackupand clear it on success;readRecoveryState(bucket)returns{ restoring, committed }(committed=stable-backup.json). It is read from R2, not the per-isolaterestoreStatus, because the durable boot/restore runs in theActivitySchedulerDO whose in-memory state the request isolate cannot see. (2) Surfaced on the loading page./api/health(non-passive, not-yet-ready) and/api/startup/wsattachrecovery(bounded byRECOVERY_STATE_TIMEOUT_MS, fail-soft to null; lerma’s passive poll never pays the read);loading.htmlrenders “Restoring backup— ” (or “Recovery point …”) and its isRestoringalso honoursrecovery.restoring. (3) Dashboard.BackupsPagethreadsstableBackupIdtoBackupHistoryPanel, which marks the recovery point with a recovery point badge + a “A cold boot restores— ” summary. Tests: src/persistence.test.ts(readRecoveryState, restore-target publish/clear),src/assets/loading.test.ts,src/client/components/__tests__/BackupHistoryPanel.test.tsx,src/routes/public.test.ts; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md. - Manual-restore hardening: recovery-point flag, writer quiesce, and no restore loop. Restoring an older archive from the Backups page could not be applied without either making it permanent or being silently undone. Three fixes in
src/persistence.ts+ the storage route/durable job. (1)setCurrentflag.POST /api/admin/storage/restore/:id?setCurrent=0(also?async=1&setCurrent=0) passes{ setRecoveryPoint: false }torestoreBackupByIdso the archive is applied without force-promoting it tostable-backup.json(the default still promotes; the durableBackupJobRequest/BackupJobRecordcarry the flag so a retried job keeps the intent). The Backups page exposes it as a Set as recovery point checkbox (checked by default). (2) Stop writers on the lease.restoreBackupByIdnow opens a cross-isolate maintenance window (maintenance/replacement.json, operationrestore) and stops the gateway the moment it takes the shared restore lease (the route no longer pre-kills before the lock), closing the window in afinally; a live gateway/automation/channel therefore cannot keep writing whilesandbox.restoreBackupreplaces the writable layer. (3) No remount loop.restoreIfNeededrefuses to run while any maintenance window is active (andensureGatewayalready refuses to launch), so a health/proxy refetch cannot restart the gateway and re-run the restore against the committed recovery point — the restore → stop → refetch → remount-the-latest loop. Tests:src/persistence.test.ts(set-recovery-point, maintenance window, deferred restore),src/persistence-encryption.test.ts,src/routes/api/storage.test.ts,src/activity/scheduler.test.ts,src/activity/backup-jobs.test.ts,src/client/components/__tests__/BackupHistoryPanel.test.tsx; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md. - Durable cold-boot job + slim health probe (observed on
tenant-client-dev:start-openclaw.shnever ran;phase=restore, age=686365ms; 141waitUntil() tasks did not complete;/api/health?passive=1at error level ×98). (1) Durable boot. The cold boot (R2 restore → gateway launch) was driven from a request’sctx.waitUntil(), which Cloudflare cancels shortly after the response — so a restore that outlived it was killed mid-flight (Decrypting backup …×14) andstart-openclaw.shwas never reached while every poll parked on the stuck start promise. It is now a durable job on theActivitySchedulerDO (src/activity/boot-job.ts):/api/warmup, non-passive/api/health, and/api/startup/wsonly request it (deduped) and return; the DO alarm performsrestoreIfNeeded→ensureGatewayand retries on a bounded lease. Falls back to the request-scoped boot whenACTIVITYis absent. (2)sandbox.restoreBackupis bounded byRESTORE_BACKUP_TIMEOUT_MS(a hung control channel fails fast instead of holding therestorephase for 11 min). (3) The restore reports sub-phase progress soisGatewayStartStuckjudgesrestoreonGATEWAY_RESTORE_NO_PROGRESS_MSof no progress (setGatewayStartProgress) — a slow-but-advancing restore is not killed. (4)withLeasereleases the shared R2 lease when its request aborts (PersistenceDiagnosticContext.signal), so a cancelled operation can’t leaverestore-needed+ a heldbackup-lockre-triggering the loop. Also:/api/healthnow issues one gateway/healthexec shared by readiness + liveness (was a duplicate curl pair per poll) and the passive path skips the container + R2 component probe (lerma’s frequent probe never readscomponents). Tests:src/activity/boot-job.test.ts,src/gateway/process.test.ts,src/gateway/health-probes.test.ts,src/routes/public.test.ts,src/persistence.test.ts; corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - Slimmer
/api/health(frequent lerma probe). Two per-poll costs removed. (1) Readiness and liveness each ran the same gateway/healthcurl, so every poll spawned a pair of identicalcurlprocesses (visible as paired entries in/debug/processes);getHealthSnapshotnow fetches the process scan and the/healthprobe once, in parallel, and reuses both across the probes (newHealthProbeOptions.health). (2) The component probe (anisRuntimeActiveread + an R2 HEAD ofbackup-handle.json) was built on every/api/health, including lerma’s frequent?passive=1poll — which never readscomponents; the passive path now skipscomponentsForHealthentirely (the non-passive path and the dedicatedGET /api/health/componentsare unchanged). Tests:src/gateway/health-probes.test.ts(single shared exec),src/routes/public.test.ts(passive omits components); corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md. - Restore config guard + recovery-point promotion (observed on
tenant-tarjetero-dev). After thev2026.10.13container rollout, an explicit restore of an older known-good backup did not stick: the redeploy changed the container runtime mid-restore, and a concurrent scheduled snapshot captured the partially-restored state and was auto-promoted to the stable recovery point, so the next cold boot restored the wrong archive and launched the gateway with no config. Three fixes: (1)start-openclaw.shonly honoursOPENCLAW_RESTORED=truewhen$CONFIG_FILEexists — otherwise it runs the setup body — so a “restored” boot with no materialized config (interrupted restore, orrestoreIfNeeded’s “container already holds tenant state” short-circuit) can no longer launch OpenClaw configless. (2)restoreBackupByIdnow force-promotes the restored archive tostable-backup.json(promoteStableBackup(bucket, entry, { force: true })) so an explicit restore becomes the recovery point even when it predates the current one; the default pointer still only advances forward in time. (3) the pre-backup config cleanup used.${CONFIG_DIR}withCONFIG_DIR='.openclaw', building/home/openclaw/..openclaw/…(a never-existent path, so the cleanup silently no-oped) — it now uses${CONFIG_DIR}. Tests:src/persistence.test.ts(force-promote; cleanup path); corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,apps/fouria/docs/OPERATOR-GUIDE.md. - Cold-start latency + boot legibility (a full non-restored boot on
staging-client-devtook ~14 min). Two causes, both fixed, plus a loading-page alert. (1) Non-owner killed the booting gateway. A non-owner isolate that observed thestart-openclaw.sh startwrapper waited a freshSTARTUP_TIMEOUT_MS(300s) from its own observation, but the wrapper’s real boot issetup (~290s) + gateway bootstrap (~45s) ≈ 335s— so the waiter timed out ~35s early andkill()ed the process just as it hadexeced into the gateway, releasing the startup lock and making the waiting second wrapper re-run the whole setup. Confirmed via Workers Observability:Startup script present but gateway never became reachable … killing and restarting= 1 while the warm-probe start/catch = 0/0 (ruling out the 30s warm probe). Fixed withSTARTUP_WRAPPER_STUCK_BUDGET_MS(STARTUP_TIMEOUT_MS + GATEWAY_START_STUCK_GRACE_MS): the non-owner’s stuck check and readiness wait are measured from the wrapper’sstartedAt(mirroring the owner’s watchdog) and a/healthre-probe runs immediately before any kill. Tests:src/gateway/process.test.ts,src/gateway/process-extra.test.ts. (2) Plugin detection read the hanging registry.plugin_is_installedranopenclaw plugins list --json, which hangs for its fullCLI_TIMEOUTand reads as “not installed” on a hung/partial list, so the pre-installed guard fell through and triggered a needless network install (ai-gateway ~57s + otel ~74s). Replaced withplugin_extension_present(theextensions/<id>dir the gateway actually loads). (3) Bootup-UI alert. The loading page now shows a non-fatal slow-step notice (step name + elapsed seconds) once a step overrunsSLOW_STEP_MS(120s), so a slow-but-progressing boot is distinguishable from a stuck one without opening logs. Tests:src/assets/loading.test.ts. Corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,docs/plans/cold-start-latency.md. - The tenant Usage & Billing widget no longer 403s on Analytics Engine.
GET /api/admin/costs/v2/summaryresolved its AE SQL token asANALYTICS_ENGINE_API_TOKEN ?? CLOUDFLARE_API_TOKEN, but Lerma never provisioned the dedicated token, so the query fell back toCLOUDFLARE_API_TOKEN— the AI Gateway credential alias, which lacks Account Analytics:Read — and logged[cost-summary] Analytics Engine query failed with HTTP 403on every load (observed ontenant-client-dev), zeroing the widget. The token is now a Lerma platform secret (tenant_provisioner.ex@platform_secrets), read from Lerma’s environment and deployed per-tenant as asecret_textbinding; the deploy path wires it throughmix lerma.deploy, Ansibleapp-config,docker-compose.prod.yml/.pre.yml, anddeploy-dashboard.yml, and the secrets manifest. Optional: when unset the worker still degrades to an all-zero summary. Tests:tenant_provisioner_pipeline_test.exs,tenant_provisioner_integration_test.exs; docsdocs/ENV-VARIABLES.md,apps/lerma/README.md,apps/fouria/docs/cost-observability.md,SECRETS.example.yaml,docs/schemas/secrets-manifest.schema.json. - Zero-data-loss: a restored container skips the setup body. The R2 restore runs in the Worker (
restoreIfNeeded→sandbox.restoreBackup()) beforestart-openclaw.sh; when that restore actually restored a backup,ensureGatewaynow passesOPENCLAW_RESTORED=truein the launch env (gated ongetRestoreStatus().hadBackup && restored, so a brand-new tenant with no backup still onboards), and the script skips the whole setup body — onboard → plugin installs →moltlazy patch→ config validate — emitting those phases as skipped and launching the gateway directly from the restored filesystem. The restored state is authoritative: the cold-start budget is spent launching it, not re-mutating it (which could diverge from or clobber the snapshot). Each boot rewrites a durable receipt at/tmp/openclaw-restored-setup-skipped(written on the skip path, removed on the setup path). Tests:src/gateway/process.test.ts; E2Etest/e2e-backup/zzz_backup_restore_skip_setup.txt(opt-inE2E_BACKUP_RESTORE=1; sync → destroy → restore, asserts the receipt + unchanged restored setup state); corpustest/business-rules/operational-modes.txt; docsapps/fouria/docs/WORKER-DEVELOPMENT.md,test/e2e-backup/README.md,test/e2e/BACKUP-E2E-DESIGN.md. - The dashboard Usage & Billing widget now reflects emitted billable actions.
GET /api/admin/costs/v2/summarywas a stub returningtotalCostUsd: 0; it now aggregates the tenant’sbillable-actionAnalytics Engine rows via the AE SQL API (src/cost-summary.ts→getCostSummary()), returningtotalCostUsd,totalCredits,actionCount,byTriggerType, andbyCostCategory. Config mirrors Lerma:ANALYTICS_DATASET(defaultfourai_cost_metrics),ANALYTICS_ENGINE_BASE_URL, andANALYTICS_ENGINE_API_TOKEN(falls back toCLOUDFLARE_API_TOKEN; needs Account Analytics:Read). A missing credential/transport error/non-200 degrades to an all-zero summary, so the widget never breaks. The widget surfaces the billable action/credit rollup when data is present. Tests:src/cost-summary.test.ts,src/routes/api/costs.test.ts,src/client/pages/__tests__/HomePage.test.tsx,src/client/pages/__tests__/AccountPage.test.tsx,test/ui/billing-widget.spec.ts; corpustest/business-rules/dashboard-api-contract.txt; docsapps/fouria/docs/cost-observability.md,docs/ENV-VARIABLES.md,docs/TESTING.md. - The version surfaces now report the Worker’s own build identity.
GET /api/admin/versionandGET /debug/versionreturnfouria_version(component CalVer fromapps/fouria/package.json) andfouria_commit(short git SHA) alongside the container’s OpenClaw/Node versions; the DiagnosticDashboard Version Info tool surfaces them. Both values are injected at build time byvite.config.ts(__FOURIA_VERSION__/__FOURIA_COMMIT__, consumed viasrc/build-info.ts;GITHUB_SHAwins in CI,git rev-parse --short HEADlocally). Tests:src/routes/debug.test.ts,src/routes/api/misc.test.ts; docsdocs/WORKER-DEVELOPMENT.md,docs/OPERATOR-GUIDE.md. - Expected CLI non-zero exits are no longer logged as failures.
waitForProcess(likerunShell) now takesreportNonZeroExit; the knowledgewiki statusprobe sets itfalse(operationknowledge.wiki-status) becauseopenclaw wiki statusexits non-zero for an uninitialized vault — which/api/admin/knowledge/treehandles as a normalinitialized: falseresult — yet every load emittedError [SandboxProcessError]: sandbox.waitForProcess failed (non-zero-exit, exit=1). Timeouts still log. Tests:src/gateway/utils.test.ts; corpustest/business-rules/operational-modes.txt; docsdocs/WORKER-DEVELOPMENT.md. - The prelaunch gateway port probe no longer logs a false failure.
isGatewayPortOpenrancurl -sf …/healththroughrunShell, whoselogCommandFailureemitted a structuredsandbox.process.failederror for the expected closed-port exit (curl7 = connection refused). Every cold start therefore surfaced a scaryError [SandboxProcessError]: shell failed (non-zero-exit, exit=7)for the normal “gateway down, start it” outcome. It now passesreportNonZeroExit: falsewithoperation: 'gateway.port-probe'(matching the existinggateway.health-probe), so a closed port is quiet while a probe timeout (a hung gateway) still logs. Test:src/gateway/process.test.ts(does not log a structured failure for the expected closed-port exit); corpustest/business-rules/operational-modes.txt; docsdocs/WORKER-DEVELOPMENT.md. - OpenClaw is installed globally with bun, not npm.
bun install --global --trust openclawruns withBUN_INSTALL=/usr/local: bun’s default global prefix is$HOME/.bun/bin, which is not onPATHin this image, soBUN_INSTALL=/usr/localputs the binary at/usr/local/bin/openclaw(onPATH) and the package under/usr/local/install/global/node_modules/openclaw.bun pm cache rmresolves the current project and hard-fails without apackage.json— the base image’sWORKDIR /container-serverhas none — so it runs from/tmp(which holds the copied repopackage.json). The dead-weight trim now targets bun’s hoisted global layout (<prefix>/install/global/node_modules), andstart-openclaw.shresolves the package by following the installed binary (command -v openclaw+readlink -f) instead ofnpm root -g, so the runtime-version log stays accurate. post-startno longer blocks readiness. After the port wait succeeds the gateway is already serving/health200, butensureGatewayImplstillawaitedstart-openclaw.sh post-start(dev automation + boot-log reset, bounded byGATEWAY_POST_START_TIMEOUT_MS= 60s). On dev instances that phase runsopenclaw automations list/create(30–60s), so every request loggedGateway start already in progress … (phase=post-start)and waited on the shared start promise even though the gateway was up. It is now dispatched detached (void runGatewayPostStart(...), not awaited) right aftermarkGatewayReady;startShelldispatches thesandbox.execsynchronously before its firstawait, so the work still runs server-side if the isolate is evicted, andrunGatewayPostStartswallows its own errors. Thepost-startphase is no longer set on the start tracker (the start is complete). Test:src/gateway/process.test.ts(does not extend the shared start promise with the detached post-start phase); docsdocs/WORKER-DEVELOPMENT.md.- ClawHub plugin pre-install is best-effort so the image still builds. The unpinned
clawhub:@openclaw/cloudflare-ai-gateway-providerresolved to2026.9.9, which requires a newer plugin API than the pinned2026.9.8runtime, soopenclaw plugins installfailed and aborted the whole Docker build (Plugin … requires plugin API >=2026.9.9, but this OpenClaw runtime exposes 2026.9.8). The Dockerfile now wraps each pre-install in a warn-and-continue guard, andstart-openclaw.sh’s single enablementconfig patchonly enables a plugin whose extension directory is present (CF_AI_GATEWAY_PLUGIN_PRESENT/UNIFIED_BILLING_PLUGIN_PRESENT), so a failed install can neither fail the build nor invalidate the patch. Root-cause follow-up: bumpcatalog.openclawto the plugin-compatible release (openclaw-migration skill) or pin the specs; until then a build on the pinned runtime ships without the Cloudflare provider plugins. Corpustest/business-rules/operational-modes.txt; docsdocs/WORKER-DEVELOPMENT.md,docs/OPENCLAW-PLUGINS.md. - Gateway start watchdog + process-count hygiene. A cold start is one shared
ensureGatewaypromise (restore → supervisedstart-openclaw.sh start→ port wait); a wrapper that neverexecs the gateway, or a control-channel drop, left it “in progress” for ~20 min while every request loggedGateway start already in progress … waiting...and waited on it (observed ontenant-client-dev: 64 processes, port closed, curl health probes exiting 7 every ~5s,[PROXY] Failed to start gatewaystack-only). The start is now tracked per sandbox key with a phase (probe→restore→launch→port-wait;post-startruns detached after readiness, not tracked) and a per-phase budget;isGatewayStartStucktrips when a phase overruns its budget +GATEWAY_START_STUCK_GRACE_MS. Before resettingport-wait,recoverStuckGatewayStartrechecks/health: a late-positive response emitsgateway.start.late-readyand is adopted without killing, while a failed/unknown recheck emitsgateway.start.health-recheck-failedand defers reset. Confirmed stuck starts emitgateway.start.stuck, kill the process (killGateway), clear startup/readiness caches, and reprovision afterGATEWAY_START_STUCK_MAX_ATTEMPTSresets (recoverStaleSandbox).findExistingGatewayProcessalso uses the pureclassifyGatewayStartto kill astart-openclaw.sh startwrapper older thanSTARTUP_TIMEOUT_MSwith the port closed, instead of waiting out another readiness budget. BecauselistProcesses()includesexited/errorentries the Worker never GCs (the SDK exposes no cleanup), the raw count is append-only and must not gate health: the log now readslistProcesses returned <total> processes (<running> running)and every decision considers onlyrunningentries. Emitsgateway.start.begin/phase/stuck/late-ready/health-recheck-failed. Tests:src/gateway/classify.test.ts,src/gateway/process.test.ts; corpustest/business-rules/operational-modes.txt; docsdocs/WORKER-DEVELOPMENT.md,docs/OPERATOR-GUIDE.md. - Legacy bridge excludes the image-provided shared OpenClaw package.
extensions/<id>/node_modules/openclawis a symlink to the image’s/usr/local/lib/node_modules/openclaw; archiving it is pointless and (when an old dereferencing stage expanded it into a full package copy) made the restore materialization a multi-minute copy that blocked the gateway launch, leftrestore-neededset, and re-ran the restore on every boot (observed onstaging-client-dev:cp -a … /root/openclaw/.openclaw/running 8m45s, 65 Worker probe processes, nostart-openclaw.sh/gateway). BothstageLegacyRootsForBackupandmaterializeLegacyRootsAfterRestorenow use a symlink-preservingtarpipe with--exclude='*/node_modules/openclaw'(a copy-then-rm -rfis equally slow — deleting a squashfs-lower tree requires copy-up), so old and new archives restore fast.restoreIfNeededalso deletes therestore-neededmarker immediately after a successful materialization (before the analytics bookkeeping) so an isolate eviction can no longer leave a stale marker. Tests:src/persistence.test.ts; corpustest/business-rules/operational-modes.txt. - Legacy restore bridge preserves symlinks (backup/restore fix). The legacy state bridge staged
/root/openclaw/.openclawwithcp -aL, which dereferenced the pluginextensions/*/node_modules/openclawsymlinks (→/usr/local/lib/node_modules/openclaw) into full OpenClaw package copies. That bloated every archive (the package three times over), timed out the pre-snapshot stage (600s) — surfacing to the dashboard as a backup-createInternal Server Error— and made restore fail becausecpcannot overwrite the image’s symlink with a directory (cp: cannot overwrite non-directory … with directory), leaving the tenant looping on a failed restore (staging-client-dev). The stage and the restore materialization now usecp -a(preserve symlinks); the restore additionally removes any destination symlink the stage replaces with a real directory first, so backups created by the old dereferencing stage still restore. Tests:src/persistence.test.ts; corpustest/business-rules/operational-modes.txt. Also: the admin API client (src/client/api.ts) now reads the response body once and surfaces a plain-text platform error (e.g.Internal Server Error) instead of throwingUnexpected token 'I', "Internal S"... is not valid JSON; testssrc/client/api.test.ts. - Recurring-error hardening: credential redaction, bounded-RPC cleanup, live-gateway logs, and idempotent WS teardown. Investigation of the recurring
ReadableStream received over RPC disconnected prematurely/[WS] Client errortelemetry found four concrete causes. (1) Credential logging: the catch-all proxy logged the full forwarded header map (Object.fromEntries(httpHeaders.entries())), writing CF Access JWT/assertions, cookies, and the tenant metadata blob to Workers Logs; it now logs only an allowlisted subset (safeHeaderLog,src/utils/logging.ts). (2) Late container RPCs: a boundedcontainerFetch/wsConnectwhose timeout won could still settle later with a live body/socket that was never drained/closed;withTimeoutAndCleanup(src/utils/timeout.ts) pluscontainerFetchWithTimeout/wsConnectWithTimeout(src/utils/container-rpc.ts) cancel the late body / close the late socket, applied to the public proxy, diagnostics, and thegateway-apiprobes. (3) Live gateway logs: a running gateway’s SDK log stream never settles, so reading it opened an RPC stream that was later disconnected; a runningGatewayProcess.getLogs()now tails/tmp/gateway-stdout.log, and/debug/processes?logs=true//api/admin/logs?id=refuse a live stream for a still-running process. (4) WS teardown: both peer close handlers recorded the same session metric twice, and a client tab disconnect was logged aterror; a singlesettleSession()now records the metric once and client disconnects log atwarnwith thesessionId. Tests:src/utils/container-rpc.test.ts,src/utils/timeout.test.ts,src/logging.test.ts,src/index.test.ts,src/gateway/process.test.ts,src/routes/api/misc.test.ts,src/routes/debug.test.ts; local observability canarytest/e2e/ad_observability_canary.txt+test/e2e/fixture/observability-query; corpustest/business-rules/operational-modes.txt; docsdocs/TESTING.md. - Two local-E2E self-skip fixes.
provision_and_dispatch’s first scenario (%require) echoed aSKIP:line andexit 1in local mode, so it failed instead of skipping — and because it is%require, that failure skipped every later scenario in the file. It now emits the samePASS: … (skipped - local E2E mode)line andexit 0the other local skips in the file use.p_otel_billing_queueassertedemitted >= 1, but a dev-environment/staging-platform instance is non-billable by design (resolveInstanceDimensions,src/routes/otel.ts): the receiver accepts + ignores approved spans (200) and returnsbillable: falsewithout emitting. The local worker (DEV_MODE=true, no routableWORKER_URL) is always non-billable, so the test now skips onbillable == false(like its existing missing-secret/401skip); the emit path stays asserted by the cloud profile andsrc/routes/otel-traces.test.ts. Corpus:test/business-rules/operational-modes.txt,test/business-rules/dev-expense.txt; docsdocs/TESTING.md. - Local E2E readiness gate accepts a reachable-but-starting Worker.
fixture/server/start-localwaited for/api/healthwithcurl -sf -m 5(60×2s), but a cold boot legitimately answers 503 while the container/gateway starts (the non-waking-health semantics) and the non-passive probe can block on container provisioning — so the gate misread a live-but-starting Worker as dead. Worse, the non-passive probe on every 2s poll re-triggeredrestoreIfNeeded/ensureGateway, launching overlapping R2 restores that abort each other withOperationInterruptedError: ... runtime changed. The gate now probes the fast, non-wakingGET /api/health?passive=1and accepts any HTTP status (200/503/…) via the sharede2e_worker_reachablehelper (test/lib/e2e-helpers.sh), failing only on a connection failure (status000); the window is overridable withE2E_STARTUP_TIMEOUT_SECS(default 120s) and the “local dev server died” check still fails fast. The real gateway wait (startup.ok+readiness.ok) stays in the_setup.txtreadiness step. Tests:src/e2e-helpers.test.ts; corpustest/business-rules/operational-modes.txt; docsdocs/TESTING.md. - Restore failures are logged as structured
persistence.restore.failedevents withbackupId,errorName, anderrorMessage; manual route failures also include the Cloudflare Ray ID asstorage.restore.failed. This keeps the backup identity searchable and correlates async failures to the originating request. Tests:src/persistence.test.ts,src/routes/api/storage.test.ts. - Backup retention is enforced on catalog reads, and restores survive a failed pre-restore
umount. Livefouria-backup-tarjetero-devheld 7 archives undermaxVersions: 3: every snapshot was killed aftersandbox.createBackup()(260 MB) but before its commit, so a later read adopted all 7 as orphans, and every scheduled snapshot after that failed at the legacy stage before its own prune — the cap was only ever applied on the happy snapshot path.reconcileOrphanedBackupsnow runscleanupOldBackupsafter merging, so the invariant holds on every read (getBackupHistoryincluded) and no write/delete happens when the catalog is already within the cap. Restores failed in a loop on[persistence] Restore of … failed: … runShell … restoreIfNeeded: the best-effortumount(|| trueguards the shell, not the exec RPC) threw a cold-start/platform interruption and aborted the restore beforerestoreBackup, keepingrestore-neededand failing the startup barrier. The umount is now caught + logged inrestoreIfNeededandrestoreBackupById; an empty catalog read no longer deletesrestore-needed(a transient reconcilelistfailure silently dropped an operator restore) — the marker clears only after a successful restore. Tests:src/persistence.test.ts(over-cap prune, adopted-orphan prune, no-delete within cap, marker retention, umount-failure restore); corpustest/business-rules/operational-modes.txt; docsdocs/WORKER-DEVELOPMENT.md,docs/OPERATOR-GUIDE.md. - Async admin backup/restore + non-blocking Backups page. A manual snapshot/restore can wait up to the 120s R2 lease and then transfer a large archive; holding the admin HTTP request open surfaced as a bare
500after ~132s (restore) with the error dropped.POST /api/admin/storage/sync?async=1andPOST /api/admin/storage/restore/:id?async=1now acknowledge202 { accepted: true }and run inexecutionCtx.waitUntil(default stays synchronous for the E2E checkpoint).BackupsPagepaints every section independently and reads the fastGET /api/admin/config/rawinstead of the slow structured/api/admin/config(which awaitsensureGateway+ up to two 30s shell waits) — so no single request blocks the page.BackupHistoryPanelfires the async endpoints, pushes a “started” bell notification, then pollsGET /storage/backups(snapshot) //api/health(restore) and pushes success/failure viaNotificationProvider(survives navigation). Restore failures are reported as structuredstorage.restore.failedevents. Tests:src/routes/api/storage.test.ts,src/client/components/__tests__/BackupHistoryPanel.test.tsx,src/client/pages/__tests__/BackupsPage.test.tsx; corpustest/business-rules/operational-modes.txt; docsdocs/WORKER-DEVELOPMENT.md. - Startup-stream and dashboard polling back-off.
/api/startup/wsnow drops the 2-exec startup-progress read and backs off toSTARTUP_WS_READY_POLL_INTERVAL_MS(30s) once the gateway is ready — the 5s cadence plus a per-pushlistProcesses/exec probe burst is a large share of the Sandbox DO control-channel churn (Establishing RPC connection) during a boot.useGatewayHealthnow stops its HTTP fallback polling when a/api/health/wssnapshot arrives (it previously kept double-polling after the socket recovered).transformErrorMessagemaps the gateway’s1008 device token mismatchclose to a “re-open/_admin/to re-approve this browser” message instead of a reconnect loop. Tests:src/client/hooks/useGatewayHealth.test.tsx; corpustest/business-rules/operational-modes.txt. - Backup local-bucket mode is decoupled from
DEV_MODE.isLocalBucketDevMode()keyedcreateBackup({ localBucket })onprocess.env.DEV_MODE, and withnodejs_compat_populate_process_envthe cloud E2E’sDEV_MODE=truevar (set only to bypass Access on a bareworkers.devhost) made every E2E snapshot land in the Sandbox local binding bucket — invisible to the Worker’sBACKUP_BUCKETHEAD, so restore loggedBackup <id> missing from R2and booted without tenant state. It is nowisLocalBucketBackupMode(env): an explicitBACKUP_LOCAL_BUCKET=trueopt-in that falls back toDEV_MODEonly when unset; the E2E deploy pinsBACKUP_LOCAL_BUCKET=false.resolveRestoreEntrythreadsenvthrough. Tests:src/persistence.test.ts(explicit override wins); corpustest/business-rules/operational-modes.txt; docsdocs/ENV-VARIABLES.md,docs/OPERATOR-GUIDE.md,docs/WORKER-DEVELOPMENT.md,.dev.vars.example. - A dropped port probe no longer spawns a duplicate gateway. When the DO↔container control channel flapped (
Network connection lost.on everyexec),ensureGatewayImpl’s prelaunchisGatewayPortOpenResilientthrow was treated as “gateway absent”, so it re-ranstart-openclaw.sh starton each request even thoughlistProcessesmatched the gatewayrunning— piling lock contention and RPC load onto the unhealthy channel. A transport-classified probe failure is now “unknown”: the Worker logsPort probe transport drop …and returns without spawning, retrying on the next request. Test:src/gateway/process.test.ts(ensureGateway transport-drop resilience); corpustest/business-rules/operational-modes.txt. - E2E
ac_gateway_startup_concurrencyaccepts the 503 cold-boot health response. The concurrent non-passive/api/healthfan-out usedcurl -f, which fails on any non-2xx, but/api/healthanswers 503 whilestarting(JSON snapshot present) since the non-waking-health change — so a healthy cold boot always reportedprobes_ok=0. The probes now accept200/503with a shaped{startup, readiness}body; the ready-wait and single-owner assertions are unchanged. Docs/corpus updated. - Sandbox→R2 bridges resolve the tenant from the per-tenant Worker env, not the fixed sandbox id. The
leads.r2.internalanddocs.r2.internalbridges (src/sandbox-leads-bridge.ts,src/sandbox-docs-bridge.ts) scoped every path to the caller’s<slug>/usingctx.containerId, but production provisions the sandbox under the fixed idopenclaw(getSandbox(..., 'openclaw')insrc/index.ts,src/tasks/index.ts,src/activity/scheduler.ts), so listings resolved toopenclaw/and always returned empty. AddedresolveTenantSlug/tenantSlugFromEnvinsrc/sandbox-tenant.ts: an explicitcustomer-<slug>container id still wins (legacy multi-tenant), otherwise the slug is derived from the per-tenant Worker env —CUSTOMER_SLUG,WORKER_NAMEviaderiveCustomerSlug, or the always-provisionedWORKER_URLhostname (stripstenant-/staging-prefixes and the-devsuffix, sotenant-tarjetero-dev/https://tarjetero-dev.fouria.io→tarjetero). Tests:src/sandbox-tenant.test.ts,src/sandbox-leads-bridge.test.ts,src/sandbox-docs-bridge.test.ts; corpustest/business-rules/tenant-isolation.txt; docsdocs/WORKER-DEVELOPMENT.md. - Crash-consistent backup cataloging (issue #344). The scheduled
backupcontrol action runs the full snapshot orchestration inside one tenant request and could exceed the Worker CPU budget aftersandbox.createBackup()had uploadedbackups/<id>/…but before the handle was written — leaving an orphaned snapshot, a missingbackup-handle.json(and emptyconfigs/), a livebackup-lock, and a dispatch[cron] Failed to trigger backup.createSnapshotUnlockednow commits the catalog entry immediately after the archive is created (after encryption, before the config-version capture and retention prune), andreconcileOrphanedBackupsrebuilds entries frombackups/*/meta.jsonon read (getBackupHistory,restoreIfNeeded,scheduleBackupIfNeeded) so pre-existing orphans self-heal and stay restorable. The Dispatch Worker gives thebackupaction a dedicated CPU budget (BACKUP_CONTROL_CPU_MS) and logs the underlying error on a thrown control fetch. Tests:src/persistence.test.ts(commit ordering, config-save failure, reconciliation),workers/fouria-dispatch/test/unit/control.test.ts,cron-fanout.test.ts; corpustest/business-rules/operational-modes.txt; docsdocs/OPERATOR-GUIDE.md,docs/WORKER-DEVELOPMENT.md. - Transport-resilient backup stage (issue #344 follow-up). The pre-snapshot legacy-stage shell now waits via
runShellResilient(→waitForExitResilient): a transient Sandbox DO↔container transport drop mid-stage reattaches to the process by id and resumes within the stage deadline, instead of ending the/controlbackup request (observed onstaging-client-dev: the stage ran ~5 min then the request ended with aNetwork connection lost.drop and noCreating backup...). The DispatchbackupCPU budget (BACKUP_CONTROL_CPU_MS) is raised 300s → 600s to match the 10-minute stage bound. Tests:src/persistence.test.ts(transport-drop retry); corpustest/business-rules/operational-modes.txt; docsdocs/OPERATOR-GUIDE.md,docs/WORKER-DEVELOPMENT.md. - Legacy-stage backup robustness + diagnosability (issue #344 follow-up). The scheduled
backupstage shell (stageLegacyRootsForBackup→runLegacyStageShell) copies/root/openclaw/.openclaw+/root/clawdwithcp -aLand runs anode:sqliteonline backup; on a large tenant it exceeded the old 300 s bound and killed the backup (tenant-tarjetero, observed at exactly 300 s).LEGACY_STAGE_TIMEOUT_MSis now env-overridable (default600000/ 10 min), the idempotent stage is retried once on a transient timeout/transport failure, and stage failures logexit/timedOut/stderr plus a structuredsandbox.process.failedWorker event withprocessIdand a stable operation label. The process id joins Worker Logs to the Containers dataset without exposing the raw command/output. Tests:src/persistence.test.ts(retry, no-retry, timeout override, error logging); corpustest/business-rules/operational-modes.txt; docsdocs/OPERATOR-GUIDE.md,docs/WORKER-DEVELOPMENT.md,docs/ENV-VARIABLES.md. - Sleeping tenants + non-waking health.
/api/healthnow answers 503 unless the gateway is ready, and a passive probe (?passive=1) short-circuits on the non-wakingisRuntimeActive()read and reportsstatus: "sleeping"(HTTP 200, healthy-idle) for an idle container instead of running the exec RPCs that auto-start it — so Lerma’sHealthMonitor(which now probes?passive=1) never wakes a tenant. Non-billable tenants (staging 15m, dev 2h) sleep per a derived idle timeout (the Sandbox SDK 1.0setInactivityTimeout()platform cap; there is noSANDBOX_SLEEP_AFTERbinding; the value comes from the instance hostname viasrc/dev-mode.ts), and theActivitySchedulerDO alarm wakes/heals ahead of the next automation and runs an interval-gated R2 checkpoint after the wake. Billable production (platform === 'production' && environment === 'production') does not auto-sleep; the container stays awake and is stopped only by an explicit lerma freeze (POST /control→sandbox.destroy()), so a warmed gateway never incurs a cold-start/downtime window after an idle period. Runtime cutover is gated bySANDBOX_RUNTIME(legacydefault |v1);SandboxV1is still scaffold-only, soresolveSandboxRuntime()reportsv1aspendingand the legacy class keeps serving (src/sandbox-runtime.ts). Tests:src/routes/public.test.ts,src/gateway/health-probes.test.ts,src/activity/alarm.test.ts,src/sandbox-runtime.test.ts,src/sandbox-do.test.ts,src/build-sandbox-options.test.ts; corpustest/business-rules/operational-modes.txt; lermahealth_monitor_test.exs,health_poller_test.exs,tenant_provisioner_pipeline_test.exs. See docs/WORKER-DEVELOPMENT.md. - Single-owner gateway launch (
start-openclaw.sh start): the production cold-start mode acquires the container-wide startup lock before config setup and holds fd 9 through the Gatewayexec, so one owner covers setup and launch. The lock is inherited by the gateway process and released exactly when it exits, so only one owner can run — the OpenClaw 2026.9.8 state-DB single-owner migration otherwise caused concurrent launches (from different Worker isolates) to lose the migration, exit before binding the port, and leave the boot forever unhealthy (state.sqlite is undergoing offline maintenance). Losers poll the local/health(bounded) and exit 0 without a duplicate launch, or take over if the owner dies and releases the lock; the log-mirrortail -fcloses fd 9 (9>&-) so it cannot hold the lock. Thelaunchmode remains a standalone smoke/manual entry point with its dedicated/tmp/openclaw-gateway-launch.lock;fullroutes through the same lock inbackgroundmode. Regression: the serialtest/e2e/ac_gateway_startup_concurrency.txt(phaseD_startup) asserts exactly one owner and the absence of both the migration-input-change error and the SQLite offline-maintenance error. See docs/WORKER-DEVELOPMENT.md. - Fixed the develop cold-boot stall introduced by #318 (
startup.ok=false / readiness.ok=falsefor the whole E2E readiness budget; 68 processes,start-openclaw.sh setupexited 0,curl /healthalways exit 7, noopenclaw gateway runever present). Root cause: #318 had split the boot so the Worker launched the gateway afterstart-openclaw.sh setupexited (supervised exec) — this was the former behavior; current production collapses setup and launch into the atomicstart-openclaw.sh startdescribed above (startup lock acquired before setup, held through the Gatewayexec)./api/healthis bounded to a 5s snapshot, so the request returned long before the ~24s setup finished; when the response was sent, workerd cancelled the unregisteredensureGatewaycontinuation, so the container-side setup completed but the Worker never resumed to launch the gateway. Fix:/api/health(and/api/warmup) now register the in-flight boot withc.executionCtx.waitUntil(ensureGateway(sandbox, env, { waitForReady: true }))so the setup → gateway-launch sequence survives past the response;waitForReady: truereturns the shared start promise unwrapped and dedupes onto the one the snapshot already started. Also hardened the RPC-first health probe (getRpcHealthSnapshot,src/gateway/health-probes.ts) to run only once a gateway process is detected —sandbox.containerFetchauto-starts the container and blocks on the closed gateway port during a cold boot, piling port-waits on the Sandbox DO control channel.buildHealthSnapshot(src/routes/public.ts) passes its already-fetchedfindGatewayProcessresult as{ proc }. Bisected: production E2E boot green atad9ad4a5(#317), red at9ae5f66c(#318). Seeapps/fouria/docs/WORKER-DEVELOPMENT.md§Admin RPC. - Startup resilience to Sandbox DO code updates: a Worker/DO redeploy (e.g. a Lerma redeploy of a tenant script) resets the DO↔container control session while the container keeps running, so the supervised
waitForPorton the atomicstart-openclaw.sh startprocess rejected withNetwork connection lost.and the cold start was aborted — killing a gateway that would have completed. The atomicstartpath has no separate setup-process wait (one supervised process spans config setup through the gateway’s whole life), so only the port wait is transport-resilient:ensureGatewaywaits withwaitForPortResilient(src/gateway/sandbox-exec.ts), which reattaches to the process by id viagetProcess(id)and resumes the wait within the sharedSTARTUP_TIMEOUT_MSdeadline; only a non-transport error, an un-reattachable process, or an exhausted deadline fails. The genericwaitForExitResilienthelper remains insandbox-exec.tsfor the legacy/boot-smoke supervised waits. The loading page’sGET /api/startup/wsstream also treats a transport-drop snapshot as transient: it re-sends the last known state (or a syntheticstartingview) and backs off exponentially (STARTUP_WS_POLL_INTERVAL_MS→STARTUP_WS_MAX_BACKOFF_MS, 30s) instead of re-probing and re-logging the same error every 5s. - Backups run only on running instances; health is observability-only.
GET /api/healthno longer schedules snapshots (passive or active) — the lermaHealthMonitoris a pure probe and MUST NOT alter the R2 catalog. The Dispatch Worker cron (workers/fouria-dispatch, 15 min prod / hourly staging) fans abackupcontrol action (POST /control,X-FourIA-Control: backup) out to every non-frozen tenant; the tenant assertssandbox.isRuntimeActive()(a non-waking bridge read) and skips a sleeping container rather than waking it (an idle instance has no workload or filesystem changes, and waking would restart billing), then runs the interval/lock-gatedscheduleBackupIfNeeded.POST /debug/reprovisionnow checkpoints only a live runtime, bounded byREPROVISION_CHECKPOINT_TIMEOUT_MS, verifies restorability by HEADing the newest catalog entries’meta.json, and fails closed (409) unless a restorable backup exists;{"force":true}overrides for an already-unrecoverable container. Root cause of the empty buckets: the old health-triggered path scheduled a snapshot regardless ofreadiness.ok, so a booting/stopped container could startsandbox.createBackup(), hang, and leave a stalebackup-lock(observed infouria-backup-tarjetero); dev instances the HealthMonitor does not monitor had no trigger at all. Tests:src/routes/public.test.ts,src/routes/debug.test.ts,src/index.test.ts,workers/fouria-dispatch/test/unit/control.test.ts; corpustest/business-rules/operational-modes.txt; docsdocs/OPERATOR-GUIDE.md,apps/fouria/docs/WORKER-DEVELOPMENT.md,docs/CLOUD-ARCHITECTURE.md,workers/fouria-dispatch/README.md. E2E:test/e2e-backup/zz_reprovision_guard.txt+test/e2e-backup/zzz_backup_cold_restore.txt+test/e2e-backup/zzz_backup_semantics.txt(separatetest/e2e-backup/corpus, excluded from the defaulttest/e2erun; run locally withbun run test:e2e:backup; registered inphaseE_restore, reprovision guard first), the dispatch fan-out unit testworkers/fouria-dispatch/test/unit/cron-fanout.test.ts, deterministic E2E backup env intest/e2e/fixture/server/deploy, andPOST /_control/:slug/backupon the dispatch worker; design intest/e2e/BACKUP-E2E-DESIGN.md. Dispatch note:vitest.config.tsnow hasunit(node) +integration(workerd) projects so the fan-out logic is testable without Miniflare. - PR E2E scope: the
e2ejob now setsE2E_BOOT_ONLY=1for pull requests, sorun-parallel.shprovisions the worker and only asserts the gateway reachesstartup.ok + readiness.ok, then tears down without running any cctr group.developand a manualworkflow_dispatch(newfull_testsinput, default checked) run the full corpus. Seeapps/fouria/test/e2e-parallel/run-parallel.shanddocs/TESTING.md. - Setup serialization (
start-openclaw.sh):start,setup, andfulltake an exclusiveflockon/tmp/openclaw-setup.lock(~900s wait;OPENCLAW_SETUP_LOCK_TIMEOUToverride) right after the gateway fast-path, then re-check the fast-path and exit 0 if a concurrent invocation brought the gateway up while they waited. In production,startacquires this lock before the setup body and holds it through the Gatewayexec, so one owner serializes setup and launch. The Worker’sgatewayStartPromisesguard is per-isolate, so an E2E cold-start burst lands several runs in different isolates at once; without the lock they ran the slow setup body concurrently, contended on OpenClaw’s native config/state locks, and stalled cold start for ~18 min (run 36692775633 —[SandboxRecovery]never fired because the admission-failure streak is also per-isolate).fullreleases fd 9 before backgrounding the gateway so the child does not inherit the lock;post-startis outside it. Degrades to the previous unserialized behaviour whenflockis absent. - Native supervised gateway launch (
src/gateway/process.ts): the Worker’s production cold start is one atomic supervisedsandbox.execofstart-openclaw.sh start, which acquires the container-wide startup lock before the setup body (R2 restore → onboard → plugin installs →moltlazy patch) and holds it through the gatewayexec—/bin/bash -lc 'touch /tmp/gateway-stdout.log; pgrep … || ( tail -f … & ); exec openclaw gateway run … >> /tmp/gateway-stdout.log 2>&1'— instead of the script backgrounding it with&.execreplaces the bash wrapper so the supervised process is the gateway (listProcesses/getProcesstrack it for the life of the container;kill()targets it directly); the guardedtailstarts the container-stdout log mirror as a sibling (safe because the Worker neverwaitForExits on the gateway handle), and the redirect preserves the ops-readable log file. After the port is ready the Worker dispatchesstart-openclaw.sh post-start(dev automation + boot-log reset, best-effort) detached (void, not awaited) on every cold start — the gateway is already serving, so post-start must not extend the shared start promise (dev instances runopenclaw automations list/createthere, 30–60s, and awaiting it left every request loggingGateway start already in progress … waiting...while/healthalready returned 200); because it is dispatched unconditionally, a/api/health-triggered boot (waitForReady:false) still creates the dev automation even though its caller returned early.start-openclaw.shgainssetup/post-startmodes; the defaultfullmode keeps the legacy background launch for manual runs andtest:gateway:boot. A sharedSTARTUP_TIMEOUT_MSdeadline bounds setup + port wait;launchWithRecoverycentralizes the stale/orphan/transport retry policy shared by both phases. Thesetup/post-startphases must stay child-free: the SDK’swaitForExitonly settles once the supervised terminal exits, which never happens while the script leaves a live background child (atail -flog mirror or a backgroundcloudflaredthere stalled every cold start for the fullSTARTUP_TIMEOUT_MS, re-running setup until the ~11-minute mark). The mirror is started by the native launch; cloudflared is detached withsetsid. Never calloutput()/runShellon the live gateway handle (it never exits): read diagnostics from the/tmp/gateway-stdout.log//tmp/startup.logtails instead (readLogTail). - All three ClawHub plugins (
cloudflare-ai-gatewayprovider,diagnostics-otel,cloudflare-unified-billing) are pre-installed into the container image at Docker build time (unpinned → latest ClawHub release; capability consent recorded in the image). This moves the per-boot network installs off the latency-critical startup path:start-openclaw.shdetects them via the extension dir +plugins listand only falls back to a ClawHub install when that state is missing (e.g. a warm R2 restore replaced it). The Dockerfile does not copy the Paso4 plugin source — it downloads the published ClawHub artifact — so the image stays source-free. The plugin’s source and tests now live in Paso4/openclaw-plugins (removed from this repo); see docs/OPENCLAW-PLUGINS.md. Runtime enablement is written by a single workingconfig patchthat also enablesadmin-http-rpcand disablesdiagnostics-otelunless its endpoint is set (the patch must not carryplugins.bundledDiscovery— removed in 2026.9.x, it fails validation and drops the whole patch — norplugins.allow, which disables every bundled provider not listed). Memory search is disabled via the top-levelmemory.search.enabled=false(the oldagents.defaults.memorySearchkey is gone in 2026.9.x). Measured local cold boot: 35s vs 56s before - Gateway restart split:
POST /api/admin/gateway/restartis the soft reload — sendsSIGUSR2to the liveopenclaw gateway runprocess (in-process, no connection drop, no port rebind) viasoftReloadGatewayand falls back tosignalRestoreNeededonly when no live gateway is found;POST /debug/restart-openclaw(DEBUG_ROUTES=true, ROOT) is the hard restart —killGateway+resetStartupCache+signalRestoreNeeded+start-openclaw.shreprovision (in-place, nostartGatewayDirect) so existing client tokens keep working.SIGUSR1is not a restart signal (it opens Node’s inspector on127.0.0.1:9229); the E2En_gateway_soft_reload.txtasserts the inspector stays closed after a soft reload. The reload targets the server, not theopenclaw gateway runlauncher:buildSoftReloadScriptsignals the exactcomm(pgrep -x 'openclaw-gatewa', Linux 15-char truncation, plus a defensiveopenclaw-gateway), because signalling the launcher kills it and orphans the server without restarting it (readiness never dips while the endpoint still reportsreloaded: true). The E2E therefore requires both a stable/api/status.processIdand an increasedhttp server listeningcount, sinceprocessIdalone survives a broken reload. Issue #463:OPENCLAW_NO_RESPAWNstays — removing it cannot enable process-level restarts inside a container (see the decision record indocs/plans/sandbox-memory-usage.md) OPENCLAW_NO_RESPAWN=1is set in the Dockerfile as explicit intent only: inside a container OpenClaw already resolves restart mode to in-process (isContainerEnvironment()→disabled/unmanaged), so removing the flag cannot enable process-level restarts or reclaim memory (#463);softReloadGatewayonly signals live processes and skips zombies- Sandbox SDK 1.0 preview (
@cloudflare/sandbox@0.13.0-next.776.1+cloudflare/sandbox:0.13.0-next.776.1image):startProcess/execStream/getLogs()andSANDBOX_TRANSPORTare gone. All command execution goes throughsandbox.exec(argv)(which resolves on launch, not completion);src/gateway/sandbox-exec.tscentralizes the shapes (startShellfor a handle,runShellfor buffered output,outputOf,collectLogs).listProcesses()now returnsProcessStatus[](.state, argv.command) and a live handle is fetched viagetProcess(id);findExistingGatewayProcessreturns aGatewayProcesswrapper.waitForProcessdelegates towaitForExit({timeout})and kills on timeout.SandboxOptions.labelswas removed upstream. Deploy cutover requireswrangler deploy --containers-rollout=immediate(stable/1.0 control protocols are incompatible) - Stale sandbox recovery (
src/gateway/sandbox-recovery.ts): when the platform terminates the container behind a live Sandbox DO, every RPC fails withsandbox.exec error … HTTP error! status: 500—isStaleContainerErrorclassifies these andrecoverStaleSandboxdestroys the dead instance + resets startup/persistence caches so the next RPC auto-provisions a fresh container; wired intofindExistingGatewayProcess,checkGatewayHealthand theensureGatewaystartShellretry; cooldown-guarded (60s), never fires for deployOperationInterruptedErroror transient provisioning errors. It also matches the control-protocol mismatch ('utils.getRuntimeMetadata' is not a function,activateControlSession,RuntimeControlProtocolError) seen during a deploy cutover while the still-running container predates the new SDK’s control handshake — the SDK logs asandbox.exec error …line but re-throws the bareTypeError, so the message patterns are matched directly and the stale instance is reprovisioned instead of failing until the platform rollout replaces it - Orphaned-instance recovery (
src/gateway/sandbox-recovery.ts): a container destroyed out-of-band (Cloudflare Containers dashboard “Destroy”, failed force-stop) leaves the DO alive pointing at a dead placement and surfaces the SDK’s retryable admission errors (no container instance available,max container instances exceeded) instead of the 500 signature.isContainerUnavailableError+trackProvisioningFailureescalate to a recovery only once the streak reachesORPHANED_INSTANCE_MIN_FAILURESand spansORPHANED_INSTANCE_GRACE_MS(120s, > the SDK’s ≈110s provisioning budget, so slow-but-healthy cold starts are never cancelled);maybeRecoverSandboxunifies both failure classes and clears the streak whenever a sandbox RPC succeeds. Operator lever:POST /debug/reprovision(DEBUG_ROUTES, ROOT) destroys the instance + clears caches + resets the streak without touching the gateway, so it works when the container is entirely gone - Activity-driven wake (
src/activity/): automations run inside the Gateway, so it must be running for schedules to fire. A per-tenantActivitySchedulerDurable Object (bindingACTIVITY, SQLite-backed, separate from the SDKSandboxDO whose alarm drivessleepAfter) mirrors the tenant’s schedule (openclaw automations list --json, refreshed on warm/api/healthwhenreadiness.ok, throttled to 5 min) and arms one alarmCRON_WAKE_AHEAD_MINUTES(default 10) before the next enabled job. On fire it wakes + heals viaensureGateway(recovering an orphaned instance) then re-arms; no enabled jobs → alarm cleared → container sleeps. Healing/wakeup is independent of user traffic, gated on job activity, and free when idle (src/activity/alarm.tsstate machine is unit-tested; the DO is a thin adapter). Requires theACTIVITYbinding inwrangler.jsonc+ lerma (tenant_provisioner.exresource_bindings,dispatch_namespace.ex@do_sqlite_classes) - Container image build profiles: the Dockerfile takes a
BUILD_PROFILEbuild arg (defaultproduction→ slim, onlyxz-utils;dev→ adds the optionalpandoc+weasyprintPDF/document stack, ~760 MB, used by the dev-only Fouria Builderfouria-leadsskill). The profile is selected per wrangler environment viaimage_vars(equivalent todocker build --build-arg):env.staging(dev/test) setsdev;env.productionand the default/local config keep the slim default. The release CD builds the slim default, and the E2Ebasic(PR) andproduction(develop) profiles both provision the slim production image on the samestandard-2instance (differ by env only) - Sandbox → leads R2 bridge (
src/sandbox-leads-bridge.ts,leads.r2.internal): thefouria-leadsskill now reaches the globalpaso4-leadsbucket through the SandboxoutboundByHostbridge (plain HTTP resolved in the Workers runtime with theLEADS_BUCKETbinding — no R2 creds in the container, no public route) instead of the publicwss://<worker>/api/leads/wsproxy. The proxy is intercepted by Cloudflare Access on tenant hostnames (a per-tenant Access app shadows the*.fouria.io/<path>apps — confirmed via the login redirect’skid) and is retained only for the host-side E2E fixture. Related: lerma’sHealthMonitornow probes withredirect: false, so a shadowed/api/health302 (Access login page) is surfaced instead of being followed and misreported as healthy - Client docs hardening + operations (dev-only): tenant-isolated the
leads.r2.internalbridge (src/sandbox-leads-bridge.tsresolves the caller slug via the sharedsrc/sandbox-tenant.tsresolver and treats every agent path as relative to<slug>/, so a sandboxed agent can only reach its own proposal; the sharedbuild-pdf.shstays read-only). Added the Admin Client Docs page (/_admin/docs, ADMIN, dev-only) + the extendedsrc/routes/api/fouria-docs.tsmanaging docs (customers/<slug>/docs/) and leads directly from the Worker (no CLI) with markdown rendering (marked+DOMPurify), native-browser PDF opening via/raw, and multipart uploads; HTML/SVG raw downloads are forced toattachment+ sandbox CSP. Added Worker-side git-like versioning (DocsGitStore: content-addressed blobs/commits/refs,GET /commits,POST /rollback/:shaas a non-destructive revert) and backups (DocsBackupStore:POST /backup,GET /backups,POST /backups/:id/restore, retention 10). Seedocs/WORKER-DEVELOPMENT.md§“Client Docs (dev-only admin surface)” ECONNRESETfrom the sandbox R2 bridges fixed: the tenant’sLEADS_BUCKETwas provisioned as a plain-text var (the bucket name) instead of anr2_bucketbinding, soenv.LEADS_BUCKETwas a string,bucket.list()threw inside theoutboundByHosthandler, and the escaping exception surfaced to the container as an opaqueECONNRESET. Two fixes: (1) the bridges (leads/docs/releases) now validate the binding withisR2Bucket(src/r2-binding.ts) and wrap their bodies in try/catch, returning a structured JSON503/500instead of resetting the socket; (2) lerma (instances.exinstance_bindings/2, configLEADS_R2_BUCKETdefaultpaso4-leads) now provisionsLEADS_BUCKETas anr2_bucketbinding on every tenant worker (redeploy existing tenants to replace the stray var)- Admin RPC-first read path (
src/gateway/admin-rpc.ts): the hot dashboard reads/writes now go through OpenClaw’s bundledadmin-http-rpcplugin (POST /api/v1/admin/rpc) oversandbox.containerFetch, reusing the typedmoltlazy/sdkHTTPRpcClient(which gained an injectablefetcher). This removes the ~10–15s per-call CLI spawn/WS-reconnect onGET /api/admin/devices,POST .../approve,GET /api/admin/models, andGET /api/admin/channels/probe(measured locally: ~1.3–2.5s CLI → ~30–40ms RPC), each of which keeps its CLI path as a fallback (createAdminRpcClientreturns null / throws → existing parser runs).start-openclaw.shenables the plugin with a dedicatedplugins.entries["admin-http-rpc"].enabled=truepatch — NOTplugins.allow, which disables every bundled provider not listed (and the nearby batched plugin patch is rejected upstream for the removedplugins.bundledDiscoverykey).src/index.tsshadows/api/v1/admin/rpcwith a 404 before the public catch-all proxy so the operator surface stays container-local. The home-grownmoltlazy/sdkWebSocket client is intentionally not used for admin RPC - Gateway WebSocket RPC (
src/gateway/gateway-rpc.ts): methods outside theadmin-http-rpcallowlist (notablyaudit.activity.list) are reached with OpenClaw’s official@openclaw/gateway-client/browserreference client +@openclaw/gateway-protocoltypes, bridged oversandbox.wsConnectand authenticated with the shared gateway token as anoperator. The wire-v4 handshake (connect.challenge→connect→hello-ok) is owned by the official client; the connect frame’sclient.versioncomes from__OPENCLAW_VERSION__, injected byvite.config.tsfromcatalog.openclaw. RPC-first with CLI fallback:GET /api/admin/audit-logs(audit.activity.list) and the agent board (agents.create/agents.delete/agents.update, model viaconfig.patch).GET /api/admin/integrationsis deliberately WebSocket-free (the gateway drops these sockets): channels/agents over the admin HTTP RPC, plugin enabled-state fromconfig.get, toggles/config viaconfig.patch, secrets reload via the CLI.theme, agent bindings,secrets.apply, andchannels list --allhave no RPC method and stay on the CLI. The two packages are pinned incatalog.@openclaw/gateway-client/catalog.@openclaw/gateway-protocoland must trackcatalog.openclaw - Realtime device-pairing notifications (
src/gateway/gateway-rpc.tsopenGatewayEventStream,src/routes/api/devices.tsGET /ws): the dashboardNotificationBellnow subscribes toGET /api/admin/devices/ws, which pushes an initial{ pending, paired }snapshot then relays Gatewaydevice.pair.*events (reconnecting via the official gateway client oversandbox.wsConnect). Admins approve/reject pending devices inline from the bell viaPOST /api/admin/devices/:requestId/approve/.../reject(RPC-first; the reject route was added). Also fixedsecrets applyinvocations (integrations/dreaming): current OpenClaw removed--yes(only--from,--dry-run,--allow-exec,--json) - CLI→RPC sweep (finishing the RPC-first migration):
configset/unset useconfig.patch;dreamingconfig writes useconfig.patch(sharedpatchConfigViaRpcinsrc/routes/api/shared.ts);secrets.reloaduses the WSsecrets.reload; andresolveAgentFlag(used bymodels/knowledge) resolves the roster viaagents.listinstead ofopenclaw agents list. CLI fallbacks are retained everywhere. Remaining CLI-only paths have no Gateway RPC method:secrets apply/audit,openclaw wiki *, agentbind/unbind/bindings, andopenclaw --version
Release notes for the fouria tenant Worker. Entries are generated by
scripts/release.mjs from the conventional commits that touched apps/fouria
since the previous CalVer tag.