Skip to content
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a467384
fix(onboard): restore lifecycle E2E qualification
sandl99 Aug 24, 2026
7d65f9c
fix(e2e): require exact lifecycle cleanup evidence
cv Aug 24, 2026
df68482
fix(e2e): reject incomplete policy cleanup evidence
cv Aug 24, 2026
a025a90
fix(e2e): repair deterministic state failures
sandl99 Aug 24, 2026
06c958a
Merge branch 'main' into fix/top3-e2e-state-errors
sandl99 Aug 24, 2026
98b6a93
fix(security): preserve messaging credential boundaries
apurvvkumaria Aug 24, 2026
1dfce9d
fix(e2e): stabilize credential-bound workflows
sandl99 Aug 24, 2026
eeb5f1f
fix(e2e): refresh Hermes validator integrity pin
sandl99 Aug 24, 2026
a562ca8
fix(e2e): align credential lifecycle checks
sandl99 Aug 24, 2026
02eb135
fix(security): enforce credential lifecycle boundaries
apurvvkumaria Aug 24, 2026
a46e9ec
fix(e2e): migrate credential-bound provider state
sandl99 Aug 24, 2026
f1d8504
Merge branch 'main' into fix/top3-e2e-state-errors
cv Aug 24, 2026
e6737b2
fix(security): preserve sealed provider runtime config
sandl99 Aug 24, 2026
de3e463
Merge remote-tracking branch 'origin/main' into fix/top3-e2e-state-er…
sandl99 Aug 24, 2026
9a77bef
fix(e2e): read runtime provider config in proof
sandl99 Aug 24, 2026
5542a68
fix(e2e): bind proof to exec credential revision
sandl99 Aug 24, 2026
50e9af9
fix(e2e): bind fake Telegram provider endpoint
sandl99 Aug 24, 2026
64ecc98
Merge remote-tracking branch 'origin/main' into fix/top3-e2e-state-er…
sandl99 Aug 24, 2026
fd3fcb3
Merge remote-tracking branch 'origin/main' into fix/top3-e2e-state-er…
sandl99 Aug 24, 2026
8a7e4e4
fix(test): repair grouped integration checks
sandl99 Aug 24, 2026
9dbce7d
Merge remote-tracking branch 'origin/main' into fix/top3-e2e-state-er…
sandl99 Aug 24, 2026
5a8e381
fix(test): remove grouped move artifacts
sandl99 Aug 25, 2026
2fcd211
fix(hermes): refresh wrapper integrity pin
sandl99 Aug 25, 2026
39e60f7
fix(hermes): refresh profile patch integrity pin
sandl99 Aug 25, 2026
1bedba3
Merge remote-tracking branch 'origin/main' into fix/top3-e2e-state-er…
sandl99 Aug 25, 2026
c9b54eb
fix(test): repair grouped runtime imports
sandl99 Aug 25, 2026
c9e2401
Merge remote-tracking branch 'origin/main' into fix/top3-e2e-state-er…
sandl99 Aug 25, 2026
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
2 changes: 1 addition & 1 deletion agents/hermes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ RUN node --experimental-strip-types \
ARG NEMOCLAW_HERMES_WRAPPER_SHA256=f4276e9833638b7a620176c88bd329d6b6d4948538a3227b727a1397146a0e0e
ARG NEMOCLAW_HERMES_CLI_ADAPTER_SHA256=989edf54a8c09c6efb348600a8aa2f264c0b71408eb9d7bcd579b92cbeccf9b1
ARG NEMOCLAW_HERMES_CLI_ADAPTER_VALIDATOR_SHA256=db4046e79e513eab67b069a8eda20167b8b65529cf26842531d2ad673c670330
ARG NEMOCLAW_HERMES_VALIDATOR_SHA256=b355d1365fb1d15475e327f312ceb854ae96f9ebed28cf96bc8817f550df2688
ARG NEMOCLAW_HERMES_VALIDATOR_SHA256=4121dfcc56cff35278795ce8482fd892480d0e179f4221f391f9935816db0623
ARG NEMOCLAW_HERMES_TIRITH_FINALIZER_SHA256=a1e6b1c53ab297569abb87c29d15c294d729e46005bfd022136b4c447a791819
ARG NEMOCLAW_HERMES_CRON_RESTORE_CONTROLLER_SHA256=e8593cf1580bffa4663e91c079ba0ce31c3d26391f5b1718872701138ce250b0
# hadolint ignore=DL4006
Expand Down
7 changes: 7 additions & 0 deletions agents/hermes/runtime-config-guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4962,6 +4962,13 @@ def _runtime_plan_replacements_and_provider_keys(
if not _placeholder_suffix_matches_env_key(suffix, env_key):
continue
if compiled.search(runtime_value):
revision = re.fullmatch(
rf"openshell:resolve:env:(v[0-9]{{1,20}}_){re.escape(env_key)}",
runtime_value,
)
marker = f"-OPENSHELL-RESOLVE-ENV-{env_key}"
if revision and value.endswith(marker):
value = value[: -len(env_key)] + revision.group(1) + env_key
replacements[env_key] = (value, message)
return replacements, provider_env_keys, True

Expand Down
4 changes: 3 additions & 1 deletion agents/hermes/validate-env-secret-boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
from typing import Iterable, TextIO

SECRET_KEY_RE = re.compile(r"(^|_)(TOKEN|KEY|SECRET|PASSWORD|CREDENTIAL|API)(_|$)")
PLACEHOLDER_RE = re.compile(r"^(xoxb|xapp)-OPENSHELL-RESOLVE-ENV-[A-Z0-9_]+$")
PLACEHOLDER_RE = re.compile(
r"^(xoxb|xapp)-OPENSHELL-RESOLVE-ENV-(?:v[0-9]{1,20}_)?[A-Z][A-Z0-9_]*$"
)
KEY_NAME_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
API_SERVER_KEY_RE = re.compile(r"^[0-9a-f]{64}$")
HERMES_API_PORT_RANGE_START = 8642
Expand Down
48 changes: 43 additions & 5 deletions scripts/nemoclaw-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1698,12 +1698,16 @@ prefix = "openshell:resolve:env:"
alias_marker = "-OPENSHELL-RESOLVE-ENV-"
keys = os.environ.get("NEMOCLAW_PROVIDER_PLACEHOLDER_KEYS", "").split()
replacements = {}
alias_replacements = {}
warnings = []

for key in keys:
value = os.environ.get(key, "")
if value.startswith(prefix) and value != f"{prefix}{key}":
replacements[f"{prefix}{key}"] = (key, value)
suffix = value[len(prefix) :]
if re.fullmatch(rf"v[0-9]+_{re.escape(key)}", suffix):
alias_replacements[key] = suffix

with open(config_file, encoding="utf-8") as f:
config = json.load(f)
Expand All @@ -1722,6 +1726,17 @@ replacement_patterns = [
(re.compile(re.escape(old) + r"(?![A-Za-z0-9_])"), key, new)
for old, (key, new) in sorted(replacements.items(), key=lambda kv: -len(kv[0]))
]
alias_replacement_patterns = [
(
re.compile(
re.escape(alias_marker)
+ rf"(?:v[0-9]+_)?{re.escape(key)}(?![A-Za-z0-9_])"
),
key,
f"{alias_marker}{suffix}",
)
for key, suffix in alias_replacements.items()
]


def rewrite(value):
Expand All @@ -1731,6 +1746,11 @@ def rewrite(value):
if count:
refreshed.add(key)
value = updated
for pattern, key, new in alias_replacement_patterns:
updated, count = pattern.subn(new, value)
if count:
refreshed.add(key)
value = updated
return value
if isinstance(value, list):
return [rewrite(item) for item in value]
Expand Down Expand Up @@ -1784,7 +1804,7 @@ def walk_for_warnings(value, path):
alias_env_key = value[alias_index + len(alias_marker) :]
token_scheme = value[:alias_index] + "-"
for env_key in keys:
if env_key != alias_env_key:
if not placeholder_suffix_matches_env_key(alias_env_key, env_key):
continue
label = path_label(path)
env_value = os.environ.get(env_key, "")
Expand All @@ -1795,7 +1815,16 @@ def walk_for_warnings(value, path):
warnings.append(
f"[channels] {label} expects the {env_key} provider placeholder but it is missing from the runtime environment"
)
elif not placeholder_re.match(env_value) and not env_value.startswith(token_scheme):
elif placeholder_re.match(env_value):
expected = (
f"{token_scheme}OPENSHELL-RESOLVE-ENV-"
f"{env_value[len(prefix):]}"
)
if value != expected:
warnings.append(
f"[channels] {label} placeholder does not match the OpenShell runtime placeholder for {env_key}"
)
elif not env_value.startswith(token_scheme):
warnings.append(
f"[channels] {label} runtime {env_key} is neither the {env_key} OpenShell placeholder nor a {token_scheme} token; runtime may reject it"
)
Expand Down Expand Up @@ -2067,11 +2096,20 @@ import sys
with open(sys.argv[1], encoding="utf-8") as handle:
plan = json.load(handle)
for alias in plan.get("envAliases", []):
if not re.search(alias["match"], os.environ.get(alias["envKey"], "")):
env_key = alias["envKey"]
runtime_value = os.environ.get(env_key, "")
if not re.search(alias["match"], runtime_value):
continue
value = alias["value"]
revision = re.fullmatch(
rf"openshell:resolve:env:(v[0-9]+_){re.escape(env_key)}", runtime_value
)
marker = f"-OPENSHELL-RESOLVE-ENV-{env_key}"
if revision and value.endswith(marker):
value = value[: -len(env_key)] + revision.group(1) + env_key
print("\t".join([
alias["envKey"],
alias["value"],
env_key,
value,
alias.get("message", ""),
]))
PYMESSAGINGALIASES
Expand Down
190 changes: 157 additions & 33 deletions src/lib/actions/sandbox/auto-pair-warmup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { describe, expect, it } from "vitest";
import {
RESTORED_CLONE_WARMUP_SCRIPT,
sandboxWarmupExecArgs,
WARMUP_OPENCLAW_BIN,
WARMUP_PROBE_TIMEOUT_S,
WARMUP_SCRIPT,
WARMUP_TIMEOUT_MS,
Expand All @@ -20,6 +21,14 @@ import { WARMUP_SESSION_ID_PREFIX } from "./warmup-session";
const shAvailable = spawnSync("sh", ["-c", "exit 0"], { encoding: "utf-8" }).status === 0;
const itWithSh = shAvailable ? it : it.skip;

function useWarmupExecutableFixture(script: string, executable: string): string {
const withFixture = script.replaceAll(WARMUP_OPENCLAW_BIN, executable);
return withFixture.replace(
`warmup_is_trusted_executable ${executable} || exit 0`,
`test -x ${executable} || exit 0`,
);
}

// NOTE on coverage shape (#4504-v2): `runSandboxScopeWarmupRun` is not exercised
// in-process here. Like its sibling `runSandboxAutoPairApprovalPass`, the leaf
// lazily does a raw `require("../../adapters/openshell/runtime")` — a native
Expand All @@ -44,20 +53,18 @@ describe("scope-upgrade warm-up timeout bound v2 (#4504)", () => {
expect(WARMUP_TIMEOUT_MS).toBeGreaterThan(0);
expect(WARMUP_PROBE_TIMEOUT_S).toBe(5);
});

it("stays within the bounds the contract budgeted for finalization latency", () => {
// The architect budgeted worst-case added finalization latency at the
// warm-up cap (<=30s) plus the existing 15s approval pass. Guard that the
// warm-up cap has not crept past its 30s ceiling — anything larger would
// blow the budget the contract signed off on for a one-time onboard.
expect(WARMUP_TIMEOUT_MS).toBeLessThanOrEqual(30_000);
});
});

describe("warm-up payload uses native multiline OpenShell exec in v2 (#4504)", () => {
it("keeps the real warm-up as one multiline command on the owning gateway (#10014)", () => {
expect(WARMUP_SCRIPT).toContain("\n");
expect(WARMUP_SCRIPT).toContain("command -v openclaw");
expect(WARMUP_SCRIPT).toContain(
`warmup_is_trusted_executable ${WARMUP_OPENCLAW_BIN} || exit 0`,
);
expect(WARMUP_SCRIPT.indexOf("warmup_is_trusted_executable")).toBeLessThan(
WARMUP_SCRIPT.indexOf(buildTrustedProxyEnvSourceShell()),
);
expect(WARMUP_SCRIPT).not.toContain("command -v openclaw");
expect(WARMUP_SCRIPT).not.toContain("base64 -d");
expect(WARMUP_SCRIPT).not.toContain("mktemp");
expect(sandboxWarmupExecArgs("alpha", "nemoclaw-19000", WARMUP_SCRIPT)).toEqual([
Expand Down Expand Up @@ -88,7 +95,7 @@ describe("warm-up tags its throwaway session for user-facing filters (#5511)", (
it("tags the provoke session with the shared warm-up prefix", () => {
expect(WARMUP_SESSION_ID_PREFIX).toBe("nemoclaw-onboard-warmup-");
expect(WARMUP_SCRIPT).toContain(
`session_key="agent:main:${WARMUP_SESSION_ID_PREFIX}$$-$(date +%s)"`,
`session_key="agent:main:${WARMUP_SESSION_ID_PREFIX}$$-$(/bin/date +%s)"`,
);
});

Expand Down Expand Up @@ -201,7 +208,8 @@ describe("warm-up tags its throwaway session for user-facing filters (#5511)", (
);

try {
const result = spawnSync("sh", ["-c", WARMUP_SCRIPT], {
const script = useWarmupExecutableFixture(WARMUP_SCRIPT, path.join(binDir, "openclaw"));
const result = spawnSync("sh", ["-c", script], {
encoding: "utf-8",
env: {
...process.env,
Expand All @@ -223,7 +231,7 @@ describe("warm-up tags its throwaway session for user-facing filters (#5511)", (
20_000,
);

itWithSh("uses device auth after consuming the trusted proxy environment (#10014)", () => {
itWithSh("keeps trusted gateway auth for initial device pairing (#10014)", () => {
const fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-warmup-producer-"));
const binDir = path.join(fixtureRoot, "bin");
const proxyEnv = path.join(fixtureRoot, "proxy-env.sh");
Expand All @@ -240,35 +248,38 @@ describe("warm-up tags its throwaway session for user-facing filters (#5511)", (
"export NEMOCLAW_OPENCLAW_FORCE_DEVICE_PAIRING=ambient-force-marker",
"export NEMOCLAW_OPENCLAW_RESTORED_CLONE_PAIRING=ambient-clone-marker",
"export NEMOCLAW_OPENCLAW_PAIRING_SETTLEMENT=ambient-settlement-marker",
'printf \'consumed\\n\' > "$NEMOCLAW_TEST_PROXY_SOURCE_LOG"',
"printf 'consumed\\n' > \"$NEMOCLAW_TEST_PROXY_SOURCE_LOG\"",
"",
].join("\n"),
{ mode: 0o444 },
);
fs.writeFileSync(
path.join(binDir, "openclaw"),
[
"#!/bin/sh",
"{",
" printf 'url=%s\\n' \"${OPENCLAW_GATEWAY_URL-unset}\"",
" printf 'port=%s\\n' \"${OPENCLAW_GATEWAY_PORT-unset}\"",
" printf 'token=%s\\n' \"${OPENCLAW_GATEWAY_TOKEN-unset}\"",
" printf 'password=%s\\n' \"${OPENCLAW_GATEWAY_PASSWORD-unset}\"",
" printf 'force=%s\\n' \"${NEMOCLAW_OPENCLAW_FORCE_DEVICE_PAIRING-unset}\"",
" printf 'restored=%s\\n' \"${NEMOCLAW_OPENCLAW_RESTORED_CLONE_PAIRING-unset}\"",
" printf 'settlement=%s\\n' \"${NEMOCLAW_OPENCLAW_PAIRING_SETTLEMENT-unset}\"",
" printf 'argv=%s\\n' \"$*\"",
'} > "$NEMOCLAW_TEST_CALL_LOG"',
"exit 1",
"",
].join("\n"),
[
"#!/bin/sh",
"{",
" printf 'url=%s\\n' \"${OPENCLAW_GATEWAY_URL-unset}\"",
" printf 'port=%s\\n' \"${OPENCLAW_GATEWAY_PORT-unset}\"",
" printf 'token=%s\\n' \"${OPENCLAW_GATEWAY_TOKEN-unset}\"",
" printf 'password=%s\\n' \"${OPENCLAW_GATEWAY_PASSWORD-unset}\"",
" printf 'force=%s\\n' \"${NEMOCLAW_OPENCLAW_FORCE_DEVICE_PAIRING-unset}\"",
" printf 'restored=%s\\n' \"${NEMOCLAW_OPENCLAW_RESTORED_CLONE_PAIRING-unset}\"",
" printf 'settlement=%s\\n' \"${NEMOCLAW_OPENCLAW_PAIRING_SETTLEMENT-unset}\"",
" printf 'argv=%s\\n' \"$*\"",
'} > "$NEMOCLAW_TEST_CALL_LOG"',
"exit 1",
"",
].join("\n"),
{ mode: 0o700 },
);

try {
const script = WARMUP_SCRIPT.replace(
buildTrustedProxyEnvSourceShell(),
buildTrustedProxyEnvSourceShell(proxyEnv),
const script = useWarmupExecutableFixture(
WARMUP_SCRIPT.replace(
buildTrustedProxyEnvSourceShell(),
buildTrustedProxyEnvSourceShell(proxyEnv),
),
path.join(binDir, "openclaw"),
);
const result = spawnSync("sh", ["-c", script], {
encoding: "utf-8",
Expand All @@ -284,7 +295,120 @@ describe("warm-up tags its throwaway session for user-facing filters (#5511)", (
expect(result.status, result.stderr).toBe(0);
expect(fs.readFileSync(sourceLog, "utf8")).toBe("consumed\n");
expect(fs.readFileSync(callLog, "utf8")).toMatch(
/^url=unset\nport=unset\ntoken=unset\npassword=unset\nforce=1\nrestored=unset\nsettlement=unset\nargv=gateway call sessions\.create --params \{"key":"agent:main:nemoclaw-onboard-warmup-\d+-\d+","agentId":"main"\} --json\n$/,
/^url=unset\nport=18789\ntoken=shared-token\npassword=shared-password\nforce=1\nrestored=unset\nsettlement=unset\nargv=gateway call sessions\.create --params \{"key":"agent:main:nemoclaw-onboard-warmup-\d+-\d+","agentId":"main"\} --json\n$/,
);
} finally {
fs.rmSync(fixtureRoot, { recursive: true, force: true });
}
});

itWithSh("rejects an untrusted warm-up executable before sourcing gateway credentials", () => {
const fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-warmup-trust-"));
const openClaw = path.join(fixtureRoot, "openclaw");
const proxyEnv = path.join(fixtureRoot, "proxy-env.sh");
const sourceLog = path.join(fixtureRoot, "source.log");
const callLog = path.join(fixtureRoot, "call.log");
fs.writeFileSync(
openClaw,
["#!/bin/sh", 'printf called > "$NEMOCLAW_TEST_CALL_LOG"', ""].join("\n"),
{ mode: 0o755 },
);
fs.writeFileSync(
proxyEnv,
[
"export OPENCLAW_GATEWAY_TOKEN=shared-token",
'printf consumed > "$NEMOCLAW_TEST_PROXY_SOURCE_LOG"',
"",
].join("\n"),
{ mode: 0o444 },
);

try {
const script = WARMUP_SCRIPT.replaceAll(WARMUP_OPENCLAW_BIN, openClaw).replace(
buildTrustedProxyEnvSourceShell(),
buildTrustedProxyEnvSourceShell(proxyEnv),
);
const result = spawnSync("sh", ["-c", script], {
encoding: "utf-8",
env: {
...process.env,
NEMOCLAW_TEST_CALL_LOG: callLog,
NEMOCLAW_TEST_PROXY_SOURCE_LOG: sourceLog,
},
timeout: 10_000,
});

expect(result.status, result.stderr).toBe(0);
expect(fs.existsSync(sourceLog)).toBe(false);
expect(fs.existsSync(callLog)).toBe(false);
} finally {
fs.rmSync(fixtureRoot, { recursive: true, force: true });
}
});

itWithSh("does not pass gateway credentials to an OpenClaw program earlier in PATH", () => {
const fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-warmup-path-"));
const pathBinDir = path.join(fixtureRoot, "path-bin");
const trustedBinDir = path.join(fixtureRoot, "trusted-bin");
const proxyEnv = path.join(fixtureRoot, "proxy-env.sh");
const pathLog = path.join(fixtureRoot, "path.log");
const trustedLog = path.join(fixtureRoot, "trusted.log");
fs.mkdirSync(pathBinDir);
fs.mkdirSync(trustedBinDir);
fs.writeFileSync(
proxyEnv,
[
"export OPENCLAW_GATEWAY_TOKEN=shared-token",
"export OPENCLAW_GATEWAY_PASSWORD=shared-password",
"",
].join("\n"),
{ mode: 0o444 },
);
fs.writeFileSync(
path.join(pathBinDir, "openclaw"),
[
"#!/bin/sh",
'printf \'token=%s password=%s\\n\' "${OPENCLAW_GATEWAY_TOKEN-unset}" "${OPENCLAW_GATEWAY_PASSWORD-unset}" > "$NEMOCLAW_TEST_PATH_LOG"',
"exit 0",
"",
].join("\n"),
{ mode: 0o700 },
);
const trustedOpenClaw = path.join(trustedBinDir, "openclaw");
fs.writeFileSync(
trustedOpenClaw,
[
"#!/bin/sh",
'printf \'token=%s password=%s\\n\' "${OPENCLAW_GATEWAY_TOKEN-unset}" "${OPENCLAW_GATEWAY_PASSWORD-unset}" > "$NEMOCLAW_TEST_TRUSTED_LOG"',
"exit 0",
"",
].join("\n"),
{ mode: 0o700 },
);

try {
const script = useWarmupExecutableFixture(
WARMUP_SCRIPT.replace(
buildTrustedProxyEnvSourceShell(),
buildTrustedProxyEnvSourceShell(proxyEnv),
),
trustedOpenClaw,
);
const result = spawnSync("sh", ["-c", script], {
encoding: "utf-8",
env: {
...process.env,
NEMOCLAW_TEST_PATH_LOG: pathLog,
NEMOCLAW_TEST_TRUSTED_LOG: trustedLog,
PATH: `${pathBinDir}:${process.env.PATH ?? "/usr/bin:/bin"}`,
},
timeout: 10_000,
});

expect(result.status, result.stderr).toBe(0);
expect(fs.existsSync(pathLog)).toBe(false);
expect(fs.readFileSync(trustedLog, "utf8")).toBe(
"token=shared-token password=shared-password\n",
);
} finally {
fs.rmSync(fixtureRoot, { recursive: true, force: true });
Expand All @@ -302,7 +426,7 @@ describe("warm-up tags its throwaway session for user-facing filters (#5511)", (
"sh",
[
"-c",
WARMUP_SCRIPT.replace(
useWarmupExecutableFixture(WARMUP_SCRIPT, "/usr/bin/true").replace(
buildTrustedProxyEnvSourceShell(),
buildTrustedProxyEnvSourceShell(unsafeProxy),
),
Expand Down
Loading
Loading