Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions adapters/python/openclaw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ Install the adapter in every NeMo Fabric environment:
pip install "nemo-fabric[openclaw]"
```

Managed runtimes and NeMo Fabric-owned services also require the pinned OpenClaw
version:
Install OpenClaw 2026.11.13 for managed runtimes and NeMo Fabric-owned services:

```bash
# Requires Node.js >=24.22.1 <25 or >=26.12.1, and npm 11.16+.
npm install --global openclaw@2026.9.34 --allow-scripts=openclaw
npm install --global openclaw@2026.11.13 --allow-scripts=openclaw
```

An attachment to a caller-owned Gateway does not require a local OpenClaw
Expand All @@ -45,16 +44,6 @@ prepared use, if `openclaw` is not in `PATH`, set
bare command is resolved through `PATH`; a relative path containing a directory
is resolved from the NeMo Fabric base directory.

### Upgrade a Gateway With Retained State

When upgrading a caller-owned Gateway from OpenClaw 2026.9.4, stop the Gateway and run `openclaw backup create --verify` with the Gateway's existing `OPENCLAW_STATE_DIR` and `OPENCLAW_CONFIG_PATH` before upgrading. The backup must include the active config, its include files, and all configured agent directories, including paths outside the state directory. Protect the archive because it can contain credentials.

Before upgrading, check the backup result and manifest for the active config, its include files, and every configured agent directory. For paths marked `covered`, confirm that the archive contains the data under a parent directory. Fix missing required paths and rerun the backup. Continue with the upgrade after confirming that all required data is backed up.

Before migration, copy every legacy session directory while the Gateway is stopped. Include `sessions.json`, `.jsonl` transcripts, and session directories outside `OPENCLAW_STATE_DIR`. The backup command excludes legacy `.jsonl` transcripts. Protect these copies and keep them with the verified archive for rollback.

Run `openclaw doctor --fix` with the 2026.9.34 executable and the same path settings. The command imports legacy `sessions.json` files and JSONL session data into each agent's SQLite database. Restart the Gateway after the command succeeds. Keep the verified backup for rollback.

Managed runtimes and NeMo Fabric-owned services use temporary state by default. Set `runtime.keep_state=true` to retain the native Gateway home across restarts.

## Configuration
Expand Down Expand Up @@ -169,9 +158,8 @@ The following settings are specific to the OpenClaw adapter:
| `shutdown_timeout_seconds` | `15` | Graceful Gateway shutdown timeout. OpenClaw's descriptor allows 30 seconds for the complete adapter stop. Overrides must leave time for cleanup within that limit. Stop reports an error if the Gateway process is still running after cleanup. |
| `connect_timeout_seconds` | `10` | Local HTTP connection timeout. |
| `read_timeout_seconds` | None | Local HTTP response timeout. When unset, the invocation timeout bounds the response. |
| `agents.defaults.heartbeat.every` | OpenClaw native default | Recurring heartbeat interval with units, such as `30m`; `0m` disables the recurring cadence but not event-driven turns. |
| `agents.defaults.compaction.memoryFlush.enabled` | OpenClaw native default | Pre-compaction memory flush turn. Compaction itself still runs. |
| `tools.exec.notifyOnExit` | OpenClaw native default | System event and heartbeat when a backgrounded `exec` process exits. |
| `tools.exec.notifyOnExit` | OpenClaw native default | Notification when a backgrounded `exec` process exits. |
| `tools.toolSearch` | OpenClaw native default | Tool search for large tool catalogs. |
| `tools.codeMode` | OpenClaw native default | Code Mode, which can take precedence over tool search and exposes only `exec` and `wait`; do not combine it with blocking `exec`. |
| `tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange` | OpenClaw native default (blocked) | Lets `web_fetch`, `image`, and `pdf` connect to `198.18.0.0/15`; set it only behind a fake-IP proxy that owns the range and enforces its own destination policy. |
Expand All @@ -181,11 +169,13 @@ The following settings are specific to the OpenClaw adapter:

The `agents` and `tools` settings use OpenClaw's native structure, and `plugins` maps onto it. The adapter merges only the fields you set into the generated `openclaw.json` for managed runtimes and prepared services, beside the generated `agents.defaults`, `tools.allow`, `tools.deny`, and adapter-owned plugin entries, without replacing generated keys. Omitting a field preserves the current behavior. `harness.settings.tools` is separate from the normalized top-level `tools.enabled` and `tools.blocked` selectors. Attached Gateways reject these settings. These controls do not stop context compaction or correlate concurrent sessions, and they do not add NeMo Relay support; refer to [Native Gateway Controls](../../../docs/integrations/harness/openclaw/openclaw.mdx#native-gateway-controls).

Create and manage saved scheduled jobs with `openclaw automations`.

OpenClaw's [derived-port mapping](https://docs.openclaw.ai/gateway/multiple-gateways#port-mapping-derived) uses `base_port + 2` for browser control and allocates browser CDP ports from `base_port + 11` through `base_port + 110`. Set `port_range` when the consumer reserves a port range before configuring NeMo Fabric; the adapter selects a base whose complete derived footprint fits inside that range. The adapter verifies only that `base_port` and `base_port + 2` are available before startup. OpenClaw allocates the CDP ports on demand instead of reserving the complete range, so the adapter cannot guarantee that those ports will still be available when OpenClaw needs them. Keep the configured range reserved for the lifetime of the runtime when using OpenClaw browser features.

With native interfaces enabled, one Gateway owns all four client paths. A small adapter-owned plugin adds the configured instruction for the selected agent through the public `before_prompt_build` hook while preserving OpenClaw's native prompt and tool guidance. SDK requests omit duplicate instruction injection in that mode; SDK-only and service behavior are preserved. The existing `replace` mode selects the Fabric instruction without replacing OpenClaw's internal prompt. Model, workspace, tools, MCP, and skill configuration are shared; native responses remain native.

Startup verifies the loaded hook through an authenticated, model-free probe before publishing connection files. Missing, blocked, or mismatched hooks fail with `openclaw_shared_configuration_unavailable`. The plugin requires both `allowConversationAccess` and `allowPromptInjection`: pinned OpenClaw gates `before_prompt_build` behind both permissions for external plugins.
Startup verifies the loaded hook through an authenticated, model-free probe before publishing connection files. Missing, blocked, or mismatched hooks fail with `openclaw_shared_configuration_unavailable`. On OpenClaw 2026.11.13, the plugin requires both `allowConversationAccess` and `allowPromptModification`.

After readiness, private `interfaces/gateway.json` discovery references `dashboard.token` or `gateway.token`. Terminal selection adds an executable `interfaces/terminal` and `terminal.running` marker; the marker is removed first on stop. The launcher uses private client configuration and an environment SecretRef, not token arguments. Terminal attachment currently requires POSIX. Pinned TUI `/quit` can use a native exit-code-130 fallback while the Gateway stays usable.

Expand Down Expand Up @@ -237,7 +227,7 @@ Gateway HTTP errors, provider failures, and request timeouts also require recove

NeMo Fabric retains known unresolved tool calls in its completion record. A gap in the Gateway's recent history window also requires recovery acknowledgment. New work can confirm completion after acknowledgment when its history remains visible.

Keep native session resets separate from SDK invocations. The adapter checks the native session UUID around history reads and before dispatch. OpenClaw 2026.9.34 has no expected-UUID condition on Chat Completions requests, so a reset after the final check can still redirect a turn. The remaining dispatch race is tracked in [#638](https://github.com/NVIDIA/NeMo-Fabric/issues/638).
Keep native session resets separate from SDK invocations. The adapter checks the native session UUID around history reads and before dispatch. A reset after the final check can still redirect a turn. The remaining dispatch race is tracked in [#638](https://github.com/NVIDIA/NeMo-Fabric/issues/638).

A prepared service keeps the Gateway and retained-state lock until release. Stopping a connected runtime closes that runtime's client. The service continues serving native chat channels. A retained namespace allows one connected runtime at a time. Failed Gateway cleanup retains ownership and can be retried before a replacement starts. Caller-owned attached services reject retained sessions because the current service reference cannot verify a native storage boundary.

Expand Down Expand Up @@ -352,7 +342,7 @@ shows a sanitized service handle:
"agent_id": "default"
},
"metadata": {
"openclaw_version": "2026.9.34"
"openclaw_version": "2026.11.13"
}
}
```
Expand Down Expand Up @@ -522,3 +512,17 @@ workspace, as shown in the
[calculator example](../../../examples/harbor/calculator/README.md#4-openclaw).

Software evidence forwards the version returned by existing startup/service checks; it adds no request. Shared-service runtimes retain the service's original capture time when the reported version is unchanged. The reported service version describes OpenClaw only; it does not establish a complete remote installation inventory. Set `FabricConfig.provenance.enabled=false` before initialization to skip provenance collection.

## OpenClaw 2026.9.34

The adapter also supports OpenClaw 2026.9.34. On this release, set `agents.defaults.heartbeat.every` to control recurring heartbeat turns. The interval requires units, such as `30m` or `1h30m`. Set `0m` to disable the recurring cadence; event-driven turns remain enabled.

```yaml
harness:
adapter_id: nvidia.fabric.openclaw
settings:
agents:
defaults:
heartbeat:
every: 0m
```
2 changes: 1 addition & 1 deletion adapters/python/openclaw/openclaw.fabric-adapter.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"every": {
"type": "string",
"pattern": "^(?:[0-9]+(?:\\.[0-9]+)?(?:ms|s|m|h|d))+$",
"description": "Native recurring heartbeat interval, such as 30m or 1h30m. Units are required; 0m disables the recurring cadence but not event-driven turns."
"description": "OpenClaw 2026.9.34 recurring heartbeat interval, such as 30m or 1h30m. Units are required; 0m disables recurring cadence but not event-driven turns. OpenClaw 2026.11.13 rejects this setting; use openclaw doctor --fix offline to convert an existing monitor into a saved scheduled job."
}
},
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
OPENCLAW_SERVICE_TYPE = "openclaw_gateway"
OPENCLAW_ADAPTER_ID = "nvidia.fabric.openclaw"
OPENCLAW_USAGE_EVIDENCE = "nvidia.fabric.openclaw.usage_evidence.v1"
SUPPORTED_OPENCLAW_VERSIONS = frozenset({"2026.9.34"})
SUPPORTED_OPENCLAW_VERSIONS = frozenset({"2026.9.34", "2026.11.13"})
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
MAX_PORT_ATTEMPTS = 20
MAX_DERIVED_PORT_OFFSET = 110
MAX_TCP_PORT = 65_535
Expand Down Expand Up @@ -841,6 +841,7 @@ def _openclaw_config(
service_mode: bool = False,
dashboard: bool = False,
skill_plan: openclaw_skills.SkillPlan | None = None,
openclaw_version: str = "2026.9.34",
) -> dict[str, Any]:
model = _selected_model(config)
model_id = _model_id(model)
Expand Down Expand Up @@ -1004,6 +1005,11 @@ def _openclaw_config(
metadata={"field": "harness.settings.channel_config"},
)
result.update(channel_config)
if openclaw_version == "2026.11.13":
for entry in result.get("plugins", {}).get("entries", {}).values():
hooks = entry.get("hooks", {})
if "allowPromptInjection" in hooks:
hooks["allowPromptModification"] = hooks.pop("allowPromptInjection")
Comment thread
rsliter marked this conversation as resolved.
Resolved
return result


Expand Down Expand Up @@ -1745,6 +1751,18 @@ def startup_remaining() -> float:
command, "--version", env=child_env, timeout=startup_remaining()
)
version = _validate_openclaw_version(version_output)
if version == "2026.11.13" and "heartbeat" in settings.get("agents", {}).get(
"defaults", {}
):
raise lifecycle.LifecycleError(
"openclaw_unsupported_heartbeat",
"OpenClaw 2026.11.13 retired agents.defaults.heartbeat. Run "
"openclaw doctor --fix offline to convert an existing heartbeat "
"monitor into a saved scheduled job, then remove "
"harness.settings.agents.defaults.heartbeat and manage the job "
"through OpenClaw automations.",
metadata={"field": "harness.settings.agents.defaults.heartbeat"},
)
from nemo_fabric_adapters.common.provenance import record_version

record_version(
Expand Down Expand Up @@ -1820,13 +1838,14 @@ def startup_remaining() -> float:
service_mode=service is not None and service.get("operation") == "prepare",
dashboard=dashboard_port is not None,
skill_plan=skill_plan,
openclaw_version=version,
)
plugin_section = generated.get("plugins", {})
if context.state_dir:
# The agent's plugin commands write through the include.
state_config = openclaw_plugins.state_folder(state_dir)
plugin_section = openclaw_plugins.prepare(
state_config, generated.pop("plugins", {})
state_config, generated.pop("plugins", {}), openclaw_version=version
)
generated["plugins"] = dict(openclaw_plugins.INCLUDE)
config_path = state_config / openclaw_plugins.CONFIG_FILE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,53 @@ def _digest(text: str) -> str:
return hashlib.sha256(text.encode()).hexdigest()


