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
10 changes: 5 additions & 5 deletions agents/hermes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Layers PR-specific code (plugin, config, startup script) on top of the
# pre-built Hermes base image. Mirrors the OpenClaw Dockerfile structure.

ARG BASE_IMAGE=ghcr.io/nvidia/nemoclaw/hermes-sandbox-base@sha256:d6ce792eb302a73fc7e32e6ade18dcf21aaa425bcecdde8999e90b437fb6186a
ARG BASE_IMAGE=ghcr.io/nvidia/nemoclaw/hermes-sandbox-base@sha256:fa05221f5c7bcafea7e263c84e5d06f87e37d1ccb78dc28c113f1a4066aa544c

# hadolint ignore=DL3006
FROM ${BASE_IMAGE}
Expand Down Expand Up @@ -175,7 +175,7 @@ RUN chmod 755 /usr/local/bin/nemoclaw-start /usr/local/lib/nemoclaw/sandbox-init
RUN test -x /usr/local/lib/nemoclaw/validate-hermes-env-secret-boundary.py \
|| { echo "ERROR: validate-hermes-env-secret-boundary.py missing or not executable" >&2; exit 1; }

# Hermes v0.17.0 computes `sessions list` preview from the first user message,
# Hermes v0.18.0 computes `sessions list` preview from the first user message,
# while #5254's user-facing expectation is that the existing row reflects the
# latest resumed/continued one-shot turn. Patch only the pinned query shape and
# prove the SessionDB list contract at build time so a Hermes update cannot
Expand Down Expand Up @@ -203,7 +203,7 @@ PY
# chain tampering of the build context (an attacker rewriting the file has to
# also rewrite the Dockerfile-committed hash, which reviewers gate). Regenerate
# with `sha256sum agents/hermes/{hermes-wrapper.py,validate-env-secret-boundary.py}`.
ARG NEMOCLAW_HERMES_WRAPPER_SHA256=34ef50ea993c776f28312bcf659e908eeae3c07e4094a49e513cb320eee6538f
ARG NEMOCLAW_HERMES_WRAPPER_SHA256=ec8b0e4d6254175929d5a02240acd6af25e94774a30b36ba5c6f5a69c32fb9d7
ARG NEMOCLAW_HERMES_VALIDATOR_SHA256=970d7ff03bc409ff1d5ca46bfdbd2a42ac28a32a810ccc147a508301bff38496
# hadolint ignore=DL4006
RUN printf '%s %s\n' \
Expand Down Expand Up @@ -232,10 +232,10 @@ RUN hermes_version_output="$(/usr/local/bin/hermes --version)" \
echo "ERROR: could not parse Hermes semver from: $hermes_version_output" >&2; \
exit 1; \
fi \
&& if [ "$hermes_semver" != "0.17.0" ] \
&& if [ "$hermes_semver" != "0.18.0" ] \
&& { grep -q '_translate_resumed_oneshot' /usr/local/lib/nemoclaw/hermes-wrapper.py \
|| grep -q 'EXPECTED_OCCURRENCES' /usr/local/lib/nemoclaw/patch-hermes-session-list-preview.py; }; then \
echo "ERROR: installed Hermes ${hermes_semver} but Hermes v0.17.0 compatibility workarounds are still installed; re-review #5254 workaround removal before upgrading Hermes" >&2; \
echo "ERROR: installed Hermes ${hermes_semver} but Hermes v0.18.0 compatibility workarounds are still installed; re-review #5254 workaround removal before upgrading Hermes" >&2; \
exit 1; \
fi
# This runs before `/usr/local/bin/hermes` is moved to `hermes.real`, so the
Expand Down
10 changes: 5 additions & 5 deletions agents/hermes/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ ENV DEBIAN_FRONTEND=noninteractive
# pyproject.toml, HERMES_TARBALL_SHA256 the GitHub tarball checksum, and
# HERMES_NPM_INTEGRITY the `npm view hermes-agent@<semver> dist.integrity`
# sha512 used as a registry cross-check at build time.
# Calver tag v2026.6.19 = Hermes Agent v0.17.0.
ARG HERMES_VERSION=v2026.6.19
ARG HERMES_SEMVER=0.17.0
ARG HERMES_TARBALL_SHA256=69b805ec0a7a7be880068ba8a3b17479d7ba29f0cac0a2e9c6692c02f346ba91
ARG HERMES_NPM_INTEGRITY=sha512-PzSJiYqmwpTudmakYs2oCJ57OW3VwEJYf8buTuKvuRvcYEUf/KOTu2dD6pLf2XYgDKErpvcDaoSAJ1nGCyvzAA==
# Calver tag v2026.7.1 = Hermes Agent v0.18.0.
ARG HERMES_VERSION=v2026.7.1
ARG HERMES_SEMVER=0.18.0
ARG HERMES_TARBALL_SHA256=ec8a380629cc2f3f2102dd92cad50c4ded706fe59c0e359a05681166a0ae2991
ARG HERMES_NPM_INTEGRITY=sha512-fS+8MsE69shNPmFnKDrE1a+KUDEEXgbyN/QM7J+2nh294gTjh2wCknk2tfMsD03GhSxl7YwyDmp6e5HLYzw8yA==
ARG HERMES_UV_EXTRAS="anthropic messaging web pty mcp"
ARG UV_VERSION=0.11.8

