Skip to content

test(e2e): prove OpenClaw Discord pairing approval - #4115

Merged
ericksoa merged 4 commits into
mainfrom
codex/add-openclaw-discord-pairing-e2e
May 23, 2026
Merged

test(e2e): prove OpenClaw Discord pairing approval#4115
ericksoa merged 4 commits into
mainfrom
codex/add-openclaw-discord-pairing-e2e

Conversation

@ericksoa

@ericksoa ericksoa commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Validation

  • bash -n test/e2e/test-openclaw-discord-pairing.sh
  • shellcheck test/e2e/test-openclaw-discord-pairing.sh
  • npx vitest run test/validate-e2e-coverage.test.ts test/e2e-advisor-dispatch.test.ts
  • npx tsx scripts/e2e/lint-conventions.ts
  • git diff --check

Local E2E note

  • Attempted local run of test/e2e/test-openclaw-discord-pairing.sh, but this workstation failed during install pre-upgrade backup because unrelated existing sandboxes are in Error and cannot be backed up. The new proof will be run on a clean Actions runner from this PR.

Fixes/proves #4061

Summary by CodeRabbit

  • Tests

    • Added a new nightly end-to-end test validating Discord pairing flows: sandbox provisioning, fake gateway token rewrite during connect, pairing request generation, approval behavior, single-use code semantics, post-approval state, and a PASS/FAIL/SKIP summary with proper exit status.
  • Chores

    • Nightly E2E pipeline updated to include the Discord pairing job, with failure reporting, aggregated results, and artifact collection for debugging.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 21ce566c-ffd0-4a54-ac9a-5a99e3d4f8f4

📥 Commits

Reviewing files that changed from the base of the PR and between 8a08630 and 5358e0d.

📒 Files selected for processing (1)
  • test/e2e/test-openclaw-discord-pairing.sh

📝 Walkthrough

Walkthrough

Adds a nightly OpenClaw Discord pairing E2E job and a comprehensive Bash test that provisions a sandbox, runs a hermetic fake Discord gateway, generates and approves pairing requests, validates state transitions, uploads failure artifacts, and reports results.

Changes

Discord Pairing End-to-End Test

Layer / File(s) Summary
Workflow job registration and dependency wiring
.github/workflows/nightly-e2e.yaml
Adds openclaw-discord-pairing-e2e to workflow docs, workflow_dispatch valid jobs, defines the job to run test-openclaw-discord-pairing.sh, uploads an install-log artifact on failure, and wires it into notify-on-failure, report-to-pr, and scorecard needs.
Test harness and env helpers
test/e2e/test-openclaw-discord-pairing.sh
Introduces logging helpers, PASS/FAIL/SKIP/TOTAL counters, timeout wrapper, repo-root discovery, sandbox exec helpers (openshell/ssh), quoting utilities, and a Node-based capture validator for the fake gateway.
Sandbox provisioning and readiness
test/e2e/test-openclaw-discord-pairing.sh
Validates NVIDIA_API_KEY and Docker, pre-cleans existing sandbox/provider state, runs install.sh --non-interactive with timeout and log handling, waits for sandbox readiness, and inspects openclaw.json for placeholder token and pairing-policy.
State-root resolution and preflight list
test/e2e/test-openclaw-discord-pairing.sh
Resolves connect-shell OpenClaw state-root env vars to shared /sandbox/.openclaw layout and confirms openclaw pairing list discord --json functions before runtime activity.
Hermetic fake Discord gateway and token-rewrite proof
test/e2e/test-openclaw-discord-pairing.sh
Starts the hermetic fake Discord Gateway, applies WebSocket credential-rewrite policy, probes gateway protocol/handshake via Node capture, and validates placeholder-to-real token rewrite with no leaks.
Pairing request generation and extraction
test/e2e/test-openclaw-discord-pairing.sh
Runs a sandbox-executed runtime script to issue a Discord pairing challenge, upserts a pending request into shared state, captures structured output containing pairing code and reply, and extracts/verifies the code and sender identity.
Pairing approval and state validation
test/e2e/test-openclaw-discord-pairing.sh
Checks pending request exists in discord-pairing.json, confirms CLI visibility, approves via openclaw pairing approve discord <code>, asserts code consumption and discord-default-allowFrom.json entry creation, and verifies re-approval fails.
Cleanup and test result reporting
test/e2e/test-openclaw-discord-pairing.sh
Conditionally destroys or retains sandbox per keep-mode, verifies final sandbox removal/retention, prints PASS/FAIL/SKIP/TOTAL summary, and exits non-zero on failures.

