RFC 0013 addendum: application-consistent recovery for scale-to-zero - #46
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ad92a900-c04a-45b7-9276-3765ae97b1d3
|
Hey @vincentkoc — this is the small follow-on referenced from #20. The review question is only the ownership split:
We are holding implementation until that boundary is accepted. The earlier RFC 0021 / twelve-PR design is now retained only as evidence, not proposed as the path forward. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 10:41 AM ET / 14:41 UTC. ClawSweeper reviewWhat this changesThe branch adds three RFC 0013 follow-on specifications for composing recovery points, accepting a final handoff, and keeping Gateway work admission closed until an accepted recovery point has been restored and verified. Merge readinessKeep this PR open. It is a clean, documentation-only RFC addendum stacked on the still-open RFC 0013 proposal, and it introduces a proposed public Gateway restore-status contract that needs explicit protocol and product approval rather than cleanup closure. Priority: P3 Review scores
Verification
How this fits togetherRFC 0013 defines SQLite-safe snapshot artifacts, while these sidecars describe how a host and OpenClaw can compose those artifacts during planned handoff and scale-to-zero recovery. Hosts provide durable acceptance, retained ingress, and compute placement; Gateway recovery and readiness evidence determine when normal work may resume. flowchart LR
A[Gateway tracked work] --> B[Source writers closed]
B --> C[Recovery point captured]
C --> D[Host accepts exact artifacts]
D --> E[Fresh Gateway restore]
E --> F[Owner and scheduler readiness]
F --> G[Work admission opens]
Decision needed
Why: The patch is documentation-only and has no definite implementation defect, but it proposes externally visible Gateway behavior and a long-lived compatibility boundary; that contract choice cannot be settled by mechanical review. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept or narrow the host/runtime responsibility split with the Gateway protocol owner, preserving the SQLite snapshot contract as the parent boundary and treating any public restore-status API as an explicitly approved additive follow-on. Do we have a high-confidence way to reproduce the issue? Not applicable: this is an RFC documentation proposal, not a report of a current runtime failure. Its linked implementation PRs are supporting evidence, but the proposed contract itself requires design review rather than bug reproduction. Is this the best way to solve the issue? Unclear: the sidecar split is a coherent way to keep host lifecycle authority outside the SQLite snapshot contract, but the public AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 593e6e46632b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (21 earlier review cycles; latest 8 shown)
|
a7f4d17 to
d075a24
Compare
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
Summary
Defines the application-consistency contract a host needs to scale OpenClaw
compute to zero and later admit work on a replacement. It adds three optional,
host-neutral lifecycle specifications to the completed RFC 0013 SQLite
snapshot contract:
Together they define the application-consistency proof a host needs before it
can safely replace a Gateway generation or remove idle compute. They do not
define a new snapshot implementation, pause API, storage provider, or wake
system.
This PR is stacked on RFC PR #20.
RFC 0013 and
openclaw/openclaw#105718
remain authoritative for one-database SQLite snapshot creation, verification,
local publication, and fresh-target restore.
Why This Is Needed
Per-user and event-driven hosts can scale resident compute to zero only if they
can prove all of the following:
required owner state were restored.
A verified SQLite snapshot proves none of those aggregate lifecycle facts by
itself. Without a shared contract, hosts must either keep idle Gateways warm or
maintain private shutdown, copying, restore-ordering, and readiness-inference
paths.
The motivating managed-host deployment already has durable ingress and cron
wake machinery. Its production issue cluster includes accepted work outliving
the compute that should process it, cold-start head-of-line blocking, cron wake
racing idle retirement, scheduler continuity failing after replacement, and
cold runtimes appearing ready before the required owner state is restored.
OpenClaw's broader state-ownership risk is also tracked in
openclaw/openclaw#101290.
The complete user/operator case, including missed recurring work, competitor
scale-to-zero primitives, and Microsoft Scout's host-side composition, is
tracked in
openclaw/openclaw#114145.
Industry Baseline And OpenClaw's Missing Layer
Infrastructure and sandbox platforms already expose the compute primitives:
Those systems cannot infer OpenClaw's complete owner inventory, SQLite
invariants, scheduler state, or restored-readiness boundary. This addendum
defines that application-consistent layer. Retained ingress, wake registration,
compute placement, and external durability remain host responsibilities.
What Changed From The Earlier Continuity Direction
The sidecars compose contracts already shipped on OpenClaw
main:openclaw backup sqlitefrom#105718; and
gateway.suspend.prepare|status|resumefrom#103618, including
Vincent's validation repair in
#103925.
They replace the earlier broad continuity direction rather than adding another
SQLite capture path, Gateway pause API, provider framework, Lobster transport,
CAPE configuration surface, or Elastic wake mechanism.
The suspension contract remains a cooperative tracked-work fence, not full
process quiescence. The host still owns external ingress fencing, third-party
Channel transports, unregistered work, process supervision, encryption,
retention, placement, and wake.
Closed Boundaries
missing and extra components fail closed, and the inventory is covered by
the recovery-point identity.
host-protected. They cannot be calledcredential-free portable without exact owner-authored portability receipts.
secret values.
owner-manifest and artifact byte sequence. Packaging and paths remain
host-owned.
restored-start, and ready evidence. When RFC 0018 canonical readiness is
available and enabled, it projects that same evidence without adding a
second evaluator.
The lifecycle facts are deliberately separate:
There is no global
/syncedstate. Each fact has a different owner, subject,lifetime, and failure boundary. The diagram is the success path, not an
unconditional linear workflow: retained work may race retirement, atomically
revoking it while source compute exists or joining the destination wake after
retirement.
Observable Outcome Of The Complete Composition
recovery point.
unrelated user message.
These are system-level acceptance criteria. The three current OpenClaw PRs
prove only the owner-side recovery-point, final-capture, and restored-admission
slices; they do not claim to complete host acceptance, retained ingress, wake,
or source-compute retirement.
One Contract, Two Directions
The lifecycle can be presented as one bidirectional host/runtime contract
without putting host lifecycle authority in OpenClaw. OpenClaw supplies the
running-source suspension methods, offline final-capture and accepted-restore
operations, and the restored-readiness fact. The host supplies durable
acceptance, compute generations, retained wake, placement, and source-compute
retirement.
This is a protocol boundary, not a generic base class or new callback
framework. A host may compose it behind
prepareHibernate,ensureRuntimeReady, andinspectLifecycle, but those remain host operations.The existing
gateway.suspend.*, scheduler hooks, recovery operations, andadmission fence are reused.
The RFC now recommends one concrete missing seam:
This follows Peter's
gateway.suspend.statuspattern: closed Gateway Protocolschemas,
operator.read, stable operation identity, no mutation, exact replay,and typed conflict behavior. It projects PR 112896's existing durable ready
record rather than adding another journal or state machine. Offline restore
and quarantine do not become invented live phases. The method remains callable
only through an authenticated pre-admission control path while ordinary work
is held. That path is a tracked, bounded, non-enrolling host probe: restart
still wins, and nodes, pairing, remote clients, presence-bearing sessions, and
ordinary RPCs remain fenced. There is no
gateway.restore.admit; OpenClawcomputes readiness and opens its own admission.
When RFC 0018 is available and enabled, the same record also publishes a
required
RecoveryPointRestoredcondition through/readyz,openclaw ready,Status, and Gateway readiness RPC. Stable subject refs identify the destination
Gateway, restore operation, accepted recovery point, runtime generation,
scheduler reconciliation, and required state-owner roles; current IDs and
generations stay in RFC 0018's identity package. The generic readiness
projection and operation-fenced status method must report the same readiness
generation. Neither may infer restore success from process health or
database-open success.
gateway.restore.statusremains independently usefulwhen canonical readiness is disabled or has not landed.
Planned handoff may create a new recovery point only after Gateway suspension,
host-proven source-writer closure, final capture, and durable acceptance.
Forced source loss creates no clean-retirement fact and recovers from the last
previously accepted point under its declared RPO.
Implementation Evidence
composes verified RFC 0013 snapshots into one deterministic host-protected
recovery point and exact acceptance-byte inventory, using one canonical
generation-bound state-owner inventory receipt across the stack.
is the final-capture PR stacked on #112385. It binds
host-supplied closure evidence, creates final owner snapshots, and durably
replays one committed recovery point.
is the restored-admission PR stacked on #112865. It restores an exact
accepted recovery point to fresh paths and reuses Gateway work admission to
remain closed until scheduler reconciliation and required-owner readiness
produce one durable ready record. It now also implements the proposed
read-only
gateway.restore.statusprojection and its tracked local probehandshake as representative proof. The
public Gateway Protocol addition remains an explicit owner-review decision
before merge or ship.
#39,
#41,
#42,
#43, and
#45,
#46,
#47, and
#51 (Microsoft access
required) demonstrate permanent cron projection, cancellation arbitration,
Peter's shipped hook/proxy-pipe composition, and a default-off private
Blob/per-user ECS/already-due sleep-veto boundary, followed by one permanent
payload-free retained-wake authority that coalesces concurrent owner causes
into an exact destination generation, production-backed metadata-only
Teams/cron owner validation, and exact-readiness-gated per-cause delivery
with durable crash replay.
The retained-wake drafts deliberately do not activate a production route or
cohort. Lobster still needs an owner-approved accepted-final-handoff lookup and
canonical mapping from opaque logical runtime identity to the Teams/cron
semantic owners before those call sites can be wired safely.
These PRs and fork drafts are non-normative feasibility and owner-review
evidence. None moves external ingress fencing, clean shutdown, host acceptance,
publication, wake, compute placement, or source-compute retirement into
OpenClaw.
If Vincent, Peter, Josh Lehman, or other maintainers prefer a smaller or
different implementation that meets the RFC and issue #114145 outcomes, please
use it. The fork stack is evidence for review, not a requirement to preserve
this exact decomposition.
Review Request
Please review the ownership split and public status method before the
implementation stack is promoted:
gateway.suspend.*remains the cooperative pause primitive.agent inventory from the activation-pinned runtime and binds its revision to
the source generation.
container.
wake, and compute lifecycle; final capture only binds supplied closure
evidence.
retention, and cleanup semantics; unknown journal state never falls back to
ordinary startup.
projection, while
gateway.restore.statusremains the independent exactoperation-fenced observation seam.