Expand Down
6 changes: 5 additions & 1 deletion agents/hermes/config/hermes-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function buildHermesConfig(
};

const config: Record<string, unknown> = {
_config_version: 30,
_config_version: 32,
_nemoclaw_upstream: upstream,
model: modelConfig,
providers: {
Expand All @@ -117,6 +117,10 @@ export function buildHermesConfig(
agent: {
max_turns: 60,
reasoning_effort: "medium",
// Hermes config migrations v30 -> v32 disable the old implicit
// verify-on-stop behavior once. Generated configs start at v32, so
// persist the same migrated value instead of inheriting "auto".
verify_on_stop: false,
},
tools: {
tool_search: {
Expand Down
6 changes: 3 additions & 3 deletions agents/hermes/hermes-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ def _run_gateway_guard(guard_path: str) -> int:
"--resume": "--resume",
}
# Keep this allowlist aligned with the top-level flags accepted by the pinned
# Hermes Agent CLI in agents/hermes/Dockerfile.base (HERMES_VERSION=v2026.6.19,
# HERMES_SEMVER=0.17.0) and agents/hermes/manifest.yaml (expected_version
# "0.17.0"). Unknown flags deliberately fail closed by passing the original argv
# Hermes Agent CLI in agents/hermes/Dockerfile.base (HERMES_VERSION=v2026.7.1,
# HERMES_SEMVER=0.18.0) and agents/hermes/manifest.yaml (expected_version
# "0.18.0"). Unknown flags deliberately fail closed by passing the original argv
# through to upstream Hermes.
_BOOLEAN_FLAGS = {
"--worktree",
Expand Down
6 changes: 3 additions & 3 deletions agents/hermes/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ homepage: "https://github.com/NousResearch/hermes-agent"
install_method: curl # curl install.sh | bash
binary_path: /usr/local/bin/hermes
version_command: "hermes --version"
expected_version: "0.17.0"
# Hermes reports semver from `hermes --version` (e.g. `0.17.0`) even though its
# GitHub release cadence is calendar-based (`v2026.6.19`). Declaring the
expected_version: "0.18.0"
# Hermes reports semver from `hermes --version` (e.g. `0.18.0`) even though its
# GitHub release cadence is calendar-based (`v2026.7.1`). Declaring the
# scheme keeps the staleness check off the shape heuristic when a manifest
# could otherwise straddle both schemes (#6049).
version_scheme: semver
Expand Down
4 changes: 2 additions & 2 deletions agents/hermes/patch-session-list-preview.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Patch pinned Hermes v0.17.0 session-list previews to show the latest user turn.
"""Patch pinned Hermes v0.18.0 session-list previews to show the latest user turn.

Source-of-truth note for this localized Hermes runtime patch:
- Invalid state: Hermes v0.17.0 computes `sessions list` preview text from
- Invalid state: Hermes v0.18.0 computes `sessions list` preview text from
the first user message, but #5254's resumed/continued one-shot UX expects
the original row to reflect the latest appended turn.
- Value being patched: pinned/prebuilt `/opt/hermes/hermes_state.py`
Expand Down
5 changes: 5 additions & 0 deletions docs/manage-sandboxes/messaging-channels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ When both Slack allowlists are set, NemoClaw requires the mention to come from o
Channel messages still require an explicit bot mention.
When a Slack channel `@mention` is denied by these allowlists, NemoClaw sends a denial notice back to the sender instead of dropping the message silently.
During sandbox startup, NemoClaw normalizes OpenShell credential placeholders into the environment shape expected by the Slack runtime, so post-rebuild Slack starts use the gateway-managed tokens instead of literal placeholder strings.
<AgentOnly variant="hermes">
NemoClaw enables rich Slack rendering for Hermes.
Final responses can use Slack Block Kit, including native table blocks for Markdown tables.
This uses the existing Slack credentials and does not require additional scopes or reinstalling the Slack app.
</AgentOnly>
Slack Socket Mode allows one active connection per app-level token.
If another sandbox on the same gateway already uses the same Slack app token, onboarding and `channels add slack` warn before continuing in interactive mode and abort in non-interactive mode.
Use `--force` only when you intentionally want to move the Slack Socket Mode session to the new sandbox.
Expand Down
1 change: 1 addition & 0 deletions src/lib/messaging/channels/manifests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ describe("built-in channel manifests", () => {
expect(renderJson(slackManifest)).toContain('"path":"channels.slack"');
expect(renderJson(slackManifest)).toContain('"accounts"');
expect(renderJson(slackManifest)).toContain("allowedIds.slack.channels");
expect(renderJson(slackManifest)).toContain('"rich_blocks":true');
expectSlackSocketModeGatewayConflictHook();
expectOpenClawNodePreload(slackManifest, "slack-channel-guard");
expect(JSON.stringify(slackManifest.runtime?.openclaw)).toContain("slack-channel-guard");
Expand Down
3 changes: 3 additions & 0 deletions src/lib/messaging/channels/slack/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ export const slackManifest = {
path: "platforms.slack",
value: {
enabled: true,
extra: {
rich_blocks: true,
},
},
},
},
Expand Down
118 changes: 118 additions & 0 deletions src/lib/messaging/compiler/workflow-planner-hermes-slack.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { describe, expect, it } from "vitest";

import { applyMessagingAgentRenderToObject } from "../applier/build/messaging-build-applier.mts";
import {
createBuiltInChannelManifestRegistry,
createBuiltInRenderTemplateResolver,
} from "../channels";
import { createBuiltInMessagingHookRegistry } from "../hooks";
import type { SandboxMessagingPlan } from "../manifest";
import { MessagingWorkflowPlanner } from "./workflow-planner";

const TEST_CREDENTIALS: Readonly<Record<string, string>> = {
SLACK_BOT_TOKEN: "xoxb-test-slack-token",
SLACK_APP_TOKEN: "xapp-test-slack-token",
};

function planner(): MessagingWorkflowPlanner {
return new MessagingWorkflowPlanner(
createBuiltInChannelManifestRegistry(),
createBuiltInMessagingHookRegistry({
common: {
env: {},
getCredential: (key) => TEST_CREDENTIALS[key] ?? null,
saveCredential: () => {},
prompt: async () => "unused",
log: () => {},
},
slack: {
validateCredentials: {
log: () => {},
validateCredentials: () => ({ ok: true }),
},
},
}),
createBuiltInRenderTemplateResolver(),
);
}

function renderHermesPlatforms(plan: SandboxMessagingPlan): Record<string, unknown> {
const config: { platforms: Record<string, unknown> } = { platforms: {} };
applyMessagingAgentRenderToObject(config, plan, "~/.hermes/config.yaml");
return config.platforms;
}

function sandboxEntry(plan: SandboxMessagingPlan) {
return {
name: "demo",
messaging: { schemaVersion: 1 as const, plan },
};
}

describe("Hermes Slack lifecycle rendering", () => {
it("renders rich blocks only while Slack is active and removes every Slack entry (#6443)", async () => {
const lifecyclePlanner = planner();
const existingPlan = await lifecyclePlanner.buildPlan({
sandboxName: "demo",
agent: "hermes",
workflow: "onboard",
isInteractive: false,
configuredChannels: ["slack"],
credentialAvailability: {
SLACK_BOT_TOKEN: true,
SLACK_APP_TOKEN: true,
},
});

expect(renderHermesPlatforms(existingPlan).slack).toEqual({
enabled: true,
extra: { rich_blocks: true },
});

const stopped = await lifecyclePlanner.buildChannelStopPlanFromSandboxEntry({
sandboxName: "demo",
agent: "hermes",
sandboxEntry: sandboxEntry(existingPlan),
channelId: "slack",
});

expect(stopped?.channels.find((channel) => channel.channelId === "slack")).toMatchObject({
active: false,
disabled: true,
});
expect(renderHermesPlatforms(stopped!).slack).toBeUndefined();

const started = await lifecyclePlanner.buildChannelStartPlanFromSandboxEntry({
sandboxName: "demo",
agent: "hermes",
sandboxEntry: sandboxEntry(stopped!),
channelId: "slack",
});

expect(started?.channels.find((channel) => channel.channelId === "slack")).toMatchObject({
active: true,
disabled: false,
});
expect(renderHermesPlatforms(started!).slack).toEqual({
enabled: true,
extra: { rich_blocks: true },
});

const removed = await lifecyclePlanner.buildChannelRemovePlanFromSandboxEntry({
sandboxName: "demo",
agent: "hermes",
sandboxEntry: sandboxEntry(started!),
channelId: "slack",
});

expect(removed?.workflow).toBe("remove-channel");
expect(removed?.channels).toEqual([]);
expect(renderHermesPlatforms(removed!).slack).toBeUndefined();
expect(removed?.credentialBindings.some((entry) => entry.channelId === "slack")).toBe(false);
expect(removed?.networkPolicy.entries.some((entry) => entry.channelId === "slack")).toBe(false);
expect(removed?.agentRender.some((entry) => entry.channelId === "slack")).toBe(false);
});
});
43 changes: 43 additions & 0 deletions test/e2e/live/hermes-slack-e2e-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ else:
errors.append("platforms.slack missing or not a mapping")
elif slack.get("enabled") is not True:
errors.append(f"platforms.slack.enabled is not true ({slack!r})")
elif (
not isinstance(slack.get("extra"), dict)
or slack["extra"].get("rich_blocks") is not True
):
errors.append(f"platforms.slack.extra.rich_blocks is not true ({slack!r})")
if "SLACK_BOT_TOKEN" in config_text or "SLACK_APP_TOKEN" in config_text:
errors.append("config.yaml contains Slack token env keys")
if errors:
Expand All @@ -329,6 +334,43 @@ PY`,
expectExitZero(configProbe, "Hermes Slack config shape probe");
expect(configProbe.stdout.trim()).toBe("OK");

const rendererProbe = await sandboxEncodedSh(
sandbox,
SANDBOX_NAME,
String.raw`python3 - <<'PY'
import importlib.util
from pathlib import Path

renderer_path = Path("/opt/hermes/plugins/platforms/slack/block_kit.py")
if not renderer_path.is_file():
print(f"FAIL Hermes Slack Block Kit renderer missing: {renderer_path}")
raise SystemExit

spec = importlib.util.spec_from_file_location("hermes_slack_block_kit", renderer_path)
if spec is None or spec.loader is None:
print("FAIL cannot load Hermes Slack Block Kit renderer")
raise SystemExit
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)

markdown = "# Results\n\n| Check | Result |\n|:------|:------:|\n| Hermes | Pass |"
blocks = module.render_blocks(markdown)
types = [block.get("type") for block in blocks or []]
if "header" not in types or "table" not in types:
print(f"FAIL expected header and native table Block Kit blocks, got {types!r}")
else:
print("OK")
PY`,
[],
{
artifactName: "phase-4-rich-block-renderer",
redactionValues,
timeoutMs: 60_000,
},
);
expectExitZero(rendererProbe, "Hermes Slack Block Kit renderer probe");
expect(rendererProbe.stdout.trim()).toBe("OK");

const envProbe = await sandboxEncodedSh(
sandbox,
SANDBOX_NAME,
Expand Down Expand Up @@ -644,6 +686,7 @@ PY`,
slackProvidersCreated: true,
hermesHealthOk: true,
hermesSlackConfigShape: true,
hermesSlackRichBlockTableRendering: true,
resolverPlaceholders: true,
rawTokensAbsentFromFilesLogsAndProcesses: true,
hermesScopedSlackPolicy: true,
Expand Down
13 changes: 10 additions & 3 deletions test/generate-hermes-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ describe("agents/hermes/generate-config.ts", () => {
it("generates API server config without messaging platform token blocks", () => {
const { config, envFile } = runConfigScript();

expect(config._config_version).toBe(30);
expect(config._config_version).toBe(32);
expect(config.agent?.verify_on_stop).toBe(false);
expect(config.display).toMatchObject({
compact: false,
tool_progress: "all",
Expand Down Expand Up @@ -926,7 +927,10 @@ describe("agents/hermes/generate-config.ts", () => {

expect(config.telegram).toEqual({ require_mention: true });
expect(config.platforms.telegram).toEqual({ enabled: true });
expect(config.platforms.slack).toEqual({ enabled: true });
expect(config.platforms.slack).toEqual({
enabled: true,
extra: { rich_blocks: true },
});
expectRemotePlatformToolsets(config.platform_toolsets.telegram);
expectRemotePlatformToolsets(config.platform_toolsets.slack);
expect(envFile).toContain("TELEGRAM_BOT_TOKEN=openshell:resolve:env:TELEGRAM_BOT_TOKEN\n");
Expand All @@ -953,7 +957,10 @@ describe("agents/hermes/generate-config.ts", () => {
NEMOCLAW_MESSAGING_CHANNELS_B64: encodeJson(["slack"]),
});

expect(config.platforms.slack).toEqual({ enabled: true });
expect(config.platforms.slack).toEqual({
enabled: true,
extra: { rich_blocks: true },
});
expect(config.platforms.api_server.enabled).toBe(true);
});

Expand Down
4 changes: 2 additions & 2 deletions test/hermes-doctor-config-hash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("Hermes doctor and config hash boundary", () => {
try {
fs.mkdirSync(path.dirname(hermesBin), { recursive: true });
fs.mkdirSync(path.dirname(wrapper), { recursive: true });
fs.writeFileSync(hermesBin, "#!/usr/bin/env bash\nprintf 'hermes v0.18.0\\n'\n", {
fs.writeFileSync(hermesBin, "#!/usr/bin/env bash\nprintf 'hermes v0.19.0\\n'\n", {
mode: 0o755,
});
fs.writeFileSync(wrapper, "# wrapper fixture without resumed oneshot marker\n");
Expand All @@ -52,7 +52,7 @@ describe("Hermes doctor and config hash boundary", () => {

expect(result.status).toBe(1);
expect(result.stderr).toContain(
"Hermes v0.17.0 compatibility workarounds are still installed",
"Hermes v0.18.0 compatibility workarounds are still installed",
);
} finally {
fs.rmSync(tmp, { recursive: true, force: true });
Expand Down
Loading
Loading