Sequence Diagram

sequenceDiagram
  participant Workflow as workflow_dispatch
  participant Runner as Actions runner
  participant Installer as install.sh
  participant Sandbox as Sandbox
  participant Gateway as FakeDiscordGateway
  participant Node as NodeCapture
  participant OpenClaw as OpenClaw CLI
  participant Aggregator as notify/scorecard/report

  Workflow->>Runner: trigger openclaw-discord-pairing-e2e
  Runner->>Installer: run install.sh --non-interactive (with logs)
  Runner->>Sandbox: provision and wait ready
  Runner->>Gateway: start FakeDiscordGateway (hermetic)
  Gateway->>Node: capture traffic (token rewrite)
  Node->>Runner: validate token rewrite capture
  Runner->>Sandbox: run runtime to emit pairing request (prints code)
  Runner->>OpenClaw: run pairing list / approve commands in sandbox
  OpenClaw->>Sandbox: consume pairing code, update discord-default-allowFrom.json
  Runner->>Aggregator: upload artifacts and report job result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

Integration: OpenClaw, CI/CD

Suggested reviewers

  • jyaunches
  • cv

Poem

🐰 I hop through nightly CI and log the run,
A fake gateway hums until the test is done,
Codes are printed, rewritten, then approved,
State files updated, no promises removed,
A little rabbit cheers — another check passed, fun!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test(e2e): prove OpenClaw Discord pairing approval' clearly and concisely summarizes the main change—adding an end-to-end test for Discord pairing approval functionality.
Linked Issues check ✅ Passed The PR fulfills issue #4061 requirements: it creates a hermetic E2E test verifying the Discord pairing flow from sandbox setup through approval, including gateway token rewrite, runtime pairing file creation, and CLI approval commands.
Out of Scope Changes check ✅ Passed All changes—the new test script, workflow integration, and install timeout support—are directly scoped to establishing and validating the Discord pairing E2E test workflow as described in issue #4061.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/add-openclaw-discord-pairing-e2e

Comment @coderabbitai help to get the list of available commands and usage tips.

@ericksoa ericksoa added bug integration: discord Discord integration or channel behavior NV QA Bugs found by the NVIDIA QA Team labels May 23, 2026
@github-actions

github-actions Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: openclaw-discord-pairing-e2e
Optional E2E: openclaw-slack-pairing-e2e, messaging-providers-e2e

Dispatch hint: openclaw-discord-pairing-e2e

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • openclaw-discord-pairing-e2e (medium): This PR adds the Discord pairing E2E job and script itself. Run the new job to prove the workflow wiring, hermetic Discord Gateway credential rewrite, shared OpenClaw state-root contract, and connect-shell approval flow work on CI.

Optional E2E

  • openclaw-slack-pairing-e2e (medium): Adjacent pairing-flow coverage for Slack validates the same style of shared state-root approval path and helps detect regressions in common OpenClaw pairing behavior, but the PR does not modify Slack runtime or test code.
  • messaging-providers-e2e (medium): Optional confidence for Discord provider/placeholder/L7-proxy credential plumbing alongside Telegram and Slack. The new Discord pairing test already covers Discord-specific rewrite behavior, so this is adjacent rather than merge-blocking.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: nightly-e2e.yaml
  • jobs input: openclaw-discord-pairing-e2e

@github-actions

github-actions Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

E2E Scenario Advisor Recommendation

Required scenario E2E: None
Optional scenario E2E: None

Workflow run

Full scenario advisor summary

E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required scenario E2E

  • None. No scenario workflow, scenario metadata, scenario runtime, or validation-suite files changed.

Optional scenario E2E

  • None.

Relevant changed files

  • None.

@github-actions

github-actions Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 2 worth checking, 0 nice ideas
Since last review: 0 prior items resolved, 2 still apply, 0 new items found

Review findings

🛠️ Needs attention

  • None.

