Skip to content

feat: keep OpenClaw's native state in the agent's state folder - #1

Merged
cv merged 2 commits into
cv:pr/10-skill-pathsfrom
sandl99:feat/openclaw-keep-state
Nov 11, 2026
Merged

cv merged 2 commits into
cv:pr/10-skill-pathsfrom
sandl99:feat/openclaw-keep-state

Conversation

@sandl99

@sandl99 sandl99 commented Nov 10, 2026

Copy link
Copy Markdown

Overview

OpenClaw's adapter kept its native state in a TemporaryDirectory that stop removed, and its descriptor rejected runtime.keep_state. A skill the agent wrote through OpenClaw's Skill Workshop was saved under that temporary state and was gone after a runtime restart. This is the OpenClaw retention gap described for the Kubernetes YAML skills checks SKL-06, SKL-07, and SKL-08.

This stacks on NVIDIA#615 (pr/10-skill-paths at efc9ac77) and adds only OpenClaw state retention on top of NVIDIA#572's core contract, following NVIDIA#576's Hermes adoption. It doesn't add conversation selection or resume.

Details

  • The OpenClaw descriptor accepts runtime.keep_state; the adapter catalog is regenerated.
  • With RuntimeContext.state_dir, the Gateway's OPENCLAW_STATE_DIR is the agent's state folder. Stop and a failed start leave it in place; NeMo Fabric still creates, locks, and keeps it.
  • The generated openclaw.json stays in a per-runtime temporary folder that stop removes, and the Gateway token is still generated at each start.
  • The dashboard token moves to interfaces/dashboard.token in the state folder, where Hermes keeps its interface token. Stop removes it, and start removes one an earlier runtime left.
  • Attaching a caller-owned Gateway with kept state fails with openclaw_keep_state_requires_managed_gateway.
  • Without runtime.keep_state, state stays temporary.
  • Docs describe where the state lives, what stays per runtime, durable storage, and that kept state doesn't resume a conversation or qualify agent-installed plugins.

Overlap: NVIDIA#612 contains the same retention changes plus cold resume (session_ref, service connection changes, session_resume). It is too large to merge as one change, so this PR is the smaller retention-only version on NVIDIA#615's stack; the resume work can follow separately. The duplication checkbox below is left unchecked for that reason.

Validation

  • New tests in tests/adapters/test_openclaw.py, observed failing before the change: an authored skill keeps its path and hash and is used fresh by the next runtime without a copy; a concurrent runtime fails with the state-in-use error; without retention the skill is removed at stop; a failed start keeps the state, removes the generated configuration, and clears a stale token; attach with kept state is refused; token location and descriptor.
  • pytest tests/adapters/test_openclaw.py tests/adapters/test_openclaw_health.py tests/e2e/test_openclaw_skills.py: 171 passed on macOS with the Linux-only mock-Gateway markers lifted locally.
  • tests/e2e/test_openclaw_skills.py with OPENCLAW_TEST_PACKAGE set to OpenClaw 2026.9.34: 5 passed.
  • Full pytest: 3101 passed; the 27 failures and 1 error also fail on efc9ac77 locally (Claude, Codex, Pi, Kiro, just, and Fabric CLI tooling absent).
  • ruff check, ruff format --check, the copyright-header hook, and generate_adapter_catalog.py --check.
  • Local, with a real OpenClaw 2026.9.34 Gateway: openclaw skills workshop propose-create and apply saved the skill to <state>/agents/default/agent/workshop-skills/; it was kept after stop, and the next runtime's Gateway discovered it at the same path and hash.
  • Live, NemoClaw pinned to this head on Kubernetes with artifacts on a PVC: SKL-06, SKL-07, and SKL-08 passed across initial deployment, runtime stop and start, Pod replacement, and workload destroy and reapply. Source path and hashes were unchanged; native discovery, instruction loading, fresh output, and dashboard sign-in through the new token path passed in every phase. This was a focused manual run, not the full checklist.
  • Not run: Rust and TypeScript suites (no changes), the docs build, Windows, and a NeMo Fabric-owned service with kept state.

Where should the reviewer start?

OpenClawRuntime.start in adapters/python/openclaw/src/nemo_fabric_adapters/openclaw/adapter.py, then test_openclaw_keep_state_keeps_an_authored_skill_for_the_next_runtime.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

OpenClaw kept its native state in a temporary directory that stop
removed, so a skill the agent wrote through the Skill Workshop was gone
after a runtime restart, and the descriptor rejected runtime.keep_state.

The adapter now accepts runtime.keep_state. With RuntimeContext.state_dir,
the Gateway's OPENCLAW_STATE_DIR is the agent's state folder, which stop
and a failed start leave in place. The generated openclaw.json stays in a
temporary folder that stop removes. The dashboard token moves to
interfaces/dashboard.token in the state folder, where Hermes keeps its
interface tokens, and start removes one that an earlier runtime left.
Attaching a caller-owned Gateway with kept state fails, because the
adapter can't choose where that Gateway keeps its state. Without
runtime.keep_state, state stays temporary.

NeMo Fabric still creates, locks, and keeps the folder.

Signed-off-by: San Dang <sdang@nvidia.com>
Say where OpenClaw keeps its state with runtime.keep_state, what stays
per runtime, that the artifact root must be durable for the state to
outlive a sandbox, and that kept state neither resumes a conversation nor
qualifies agent-installed plugins.

Signed-off-by: San Dang <sdang@nvidia.com>
@cv
cv merged commit 8994291 into cv:pr/10-skill-paths Nov 11, 2026
33 of 36 checks passed

This branch was successfully deployed

1 active deployment
fern — 7ec1106f Deployed Nov 11, 2026 by cv via Clean up docs preview #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants