Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
38aa321
fix(messaging): load the default runtime plan
apurvvkumaria Sep 3, 2026
50e7009
merge: update messaging fallback branch
apurvvkumaria Sep 3, 2026
f54bf90
merge: update messaging fallback branch
apurvvkumaria Sep 4, 2026
b3216c4
merge: update messaging extras fix from main
apurvvkumaria Sep 4, 2026
ffaac26
Merge branch 'main' into codex/fix-messaging-extras-signal
prekshivyas Sep 5, 2026
0435f01
test(e2e): resolve Slack proof workspace through the real OpenClaw root
AzeelSajjad Sep 3, 2026
b3315dc
merge: update messaging fallback from main
prekshivyas Sep 5, 2026
a50e935
test(e2e): resolve Telegram proof through installed root
prekshivyas Sep 5, 2026
29a1ac8
merge: reconcile messaging E2E repair
prekshivyas Sep 5, 2026
a9bd888
test(e2e): remove Slack proof workspaces
prekshivyas Sep 5, 2026
f0a2a9b
test(e2e): resolve Slack through installed root
prekshivyas Sep 5, 2026
8d5eccd
test(e2e): resolve WeChat through managed install
prekshivyas Sep 5, 2026
43e839b
test(e2e): follow installed Slack dependency symlinks
prekshivyas Sep 5, 2026
22bad3d
Merge remote-tracking branch 'origin/codex/fix-messaging-extras-signa…
prekshivyas Sep 5, 2026
4becb04
test(e2e): keep WeChat proof self-contained
prekshivyas Sep 5, 2026
90d4618
test(e2e): wait for WeChat fixture reachability
prekshivyas Sep 5, 2026
6fcecd3
test(e2e): wait for WeChat policy settlement
prekshivyas Sep 5, 2026
f317a67
test(e2e): use http transport for WeChat fixture
prekshivyas Sep 5, 2026
2728b32
test(e2e): bound WeChat fixture requests
prekshivyas Sep 5, 2026
b0e9345
test(e2e): preserve WeChat fixture request framing
prekshivyas Sep 5, 2026
bb67c91
test(e2e): restore WeChat policy relay
prekshivyas Sep 5, 2026
9928809
test(e2e): name WeChat relay proof precisely
prekshivyas Sep 5, 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 ci/e2e-assertion-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"objectFieldAssertions": 348,
"assertionPoints": 4411,
"generatedProbeBlocks": 290,
"generatedProbeConditions": 980
"generatedProbeConditions": 975
},
"fileMetricOrder": [
"directExpectCalls",
Expand Down
2 changes: 1 addition & 1 deletion ci/test-file-size-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"src/lib/onboard/preflight.test.ts": 1875,
"test/generation/generate-openclaw-config.test.ts": 1898,
"test/installer-integration/install-preflight.test.ts": 3025,
"test/agents/openclaw/runtime/nemoclaw-start.test.ts": 4383,
"test/agents/openclaw/runtime/nemoclaw-start.test.ts": 4377,
"test/onboarding/onboard-messaging.test.ts": 1971,
"test/onboarding/onboard-selection.test.ts": 4176
}
Expand Down
8 changes: 4 additions & 4 deletions scripts/nemoclaw-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1449,11 +1449,11 @@ def read_messaging_plan():
return json.loads(base64.b64decode(raw_plan).decode("utf-8"))
except Exception:
return None
artifact_path = os.environ.get(
"NEMOCLAW_MESSAGING_RUNTIME_PLAN_PATH",
MESSAGING_RUNTIME_PLAN_DEFAULT_PATH,
artifact_path = (
os.environ.get("NEMOCLAW_MESSAGING_RUNTIME_PLAN_PATH", "").strip()
or MESSAGING_RUNTIME_PLAN_DEFAULT_PATH
)
if not artifact_path or not os.path.isfile(artifact_path):
if not os.path.isfile(artifact_path):
return None
try:
with open(artifact_path, encoding="utf-8") as f:
Expand Down
32 changes: 13 additions & 19 deletions test/agents/openclaw/runtime/nemoclaw-start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2328,19 +2328,21 @@ describe("provider placeholder refresh (#4251)", () => {
config: unknown,
env: Record<string, string> = {},
rootMode = false,
runtimePlan: unknown = { credentialBindings: [] },
): { config: any; handoffEnv: string; hash: string; result: ReturnType<typeof spawnSync> } {
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-provider-placeholders-"));
const openclawDir = path.join(tmpDir, ".openclaw");
const configPath = path.join(openclawDir, "openclaw.json");
const hashPath = path.join(openclawDir, ".config-hash");
const handoffEnvPath = path.join(tmpDir, "handoff-env");
const runtimePlanPath = path.join(tmpDir, "messaging-runtime-plan.json");
const scriptPath = path.join(tmpDir, "run.sh");
fs.mkdirSync(openclawDir, { recursive: true });
fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`);
const fn = extractShellFunctionFromSource(
src,
"refresh_openclaw_provider_placeholders",
).replaceAll("/sandbox/.openclaw", openclawDir);
fs.writeFileSync(runtimePlanPath, JSON.stringify(runtimePlan));
const fn = extractShellFunctionFromSource(src, "refresh_openclaw_provider_placeholders")
.replaceAll("/sandbox/.openclaw", openclawDir)
.replaceAll("/usr/local/share/nemoclaw/messaging-runtime-plan.json", runtimePlanPath);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
fs.writeFileSync(
scriptPath,
[
Expand Down Expand Up @@ -2606,27 +2608,19 @@ describe("provider placeholder refresh (#4251)", () => {
);
});

it("emits the deterministic accepted-extras breadcrumb so e2e harnesses can prove env-arg propagation", () => {
it("emits the accepted-extras signal from canonical keys in the default runtime plan (#10967)", () => {
const run = runRefresh(
{},
{
channels: {
telegram: {
accounts: {
default: { botToken: "openshell:resolve:env:TELEGRAM_BOT_TOKEN" },
},
},
},
},
{
NEMOCLAW_MESSAGING_PLAN_B64: placeholderPlan(["TELEGRAM_BOT_TOKEN", "SLACK_BOT_TOKEN"]),
NEMOCLAW_EXTRA_PLACEHOLDER_KEYS: "TELEGRAM_BOT_TOKEN_AGENT_A SLACK_BOT_TOKEN_AGENT_B",
NEMOCLAW_MESSAGING_RUNTIME_PLAN_PATH: "",
NEMOCLAW_EXTRA_PLACEHOLDER_KEYS: "TELEGRAM_BOT_TOKEN_AGENT_A",
},
false,
{ credentialBindings: [{ providerEnvKey: "TELEGRAM_BOT_TOKEN" }] },
);

expect(run.result.status, run.result.stderr).toBe(0);
expect(run.result.stderr).toMatch(
/\[config\] NEMOCLAW_EXTRA_PLACEHOLDER_KEYS accepted 2 entry\(ies\): TELEGRAM_BOT_TOKEN_AGENT_A SLACK_BOT_TOKEN_AGENT_B/,
);
expect(run.result.stderr).toMatch(/accepted 1 entry\(ies\): TELEGRAM_BOT_TOKEN_AGENT_A/u);
});

it("does not emit the accepted-extras breadcrumb when NEMOCLAW_EXTRA_PLACEHOLDER_KEYS is unset", () => {
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/live/messaging-providers-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ export async function runSandboxNode(
options: {
artifactName: string;
env?: Record<string, string>;
preserveSymlinks?: boolean;
redactionValues: string[];
sandboxName?: string;
timeoutMs?: number;
Expand All @@ -543,6 +544,7 @@ export function buildSandboxNodeInvocation(
options: {
artifactName: string;
env?: Record<string, string>;
preserveSymlinks?: boolean;
},
): string[] {
const environment = Object.entries(options.env ?? {}).map(([key, value]) => {
Expand All @@ -552,11 +554,12 @@ export function buildSandboxNodeInvocation(
return `export ${key}=${shellQuote(value)}`;
});
const scriptName = `/tmp/nemoclaw-${options.artifactName.replace(/[^a-zA-Z0-9_.-]/g, "-")}.mjs`;
const nodeOptions = options.preserveSymlinks === false ? "" : " --preserve-symlinks";
return buildSandboxShellInvocation(`
set -eu
${environment.join("\n")}
printf '%s' ${shellQuote(base64(source))} | base64 -d > ${shellQuote(scriptName)}
node --preserve-symlinks ${shellQuote(scriptName)}
node${nodeOptions} ${shellQuote(scriptName)}
`);
}

Expand Down
113 changes: 29 additions & 84 deletions test/e2e/live/messaging-providers-slack-runtime-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type InstalledSlackRuntimeProof = {
channelId: string;
};

export const SLACK_MANAGED_NPM_PROJECT_DISCOVERY_SOURCE = String.raw`
export const SLACK_RUNTIME_DISCOVERY_SOURCE = String.raw`
function addManagedNpmProjectSlackCandidates(projectsDir, addExternalCandidate) {
let entries;
try {
Expand All @@ -45,20 +45,13 @@ function addManagedNpmProjectSlackCandidates(projectsDir, addExternalCandidate)
);
}
}
`;

export const SLACK_INSTALLED_RUNTIME_PROOF_SOURCE = String.raw`
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import http from "node:http";
import { createRequire } from "node:module";
import path from "node:path";
import { pathToFileURL } from "node:url";

${SLACK_MANAGED_NPM_PROJECT_DISCOVERY_SOURCE}

function invariant(condition, message) {
if (!condition) throw new Error(message);
function resolveInstalledPackageRoot(candidate) {
try {
return fs.realpathSync(candidate);
} catch {
return candidate;
}
}

function resolveOpenClawSlackApiLocation() {
Expand Down Expand Up @@ -136,20 +129,14 @@ function resolveOpenClawSlackApiLocation() {
addCoreCandidate("/usr/local/lib/node_modules/openclaw");
addCoreCandidate("/tmp/npm-global/lib/node_modules/openclaw");

const openclawRoot = coreCandidates.find(
(candidate) =>
fs.existsSync(path.join(candidate, "package.json")) &&
fs.existsSync(path.join(candidate, "dist/plugin-sdk/temp-path.js")),
);
for (const candidate of externalCandidates) {
const distDir = path.join(candidate, "dist");
const runtimeApiPath = path.join(distDir, "runtime-api.js");
const pipelineRuntimePath = findPipelineRuntimePath(distDir);
if (fs.existsSync(runtimeApiPath) && pipelineRuntimePath) {
return {
kind: "external",
root: candidate,
openclawRoot,
root: resolveInstalledPackageRoot(candidate),
};
}
}
Expand All @@ -158,64 +145,12 @@ function resolveOpenClawSlackApiLocation() {
const runtimeApiPath = path.join(distDir, "runtime-api.js");
const pipelineRuntimePath = findPipelineRuntimePath(distDir);
if (fs.existsSync(runtimeApiPath) && pipelineRuntimePath) {
return { kind: "core", root: candidate };
return { kind: "core", root: resolveInstalledPackageRoot(candidate) };
}
}
return null;
}

function linkNodeModulesEntries(nodeModulesRoot, sourceNodeModules, skip = new Set()) {
if (!fs.existsSync(sourceNodeModules)) return;
for (const entry of fs.readdirSync(sourceNodeModules)) {
const sourceEntry = path.join(sourceNodeModules, entry);
const destEntry = path.join(nodeModulesRoot, entry);
if (entry.startsWith("@") && fs.statSync(sourceEntry).isDirectory()) {
fs.mkdirSync(destEntry, { recursive: true });
for (const scopedEntry of fs.readdirSync(sourceEntry)) {
const key = entry + "/" + scopedEntry;
if (skip.has(key)) continue;
const sourceScopedEntry = path.join(sourceEntry, scopedEntry);
const destScopedEntry = path.join(destEntry, scopedEntry);
if (!fs.existsSync(destScopedEntry)) {
fs.symlinkSync(sourceScopedEntry, destScopedEntry, "dir");
}
}
} else if (!skip.has(entry) && !fs.existsSync(destEntry)) {
fs.symlinkSync(sourceEntry, destEntry, "dir");
}
}
}

function createCoreProofRoot(openclawRoot) {
const proofWorkspace = fs.mkdtempSync("/tmp/openclaw-slack-proof-");
const proofRoot = path.join(proofWorkspace, "node_modules/openclaw");
fs.mkdirSync(proofRoot, { recursive: true });
fs.copyFileSync(path.join(openclawRoot, "package.json"), path.join(proofRoot, "package.json"));
fs.symlinkSync(path.join(openclawRoot, "dist"), path.join(proofRoot, "dist"), "dir");
const nodeModulesRoot = path.join(proofRoot, "node_modules");
fs.mkdirSync(nodeModulesRoot, { recursive: true });
linkNodeModulesEntries(nodeModulesRoot, path.join(openclawRoot, "node_modules"));
linkNodeModulesEntries(nodeModulesRoot, path.dirname(openclawRoot));
return proofRoot;
}

function createExternalProofRoot(location) {
if (!location.openclawRoot) return location.root;
const proofWorkspace = fs.mkdtempSync("/tmp/openclaw-slack-external-proof-");
const nodeModulesRoot = path.join(proofWorkspace, "node_modules");
const openclawScopeRoot = path.join(nodeModulesRoot, "@openclaw");
fs.mkdirSync(openclawScopeRoot, { recursive: true });
const slackProofRoot = path.join(openclawScopeRoot, "slack");
fs.symlinkSync(location.root, slackProofRoot, "dir");
fs.symlinkSync(location.openclawRoot, path.join(nodeModulesRoot, "openclaw"), "dir");
const skip = new Set(["openclaw", "@openclaw/slack"]);
linkNodeModulesEntries(nodeModulesRoot, path.resolve(location.root, "../.."), skip);
linkNodeModulesEntries(nodeModulesRoot, path.join(location.root, "node_modules"), skip);
linkNodeModulesEntries(nodeModulesRoot, path.dirname(location.openclawRoot), skip);
linkNodeModulesEntries(nodeModulesRoot, path.join(location.openclawRoot, "node_modules"), skip);
return slackProofRoot;
}

function findPipelineRuntimePath(slackDir) {
try {
return fs
Expand All @@ -230,7 +165,7 @@ function findPipelineRuntimePath(slackDir) {

async function importProofModules(slackDir) {
const pipelinePath = findPipelineRuntimePath(slackDir);
invariant(pipelinePath, "OpenClaw Slack pipeline runtime not found");
if (!pipelinePath) throw new Error("OpenClaw Slack pipeline runtime not found");
const [pipelineModule, runtimeModule] = await Promise.all([
import(pathToFileURL(pipelinePath).href),
import(pathToFileURL(path.join(slackDir, "runtime-api.js")).href),
Expand All @@ -240,15 +175,20 @@ async function importProofModules(slackDir) {
sendMessageSlack: runtimeModule.sendMessageSlack,
};
}
`;

async function importOpenClawSlackProofApi(location) {
const proofRoot =
location.kind === "external" ? createExternalProofRoot(location) : createCoreProofRoot(location.root);
const slackDir = path.join(
proofRoot,
location.kind === "external" ? "dist" : "dist/extensions/slack",
);
return importProofModules(slackDir);
export const SLACK_INSTALLED_RUNTIME_PROOF_SOURCE = String.raw`
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import http from "node:http";
import { createRequire } from "node:module";
import path from "node:path";
import { pathToFileURL } from "node:url";

${SLACK_RUNTIME_DISCOVERY_SOURCE}

function invariant(condition, message) {
if (!condition) throw new Error(message);
}

function postForm(pathname, fields, authorization) {
Expand Down Expand Up @@ -431,7 +371,11 @@ const appClient = {

const location = resolveOpenClawSlackApiLocation();
invariant(location, "could not find installed OpenClaw Slack proof API");
const slackApi = await importOpenClawSlackProofApi(location);
const slackDir = path.join(
location.root,
location.kind === "external" ? "dist" : "dist/extensions/slack",
);
const slackApi = await importProofModules(slackDir);
const { prepareSlackMessage, sendMessageSlack } = slackApi;
invariant(
typeof prepareSlackMessage === "function" && typeof sendMessageSlack === "function",
Expand Down Expand Up @@ -572,6 +516,7 @@ export async function runInstalledSlackRuntimeProof(
SLACK_ALLOWED_USER: allowedUser,
SLACK_DENIED_USER: "U999DENIED",
},
preserveSymlinks: false,
redactionValues,
timeoutMs: 120_000,
});
Expand Down
18 changes: 16 additions & 2 deletions test/e2e/live/messaging-providers-telegram-runtime-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ export type InstalledTelegramRuntimeProof = {
messageId: string;
};

export function resolveInstalledTelegramRuntimePath(
candidate: string,
realpath: (candidate: string) => string,
): string {
try {
return realpath(candidate);
} catch {
return candidate;
}
}

export const TELEGRAM_INSTALLED_RUNTIME_PROOF_SOURCE = String.raw`
import { execFileSync } from "node:child_process";
import fs from "node:fs";
Expand All @@ -24,6 +35,8 @@ import { createRequire } from "node:module";
import path from "node:path";
import { pathToFileURL } from "node:url";

const resolveInstalledTelegramRuntimePath = ${resolveInstalledTelegramRuntimePath.toString()};

function addPathWalk(candidates, seen, start) {
if (!start) return;
let current = path.resolve(start);
Expand Down Expand Up @@ -146,12 +159,13 @@ function requestFakeTelegram(endpoint, fields, token) {
});
}

const runtimeApiPath = resolveTelegramRuntimeApiPath();
if (!runtimeApiPath) {
const runtimeApiCandidate = resolveTelegramRuntimeApiPath();
if (!runtimeApiCandidate) {
throw new Error(
"could not find installed OpenClaw Telegram runtime-api.js at openclaw/dist/extensions/telegram/runtime-api.js",
);
}
const runtimeApiPath = resolveInstalledTelegramRuntimePath(runtimeApiCandidate, fs.realpathSync);
const { sendMessageTelegram } = await import(pathToFileURL(runtimeApiPath).href);
if (typeof sendMessageTelegram !== "function") {
throw new Error("installed Telegram runtime API does not export sendMessageTelegram");
Expand Down
Loading
Loading