🔎 Worth checking

  • Credentialed workflow runs target-ref test code (.github/workflows/nightly-e2e.yaml:411): The selectable openclaw-discord-pairing-e2e job checks out `${{ inputs.target_ref || github.ref }}` and runs `bash test/e2e/test-openclaw-discord-pairing.sh` while exposing `NVIDIA_API_KEY` and `GITHUB_TOKEN`. This follows the surrounding nightly E2E pattern, but it expands the trusted workflow boundary: if this workflow is dispatched against untrusted PR-controlled code, PR-controlled shell code would execute in a secrets-bearing job.
    • Recommendation: Keep this job behind the same trusted-author and target-ref controls as the rest of the selective E2E dispatch path. Minimize credentials for this job where possible, especially `GITHUB_TOKEN` if the install/test path does not require it, and document that this job must not be dispatched for untrusted refs.
    • Evidence: Previous advisor finding still applies. The diff adds `openclaw-discord-pairing-e2e` with `actions/checkout` using `ref: ${{ inputs.target_ref || github.ref }}`, env entries `NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}` and `GITHUB_TOKEN: ${{ github.token }}`, and `run: bash test/e2e/test-openclaw-discord-pairing.sh`; no later diff evidence shows credential minimization or added trust gating.
  • E2E proof inherits an unpinned fake Discord gateway image (test/e2e/test-openclaw-discord-pairing.sh:334): The new E2E starts the shared fake Discord Gateway through `start_fake_discord_gateway`. The helper remains backed by the floating `node:22-bookworm-slim` image tag, so a security-sensitive CI proof depends on mutable third-party container contents that can drift independently of the repository.
    • Recommendation: Pin the fake gateway container image by digest or route the helper through a repository-controlled, pinned test image so the Discord gateway proof is reproducible and less exposed to upstream image drift or registry compromise.
    • Evidence: Previous advisor finding still applies. The new test calls `start_fake_discord_gateway "$DISCORD_TOKEN"`; the prior review identified that `test/e2e/lib/discord-gateway-proof.sh` runs `docker run ... node:22-bookworm-slim ... node /opt/nemoclaw-e2e/fake-discord-gateway.cjs`, and the supplied diff does not change that helper.

🌱 Nice ideas

  • None.
Since last review details

Current findings:

  • Credentialed workflow runs target-ref test code (.github/workflows/nightly-e2e.yaml:411): The selectable openclaw-discord-pairing-e2e job checks out `${{ inputs.target_ref || github.ref }}` and runs `bash test/e2e/test-openclaw-discord-pairing.sh` while exposing `NVIDIA_API_KEY` and `GITHUB_TOKEN`. This follows the surrounding nightly E2E pattern, but it expands the trusted workflow boundary: if this workflow is dispatched against untrusted PR-controlled code, PR-controlled shell code would execute in a secrets-bearing job.
    • Recommendation: Keep this job behind the same trusted-author and target-ref controls as the rest of the selective E2E dispatch path. Minimize credentials for this job where possible, especially `GITHUB_TOKEN` if the install/test path does not require it, and document that this job must not be dispatched for untrusted refs.
    • Evidence: Previous advisor finding still applies. The diff adds `openclaw-discord-pairing-e2e` with `actions/checkout` using `ref: ${{ inputs.target_ref || github.ref }}`, env entries `NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}` and `GITHUB_TOKEN: ${{ github.token }}`, and `run: bash test/e2e/test-openclaw-discord-pairing.sh`; no later diff evidence shows credential minimization or added trust gating.
  • E2E proof inherits an unpinned fake Discord gateway image (test/e2e/test-openclaw-discord-pairing.sh:334): The new E2E starts the shared fake Discord Gateway through `start_fake_discord_gateway`. The helper remains backed by the floating `node:22-bookworm-slim` image tag, so a security-sensitive CI proof depends on mutable third-party container contents that can drift independently of the repository.
    • Recommendation: Pin the fake gateway container image by digest or route the helper through a repository-controlled, pinned test image so the Discord gateway proof is reproducible and less exposed to upstream image drift or registry compromise.
    • Evidence: Previous advisor finding still applies. The new test calls `start_fake_discord_gateway "$DISCORD_TOKEN"`; the prior review identified that `test/e2e/lib/discord-gateway-proof.sh` runs `docker run ... node:22-bookworm-slim ... node /opt/nemoclaw-e2e/fake-discord-gateway.cjs`, and the supplied diff does not change that helper.

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/e2e/test-openclaw-discord-pairing.sh (1)

226-233: ⚡ Quick win

Scope host gateway teardown in pre-cleanup
test/e2e/test-openclaw-discord-pairing.sh unconditionally runs openshell gateway destroy -g nemoclaw in Phase 1 (lines 226-233). This exact teardown is used in multiple other test/e2e/*.sh scripts as well, so it may be repo-standard for isolating the shared default nemoclaw gateway; if you want to avoid disrupting a developer’s existing host gateway, gate this destroy (e.g., behind an env var or by detecting a test-owned gateway) instead of always deleting it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/test-openclaw-discord-pairing.sh` around lines 226 - 233, The script
unconditionally runs openshell gateway destroy -g nemoclaw during pre-cleanup
which may tear down a developer’s host gateway; update the block that calls
openshell gateway destroy -g nemoclaw to only run when a guarding condition is
true (e.g., an environment variable like CI, TEST_OWN_GATEWAY, or
SANDBOX_OWN_GATEWAY is set) or when you detect the gateway is test-owned (check
openshell gateway list/output for a marker tied to SANDBOX_NAME); wrap the
openshell gateway destroy -g nemoclaw and related openshell sandbox delete
"$SANDBOX_NAME" calls behind that guard and leave the existing comandos
(nemoclaw destroy and other quiet fallbacks) unchanged so local gateways aren’t
removed unintentionally.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/test-openclaw-discord-pairing.sh`:
- Around line 156-166: The sandbox_exec_sh_script function currently calls
openshell sandbox exec without a timeout; wrap that final openshell invocation
in run_with_timeout 60 so the remote command is killed after 60s if it hangs.
Locate sandbox_exec_sh_script (and the openshell sandbox exec --name
"$SANDBOX_NAME" -- sh -lc "$remote_cmd" invocation) and replace that direct call
with a run_with_timeout 60 wrapper that passes the same arguments and preserves
quoting/variable expansion behavior.

---

Nitpick comments:
In `@test/e2e/test-openclaw-discord-pairing.sh`:
- Around line 226-233: The script unconditionally runs openshell gateway destroy
-g nemoclaw during pre-cleanup which may tear down a developer’s host gateway;
update the block that calls openshell gateway destroy -g nemoclaw to only run
when a guarding condition is true (e.g., an environment variable like CI,
TEST_OWN_GATEWAY, or SANDBOX_OWN_GATEWAY is set) or when you detect the gateway
is test-owned (check openshell gateway list/output for a marker tied to
SANDBOX_NAME); wrap the openshell gateway destroy -g nemoclaw and related
openshell sandbox delete "$SANDBOX_NAME" calls behind that guard and leave the
existing comandos (nemoclaw destroy and other quiet fallbacks) unchanged so
local gateways aren’t removed unintentionally.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 06072a73-d6ec-4832-903d-da603c5a0bfe

📥 Commits

Reviewing files that changed from the base of the PR and between 2db21d8 and 5598207.

📒 Files selected for processing (2)
  • .github/workflows/nightly-e2e.yaml
  • test/e2e/test-openclaw-discord-pairing.sh

Comment thread test/e2e/test-openclaw-discord-pairing.sh
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ❌ Some jobs failed

Run: 26319880876
Target ref: codex/add-openclaw-discord-pairing-e2e
Workflow ref: codex/add-openclaw-discord-pairing-e2e
Requested jobs: openclaw-discord-pairing-e2e
Summary: 0 passed, 1 failed, 0 skipped

Job Result
openclaw-discord-pairing-e2e ❌ failure

Failed jobs: openclaw-discord-pairing-e2e. Check run artifacts for logs.

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
test/e2e/test-openclaw-discord-pairing.sh (2)

584-589: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Assert the second approval fails with a non-zero exit code.

This phase only matches the error text. If openclaw pairing approve regresses to exit 0 while printing the same message, the E2E still passes and no longer proves the "fails closed" contract from the PR objective.

Suggested change
 repeat_approve=$(sandbox_exec "openclaw pairing approve discord '$pairing_code' 2>&1")
-if echo "$repeat_approve" | grep -q "No pending pairing request found"; then
+repeat_approve_status=$?
+if [ $repeat_approve_status -ne 0 ] \
+  && echo "$repeat_approve" | grep -q "No pending pairing request found"; then
   pass "Second approval fails closed after request consumption"
 else
   fail "Second approval did not report missing pending request: ${repeat_approve:0:300}"
 fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/test-openclaw-discord-pairing.sh` around lines 584 - 589, The test
currently only inspects stdout in variable repeat_approve from sandbox_exec
"openclaw pairing approve ..."; update the test to also assert that the command
exited with a non-zero status: capture the exit code returned by sandbox_exec
(or run sandbox_exec in a way that exposes its exit status), and fail if that
exit code is 0 while the output contains "No pending pairing request found";
update the logic around repeat_approve and the sandbox_exec invocation
(references: repeat_approve, sandbox_exec, the "openclaw pairing approve"
invocation and the subsequent pass/fail branches) so the test requires both the
expected error text and a non‑zero exit code.

236-245: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Bound install.sh with a timeout.

The install step is the longest external call in the script, but it currently runs unbounded. If onboarding wedges, this job sits until the runner-level timeout instead of failing fast.

Suggested change
 INSTALL_LOG="/tmp/nemoclaw-e2e-openclaw-discord-pairing-install.log"
 info "Running install.sh --non-interactive..."
-bash install.sh --non-interactive >"$INSTALL_LOG" 2>&1 &
+run_with_timeout 1800 bash install.sh --non-interactive >"$INSTALL_LOG" 2>&1 &
 install_pid=$!
 tail -f "$INSTALL_LOG" --pid=$install_pid 2>/dev/null &
 tail_pid=$!
 wait $install_pid
 install_exit=$?
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/test-openclaw-discord-pairing.sh` around lines 236 - 245, Wrap the
long-running install step with a bounded timeout so the job fails fast if
onboarding hangs: introduce an INSTALL_TIMEOUT variable (or use a default) and
run bash install.sh --non-interactive under the timeout utility (or implement a
watchdog that kills install_pid after INSTALL_TIMEOUT). Update the existing flow
that sets INSTALL_LOG, captures install_pid and tail_pid, and uses
wait/install_exit so that if timeout kills install_pid you detect that condition
(timeout exit code, e.g. 124) and exit non‑zero after cleaning up tail_pid;
ensure any kill/wait cleanup still runs to avoid orphaned background tails.
♻️ Duplicate comments (1)
test/e2e/test-openclaw-discord-pairing.sh (1)

156-166: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Wrap sandbox_exec_sh_script with the existing timeout guard.

This helper is still the only sandbox exec path that can hang indefinitely, so a stuck remote shell can burn the whole workflow.

Suggested change
 def sandbox_exec_sh_script() {
   local script="$1"
   shift
   local encoded remote_cmd arg
   encoded="$(printf '%s' "$script" | base64 | tr -d '\n')"
   remote_cmd="tmp=\$(mktemp); trap 'rm -f \"\$tmp\"' EXIT; printf %s $(quote_for_remote_sh "$encoded") | base64 -d > \"\$tmp\"; sh \"\$tmp\""
   for arg in "$@"; do
     remote_cmd+=" $(quote_for_remote_sh "$arg")"
   done
-  openshell sandbox exec --name "$SANDBOX_NAME" -- sh -lc "$remote_cmd"
+  run_with_timeout 60 \
+    openshell sandbox exec --name "$SANDBOX_NAME" -- sh -lc "$remote_cmd"
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/test-openclaw-discord-pairing.sh` around lines 156 - 166, The
sandbox_exec_sh_script helper can hang indefinitely; wrap the openshell
invocation inside the same timeout guard used by the other sandbox helpers so a
stuck remote shell can't block the workflow. Modify sandbox_exec_sh_script to
call the existing timeout wrapper (the same helper used elsewhere in tests)
around the openshell sandbox exec --name "$SANDBOX_NAME" -- sh -lc "$remote_cmd"
call, preserving argument quoting/propagation and exit code semantics and
keeping the tmp/trap behavior in remote_cmd unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@test/e2e/test-openclaw-discord-pairing.sh`:
- Around line 584-589: The test currently only inspects stdout in variable
repeat_approve from sandbox_exec "openclaw pairing approve ..."; update the test
to also assert that the command exited with a non-zero status: capture the exit
code returned by sandbox_exec (or run sandbox_exec in a way that exposes its
exit status), and fail if that exit code is 0 while the output contains "No
pending pairing request found"; update the logic around repeat_approve and the
sandbox_exec invocation (references: repeat_approve, sandbox_exec, the "openclaw
pairing approve" invocation and the subsequent pass/fail branches) so the test
requires both the expected error text and a non‑zero exit code.
- Around line 236-245: Wrap the long-running install step with a bounded timeout
so the job fails fast if onboarding hangs: introduce an INSTALL_TIMEOUT variable
(or use a default) and run bash install.sh --non-interactive under the timeout
utility (or implement a watchdog that kills install_pid after INSTALL_TIMEOUT).
Update the existing flow that sets INSTALL_LOG, captures install_pid and
tail_pid, and uses wait/install_exit so that if timeout kills install_pid you
detect that condition (timeout exit code, e.g. 124) and exit non‑zero after
cleaning up tail_pid; ensure any kill/wait cleanup still runs to avoid orphaned
background tails.

---

Duplicate comments:
In `@test/e2e/test-openclaw-discord-pairing.sh`:
- Around line 156-166: The sandbox_exec_sh_script helper can hang indefinitely;
wrap the openshell invocation inside the same timeout guard used by the other
sandbox helpers so a stuck remote shell can't block the workflow. Modify
sandbox_exec_sh_script to call the existing timeout wrapper (the same helper
used elsewhere in tests) around the openshell sandbox exec --name
"$SANDBOX_NAME" -- sh -lc "$remote_cmd" call, preserving argument
quoting/propagation and exit code semantics and keeping the tmp/trap behavior in
remote_cmd unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dadf4a30-5d6f-4983-ae91-1f349bf295e4

📥 Commits

Reviewing files that changed from the base of the PR and between 5598207 and 5408958.

📒 Files selected for processing (1)
  • test/e2e/test-openclaw-discord-pairing.sh

@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 26320047082
Target ref: codex/add-openclaw-discord-pairing-e2e
Workflow ref: codex/add-openclaw-discord-pairing-e2e
Requested jobs: openclaw-discord-pairing-e2e
Summary: 1 passed, 0 failed, 0 skipped

Job Result
openclaw-discord-pairing-e2e ✅ success

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 26320202290
Target ref: codex/add-openclaw-discord-pairing-e2e
Workflow ref: codex/add-openclaw-discord-pairing-e2e
Requested jobs: openclaw-discord-pairing-e2e
Summary: 1 passed, 0 failed, 0 skipped

Job Result
openclaw-discord-pairing-e2e ✅ success

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/test-openclaw-discord-pairing.sh`:
- Around line 239-241: The script currently calls run_with_timeout to enforce
INSTALL_TIMEOUT_SECONDS but run_with_timeout silently falls back to running the
command un-timed if neither timeout nor gtimeout is available; add an explicit
pre-check before invoking run_with_timeout that verifies at least one of
"timeout" or "gtimeout" is present (e.g., using command -v) and if not, print a
clear error and exit non-zero so NEMOCLAW_E2E_INSTALL_TIMEOUT_SECONDS /
INSTALL_TIMEOUT_SECONDS cannot be bypassed; reference the run_with_timeout
invocation and the INSTALL_TIMEOUT_SECONDS /
NEMOCLAW_E2E_INSTALL_TIMEOUT_SECONDS variables when adding this check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 99caef43-5687-47b8-936a-e2887d463ab7

📥 Commits

Reviewing files that changed from the base of the PR and between 5408958 and 8a08630.

📒 Files selected for processing (1)
  • test/e2e/test-openclaw-discord-pairing.sh

Comment thread test/e2e/test-openclaw-discord-pairing.sh
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 26320376483
Target ref: codex/add-openclaw-discord-pairing-e2e
Workflow ref: codex/add-openclaw-discord-pairing-e2e
Requested jobs: openclaw-discord-pairing-e2e
Summary: 1 passed, 0 failed, 0 skipped

Job Result
openclaw-discord-pairing-e2e ✅ success

@ericksoa
ericksoa merged commit 7f2cba7 into main May 23, 2026
81 checks passed
@ericksoa
ericksoa deleted the codex/add-openclaw-discord-pairing-e2e branch May 23, 2026 02:02
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression feature PR adds or expands user-visible functionality labels Jun 3, 2026
@wscurran wscurran added chore Build, CI, dependency, or tooling maintenance and removed enhancement: testing bug-fix PR fixes a bug or regression feature PR adds or expands user-visible functionality labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance integration: discord Discord integration or channel behavior NV QA Bugs found by the NVIDIA QA Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants