Repository navigation
feat: keep OpenClaw's native state in the agent's state folder - #1
Merged
Merged
Conversation
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>
2 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
OpenClaw's adapter kept its native state in a
TemporaryDirectorythat stop removed, and its descriptor rejectedruntime.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-pathsatefc9ac77) 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
runtime.keep_state; the adapter catalog is regenerated.RuntimeContext.state_dir, the Gateway'sOPENCLAW_STATE_DIRis the agent's state folder. Stop and a failed start leave it in place; NeMo Fabric still creates, locks, and keeps it.openclaw.jsonstays in a per-runtime temporary folder that stop removes, and the Gateway token is still generated at each start.interfaces/dashboard.tokenin the state folder, where Hermes keeps its interface token. Stop removes it, and start removes one an earlier runtime left.openclaw_keep_state_requires_managed_gateway.runtime.keep_state, state stays temporary.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
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.pywithOPENCLAW_TEST_PACKAGEset to OpenClaw 2026.9.34: 5 passed.pytest: 3101 passed; the 27 failures and 1 error also fail onefc9ac77locally (Claude, Codex, Pi, Kiro,just, and Fabric CLI tooling absent).ruff check,ruff format --check, the copyright-header hook, andgenerate_adapter_catalog.py --check.openclaw skills workshop propose-createandapplysaved 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.Where should the reviewer start?
OpenClawRuntime.startinadapters/python/openclaw/src/nemo_fabric_adapters/openclaw/adapter.py, thentest_openclaw_keep_state_keeps_an_authored_skill_for_the_next_runtime.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Relates to [Enhancement]: P0 adapters: cold resume and usable agent-installed plugins across restarts NVIDIA/NeMo-Fabric#578
I confirm this contribution is my own work, or I have the right to submit it under this project's license.
I searched existing issues and open pull requests, and this does not duplicate existing work.