An OpenClaw-only OTEL variable aborts a Hermes, Deep Agents Code or Pi onboard with a Dockerfile ARG error
Description
NEMOCLAW_OPENCLAW_OTEL, NEMOCLAW_OPENCLAW_OTEL_ENDPOINT, NEMOCLAW_OPENCLAW_OTEL_SERVICE_NAME, and NEMOCLAW_OPENCLAW_OTEL_SAMPLE_RATE are documented as OpenClaw-only. docs/reference/commands.mdx:4788-4793 wraps exactly those four rows in <AgentOnly variant="openclaw">, and :5051 says to set NEMOCLAW_OPENCLAW_OTEL=1 "before onboarding or rebuilding an OpenClaw sandbox".
When any one of them is exported in the operator's shell, patchStagedDockerfile aborts the onboard of every agent, not just OpenClaw:
Error: Dockerfile is missing ARG NEMOCLAW_OPENCLAW_OTEL; cannot apply value 1
Only the root Dockerfile declares those ARGs. agents/hermes/Dockerfile, agents/langchain-deepagents-code/Dockerfile, agents/pi/Dockerfile, and all four Dockerfile.base files declare none of them, so a Hermes, Deep Agents Code, or Pi onboard cannot succeed while the variable is set. The message names a Dockerfile-authoring mistake, which sends the operator to a checked-in Dockerfile that is correct as written; the actual problem is that a variable belonging to a different agent is set.
src/lib/onboard/dockerfile-patch.ts:497-511 (current main):
for (const envKey of [
"NEMOCLAW_OPENCLAW_OTEL",
"NEMOCLAW_OPENCLAW_OTEL_ENDPOINT",
"NEMOCLAW_OPENCLAW_OTEL_SERVICE_NAME",
"NEMOCLAW_OPENCLAW_OTEL_SAMPLE_RATE",
]) {
const rawValue = process.env[envKey];
if (rawValue !== undefined && rawValue.trim() !== "") {
const argPattern = new RegExp(`^ARG ${envKey}=.*$`, "m");
if (!argPattern.test(dockerfile)) {
throw new Error(`Dockerfile is missing ARG ${envKey}; cannot apply value ${rawValue}`);
}
dockerfile = dockerfile.replace(argPattern, `ARG ${envKey}=${sanitizeDockerArg(rawValue)}`);
}
}
The loop never consults options.agentName, although patchStagedDockerfile receives it. src/lib/onboard/sandbox-dockerfile-patch-flow.ts:190 computes const managedAgentName = agent?.name ?? "openclaw" and passes it at :212 as agentName, so the identity of the staged Dockerfile is available at the throw site.
Two comments in the same file describe the opposite convention for the sibling patches: :324 "The replace is a silent no-op when the staged Dockerfile predates this ARG (e.g. OpenClaw)" and :558 "silent no-op on custom/legacy Dockerfiles that predate this ARG". The OTEL loop is the only agent-blind hard throw among them.
The repository already reports this class correctly on the managed startup path. src/lib/onboard/managed-startup/profile.ts:489-529 lists the four OTEL affordances under openclaw only, and the hermes, langchain-deepagents-code, and pi inventories omit them, so assertNoWrongAgentEnvironment (src/lib/onboard/managed-startup/profile-builder.ts:592-609) fails with NEMOCLAW_OPENCLAW_OTEL is not supported by hermes. A legacy-Dockerfile onboard never reaches that builder: src/lib/onboard/managed-workload/onboard-orchestration.ts:233 returns null from ensurePreparedProfile for workload.source.kind !== "managed-image", and :187 sets managedImages: null for a stock onboard, so the workload resolves to legacy-dockerfile. The two paths therefore disagree about the same operator mistake.
Issue #5729 records the same defect class from this same function, reporting Dockerfile is missing ARG NEMOCLAW_MESSAGING_PLAN_B64 for a Deep Agents Code sandbox. It was completed.
Steps to Reproduce
export NEMOCLAW_OPENCLAW_OTEL=1
nemoclaw onboard --agent hermes
The same failure occurs with --agent langchain-deepagents-code, with --agent pi, and with any of the other three NEMOCLAW_OPENCLAW_OTEL_* variables.
Reproduced against source without Docker, using the checked-in agents/hermes/Dockerfile as the staged Dockerfile and calling patchStagedDockerfile(..., { agentName }) directly:
hermes: Dockerfile is missing ARG NEMOCLAW_OPENCLAW_OTEL; cannot apply value 1
langchain-deepagents-code: Dockerfile is missing ARG NEMOCLAW_OPENCLAW_OTEL; cannot apply value 1
pi: Dockerfile is missing ARG NEMOCLAW_OPENCLAW_OTEL; cannot apply value 1
openclaw: Dockerfile is missing ARG NEMOCLAW_OPENCLAW_OTEL; cannot apply value 1
Supporting count of the ARG across every checked-in Dockerfile:
4 Dockerfile
0 Dockerfile.base
0 agents/hermes/Dockerfile
0 agents/hermes/Dockerfile.base
0 agents/langchain-deepagents-code/Dockerfile
0 agents/langchain-deepagents-code/Dockerfile.base
0 agents/pi/Dockerfile
0 agents/pi/Dockerfile.base
0 managed-inference/images/llama-cpp/Dockerfile
Expected Result
A Hermes, Deep Agents Code, or Pi onboard reports that the OpenClaw-only variable is not supported by the selected agent, in the same wording the managed startup path already uses, so the operator knows to unset the variable.
Actual Result
The onboard aborts with an internal Dockerfile-authoring message about a checked-in Dockerfile that is correct as written.
Environment
Branch: main
Commit: d583fa10f
Platform: macOS 26.5.1 (Darwin 25.5.0, arm64), source checkout
Node.js: v26.7.0
Notes
Not a security issue. The onboard fails closed either way; only the diagnostic is wrong.
Please correct the description.
@wscurran thanks for flagging this, and sorry for the slow reply. The description has been corrected: the two stray heading lines at the top are gone, so the body now starts at ## Description, and the environment block had the wrong operating-system version, which is also fixed.
One question before I stop tracking this. The report was closed as completed, but the behaviour still looks present on main. On 3184db96e:
$ git show main:src/lib/onboard/dockerfile-patch.ts | grep -n 'Dockerfile is missing ARG ${envKey}'
569: throw new Error(`Dockerfile is missing ARG ${envKey}; cannot apply value ${rawValue}`);
That throw still runs for every agent, and main has no agent-scoped branch beside it. So a Hermes, Deep Agents Code, or Pi onboard with NEMOCLAW_OPENCLAW_OTEL exported still aborts with the Dockerfile-authoring message rather than the agent-mismatch message the managed startup path uses.
If the intent was that the diagnostic is not worth changing, that is a fine answer and I will withdraw the open pull request that references this report. If the closure was housekeeping, the pull request is ready apart from one merge conflict in a test fixture. Either way I would rather hear it than guess.