Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e4db37e
chore(e2e): flip openclaw-tui-chat-correlation inventory to bridge-probe
jyaunches Jun 10, 2026
3f7c2b5
test(e2e): add SandboxClient.upload + execShell for live test fixtures
jyaunches Jun 10, 2026
fd0f7bd
test(e2e): add openclaw-tui-chat-correlation free-standing live test …
jyaunches Jun 10, 2026
f8c237f
openclaw-tui-chat-correlation: pass openclaw-version-pinned
jyaunches Jun 10, 2026
bf1a9a2
fix(e2e): SandboxClient.exec must use `-n <name>` flag form, not posi…
jyaunches Jun 10, 2026
9a6ce15
test(e2e): format migrated client test
jyaunches Jun 10, 2026
eefb9b6
ci: rerun code scanning
jyaunches Jun 10, 2026
6402c4e
chore(e2e): mark openclaw-tui-chat-correlation as covered
jyaunches Jun 10, 2026
d85ab17
ci: retry code scanning auth failure
jyaunches Jun 10, 2026
73c2dc4
ci: retry sarif upload auth failure
jyaunches Jun 10, 2026
7fc804d
test(e2e): assert chat correlation order
jyaunches Jun 10, 2026
91d08cf
test(e2e): narrow chat correlation coverage
jyaunches Jun 10, 2026
eae9fb1
test(e2e): clarify chat coverage scope
jyaunches Jun 10, 2026
233e3b7
test(e2e): simplify chat correlation coverage slice
jyaunches Jun 10, 2026
236d0e2
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-open…
jyaunches Jun 10, 2026
c656f5e
style(e2e): format chat correlation test
jyaunches Jun 10, 2026
cb7d56d
test(e2e): keep chat correlation prompts tool-free
jyaunches Jun 10, 2026
e70ec8e
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-open…
jyaunches Jun 10, 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
78 changes: 78 additions & 0 deletions .github/workflows/e2e-vitest-scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,81 @@ jobs:
include-hidden-files: false
if-no-files-found: ignore
retention-days: 14

# Migrated from test/e2e/test-openclaw-tui-chat-correlation.sh per the
# #5098 epic (#5049 free-standing pattern, #4347 owner issue). Drives a
# real cloud OpenClaw sandbox via openshell + websocket; targets the
# #2603 + #3145 chat-correlation regressions on the pinned 2026.5.27
# OpenClaw build. Bash workflow remains in nightly-e2e.yaml until soak.
openclaw-tui-chat-correlation-vitest:
runs-on: ubuntu-latest
timeout-minutes: 75
env:
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/vitest/openclaw-tui-chat-correlation
NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js
NEMOCLAW_RUN_E2E_SCENARIOS: "1"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Authenticate to Docker Hub
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
if [[ -z "${DOCKERHUB_USERNAME}" || -z "${DOCKERHUB_TOKEN}" ]]; then
echo "::notice::Docker Hub credentials not configured; continuing with anonymous pulls."
exit 0
fi
login_succeeded=0
for attempt in 1 2 3; do
if echo "${DOCKERHUB_TOKEN}" | timeout 30s docker login docker.io --username "${DOCKERHUB_USERNAME}" --password-stdin; then
login_succeeded=1
break
fi
if [[ "$attempt" -lt 3 ]]; then
echo "::warning::Docker Hub login attempt ${attempt} failed; retrying."
sleep 5
fi
done
if [[ "$login_succeeded" -ne 1 ]]; then
echo "::warning::Docker Hub login failed after 3 attempts; continuing with anonymous pulls."
fi

- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0
with:
node-version: 22
cache: npm

- name: Install root dependencies
run: npm ci --ignore-scripts

- name: Build CLI
run: npm run build:cli

- name: Run OpenClaw TUI chat correlation live test
# Onboards a fresh cloud OpenClaw sandbox, asserts the pinned
# 2026.5.27 version, drives the websocket repro, and asserts the
# #2603 + #3145 correlation contract. Mirrors the legacy
# openclaw-tui-chat-correlation-e2e job in nightly-e2e.yaml.
env:
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
run: |
set -euo pipefail
npx vitest run --project e2e-scenarios-live \
test/e2e-scenario/live/openclaw-tui-chat-correlation.test.ts \
--silent=false --reporter=default

- name: Upload OpenClaw TUI chat correlation artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-vitest-scenarios-openclaw-tui-chat-correlation
path: e2e-artifacts/vitest/openclaw-tui-chat-correlation/
include-hidden-files: false
if-no-files-found: ignore
retention-days: 14
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
73 changes: 71 additions & 2 deletions test/e2e-scenario/framework-tests/e2e-clients.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,17 @@ describe("E2E fixture clients", () => {
});
});

it("sandbox client builds OpenShell sandbox commands", async () => {
it("sandbox client builds OpenShell sandbox exec commands using -n flag form", async () => {
const runner = new FakeRunner();
const sandbox = new SandboxClient(runner, { openshellPath: "openshell" });

await sandbox.exec("assistant", ["echo", "ok"]);

// openshell sandbox exec requires the sandbox name as -n <name>;
// positional name yields exit 127 against a real openshell binary.
expect(runner.calls[0]).toEqual({
command: "openshell",
args: ["sandbox", "exec", "assistant", "--", "echo", "ok"],
args: ["sandbox", "exec", "-n", "assistant", "--", "echo", "ok"],
options: {
artifactName: "sandbox-exec-assistant",
},
Expand Down Expand Up @@ -192,6 +194,7 @@ describe("E2E fixture clients", () => {
expect(runner.calls[0]?.args).toEqual([
"sandbox",
"exec",
"-n",
"assistant",
"--",
"sh",
Expand All @@ -200,6 +203,72 @@ describe("E2E fixture clients", () => {
]);
});

it("sandbox client wraps multi-line bash via execShell", async () => {
const runner = new FakeRunner();
const sandbox = new SandboxClient(runner, { openshellPath: "openshell" });

await sandbox.execShell("assistant", 'TOKEN=$(read-token); node /tmp/repro.cjs "$TOKEN"');

expect(runner.calls[0]).toEqual({
command: "openshell",
args: [
"sandbox",
"exec",
"-n",
"assistant",
"--",
"sh",
"-lc",
'TOKEN=$(read-token); node /tmp/repro.cjs "$TOKEN"',
],
options: { artifactName: "sandbox-exec-shell-assistant" },
});
});

it("sandbox client rejects flag-shaped sandbox names before execShell", async () => {
const runner = new FakeRunner();
const sandbox = new SandboxClient(runner, { openshellPath: "openshell" });

await expect(() => sandbox.execShell("--bad", "echo ok")).toThrow(/sandbox name is invalid/);
expect(runner.calls).toEqual([]);
});

it("sandbox client uploads files to the sandbox via openshell sandbox upload", async () => {
const runner = new FakeRunner();
const sandbox = new SandboxClient(runner, { openshellPath: "openshell" });

await sandbox.upload("assistant", "/host/path/script.cjs", "/tmp/script.cjs");

expect(runner.calls[0]).toEqual({
command: "openshell",
args: ["sandbox", "upload", "assistant", "/host/path/script.cjs", "/tmp/script.cjs"],
options: { artifactName: "sandbox-upload-assistant" },
});
});

it("sandbox client rejects flag-shaped sandbox names before upload", async () => {
const runner = new FakeRunner();
const sandbox = new SandboxClient(runner, { openshellPath: "openshell" });

await expect(() => sandbox.upload("--bad", "/a", "/b")).toThrow(/sandbox name is invalid/);
expect(runner.calls).toEqual([]);
});

it("sandbox client preserves caller-provided probe options through upload", async () => {
const runner = new FakeRunner();
const sandbox = new SandboxClient(runner, { openshellPath: "openshell" });

await sandbox.upload("assistant", "/a", "/b", {
artifactName: "custom-upload",
timeoutMs: 30000,
});

expect(runner.calls[0]?.options).toEqual({
artifactName: "custom-upload",
timeoutMs: 30000,
});
});

it("provider client parses JSON from curl output", async () => {
const runner = new FakeRunner();
runner.stdout = JSON.stringify({ ok: true });
Expand Down
7 changes: 6 additions & 1 deletion test/e2e-scenario/framework-tests/e2e-phase-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ describe("runtime phase fixture", () => {
args: [
"sandbox",
"exec",
"-n",
"e2e-ubuntu-repo-cloud-openclaw",
"--",
"curl",
Expand Down Expand Up @@ -170,6 +171,7 @@ describe("runtime phase fixture", () => {
expect(call?.args).toEqual([
"sandbox",
"exec",
"-n",
"e2e-ubuntu-repo-cloud-openclaw",
"--",
"curl",
Expand All @@ -183,7 +185,9 @@ describe("runtime phase fixture", () => {
"https://inference.local/v1/chat/completions",
]);
expect(call?.args).not.toContain("sh");
const payload = JSON.parse(call?.args[11] ?? "{}");
// Index 12: shifted +1 by inserting "-n" before the sandbox name in
// SandboxClient.exec; the data-raw payload is now at args[12].
const payload = JSON.parse(call?.args[12] ?? "{}");
expect(payload).toEqual({
model: "default",
messages: [{ role: "user", content: "Reply with ok" }],
Expand All @@ -207,6 +211,7 @@ describe("runtime phase fixture", () => {
args: [
"sandbox",
"exec",
"-n",
"e2e-ubuntu-repo-cloud-openclaw",
"--",
"curl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ describe("state-validation phase fixture", () => {
args: [
"sandbox",
"exec",
"-n",
"e2e-ubuntu-repo-cloud-openclaw",
"--",
"curl",
Expand Down
45 changes: 44 additions & 1 deletion test/e2e-scenario/framework/clients/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,61 @@ export class SandboxClient {
});
}

// openshell `sandbox exec` requires the sandbox name as a `-n <name>`
// flag value, NOT a positional argument. Production code (src/lib/agent/
// onboard.ts, src/lib/onboard/initial-policy.ts, src/lib/onboard/web-search-
// verify.ts, ...) uniformly uses the `-n` short form; the legacy bash tests
// and the existing test/openclaw-tui-chat-correlation.test.ts use the
// equivalent `--name` long form. Passing the name positionally returns
// exit 127 (openshell argument-parse failure surfacing as command-not-
// found) — silently latent until a free-standing live test invoked
// `sandbox.exec` against a real sandbox, since the registry-driven matrix
// mostly skips and the one cloud-openclaw scenario that ran did not
// exercise this code path.
exec(
name: string,
command: string[],
options: ShellProbeRunOptions = {},
): Promise<ShellProbeResult> {
validateSandboxName(name);
return this.openshell(["sandbox", "exec", name, "--", ...command], {
return this.openshell(["sandbox", "exec", "-n", name, "--", ...command], {
artifactName: `sandbox-exec-${name}`,
...options,
});
}

// Convenience wrapper for running a multi-line bash script in a sandbox.
// Equivalent to `openshell sandbox exec -n <name> -- sh -lc "<script>"`.
// Used by free-standing live tests that need to run bespoke shell pipelines
// (e.g. starting an in-sandbox gateway, reading config files via node -e)
// without manually wiring `["sh", "-lc", script]` argv at every call site.
execShell(
name: string,
script: string,
options: ShellProbeRunOptions = {},
): Promise<ShellProbeResult> {
validateSandboxName(name);
return this.openshell(["sandbox", "exec", "-n", name, "--", "sh", "-lc", script], {
artifactName: `sandbox-exec-shell-${name}`,
...options,
});
}

// Uploads a host-side file into the sandbox at the given remote path.
// Wraps `openshell sandbox upload <name> <localPath> <remotePath>`.
upload(
name: string,
localPath: string,
remotePath: string,
options: ShellProbeRunOptions = {},
): Promise<ShellProbeResult> {
validateSandboxName(name);
return this.openshell(["sandbox", "upload", name, localPath, remotePath], {
artifactName: `sandbox-upload-${name}`,
...options,
});
}

async expectRunning(name: string, options: ShellProbeRunOptions = {}): Promise<ShellProbeResult> {
const result = await this.status(name, options);
assertExitZero(result, `openshell sandbox status ${name}`);
Expand Down
Loading
Loading