def prepare(folder: Path, fabric: dict[str, Any]) -> dict[str, Any]:
def _prompt_permission(section: dict[str, Any], name: str) -> dict[str, Any]:
section = copy.deepcopy(section)
previous = (
"allowPromptInjection"
if name == "allowPromptModification"
else "allowPromptModification"
)
entries = section.get("entries")
if not isinstance(entries, dict):
return section
for entry in entries.values():
if not isinstance(entry, dict):
continue
hooks = entry.get("hooks")
if not isinstance(hooks, dict) or previous not in hooks:
continue
if name in hooks and not _same(hooks[name], hooks[previous]):
raise ValueError(
"Conflicting allowPromptInjection and allowPromptModification; "
"resolve the plugin's prompt permission before restarting"
)
hooks[name] = hooks.pop(previous)
return section


def prepare(
folder: Path, fabric: dict[str, Any], *, openclaw_version: str = "2026.9.34"
) -> dict[str, Any]:
"""Merge NeMo Fabric's plugin settings into ``plugins.json`` and return them."""
policy_path = folder / PLUGINS_FILE
owned_path = folder / OWNED_FILE
agent = _read_object(policy_path, kind="plugin settings")
entries = agent.get("entries")
if openclaw_version == "2026.9.34" and isinstance(entries, dict):
for entry in entries.values():
hooks = entry.get("hooks") if isinstance(entry, dict) else None
if isinstance(hooks, dict) and "allowPromptModification" in hooks:
# Merging first could discard the record's shadowed values.
raise lifecycle.LifecycleError(
"openclaw_plugin_state_invalid",
"Retained plugin settings use the OpenClaw 2026.11.13 "
"permission format; OpenClaw 2026.9.34 cannot start with "
"them. Stop the Gateway and restore the matching "
"pre-upgrade state, workspace, and configuration backup "
"before restarting.",
metadata={"path": str(policy_path)},
)
owned = _read_object(owned_path, kind="plugin ownership record")
pending = owned.pop("pending", None)
if isinstance(pending, dict):
Expand All @@ -274,7 +316,16 @@ def prepare(folder: Path, fabric: dict[str, Any]) -> dict[str, Any]:
raise _state_invalid(
owned_path, "plugin ownership record", "unexpected record shape"
)
if openclaw_version == "2026.11.13":
# Keep the 0.7 ownership paths stable, including shadowed agent values.
try:
agent = _prompt_permission(agent, "allowPromptInjection")
fabric = _prompt_permission(fabric, "allowPromptInjection")
except ValueError as exc:
raise _state_invalid(policy_path, "plugin settings", str(exc)) from exc
merged, record = merge_plugins(agent, fabric, owned)
if openclaw_version == "2026.11.13":
merged = _prompt_permission(merged, "allowPromptModification")
text = json.dumps(merged, indent=2) + "\n"
staged = {**owned, "pending": {**record, "sha256": _digest(text)}}
for path, content in (
Expand Down
21 changes: 21 additions & 0 deletions adapters/typescript/scripts/audit-dependencies.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,27 @@ test("tar: allows the enumerated advisories and exact development parent paths b
assert.equal(checkAudit(audit, lock, "adapters", tarDeadline - 1).high, 4);
});

for (const id of ["GHSA-xm6h-2993-3ch9", "GHSA-9hmx-4f52-v64x"]) {
test(`tar: allows reviewed ${id} only with the approved range and severity`, () => {
const { audit, lock } = tarFixture();
const cause = {
...tarAdvisory,
url: `https://github.com/advisories/${id}`,
};
audit.vulnerabilities.tar.via.push(cause);
assert.equal(checkAudit(audit, lock, "adapters", tarNow).high, 4);
assert.throws(
() => checkAudit(audit, lock, "adapters", tarDeadline),
/expired/,
);
cause.range = "*";
assert.throws(() => checkAudit(audit, lock, "adapters", tarNow));
cause.range = "<8.0.0";
cause.severity = "critical";
assert.throws(() => checkAudit(audit, lock, "adapters", tarNow));
});
}

for (const now of [tarDeadline, tarDeadline + 1, NaN]) {
test(`tar: rejects an expired exception or invalid clock (${now})`, () => {
const { audit, lock } = tarFixture();
Expand Down
Loading
Loading