Skip to content

test(e2e): channels add/remove lifecycle#3696

Merged
ericksoa merged 19 commits into
mainfrom
test/e2e-channels-add-remove-operation
May 20, 2026
Merged

test(e2e): channels add/remove lifecycle#3696
ericksoa merged 19 commits into
mainfrom
test/e2e-channels-add-remove-operation

Conversation

@hunglp6d

@hunglp6d hunglp6d commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Add Test 2 from #3462 — end-to-end coverage for the onboard empty → channels add → channels remove lifecycle. The test asserts against the baked sandbox image (openclaw.json) and the gateway (provider attachment, policy presets) so regressions cannot hide behind a correct host-side registry. Companion to Test 1 (test-channels-stop-start.sh) shipped via #3532.

Related Issue

Closes #3462

Changes

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Hung Le hple@nvidia.com

Summary by CodeRabbit

  • Tests

    • Added E2E test covering full add/remove lifecycle for the Telegram messaging channel with environment prechecks, sandbox setup/teardown, baseline absence checks, add+rebuild and remove+rebuild verification, policy/preset/config assertions, and live egress probing through the L7 proxy.
  • Documentation

    • Added parity-map and generated test documentation entries describing the new Telegram add/remove scenario and its assertions.

Review Change Stack

@copy-pr-bot

copy-pr-bot Bot commented May 18, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new E2E test entrypoint, parity inventory/mapping, and a Bash script that onboards a sandbox, runs channels add telegram and channels remove telegram with rebuilds, and asserts preset application, baked-image openclaw.json state, provider registration/removal, and L7 egress behavior.

Changes

Telegram Channel Add/Remove E2E Test

Layer / File(s) Summary
Parity inventory & mapping
test/e2e/docs/parity-inventory.generated.json, test/e2e/docs/parity-map.yaml
Generated inventory and parity-map entries documenting the new test-channels-add-remove.sh entrypoint and its full suite of assertions (prereqs, install/onboard, baseline, add+rebuild, remove+rebuild).
Test script framework & helpers
test/e2e/test-channels-add-remove.sh
Script initialization, strict mode, pass/fail/skip counters, repo/sandbox wiring, sandbox_exec, openclaw_has_telegram, policy/preset checks, run_rebuild_with_live_log, and telegram_egress_open L7 probe.
Install/onboard and baseline verification
test/e2e/test-channels-add-remove.sh
Prerequisite checks (NVIDIA_API_KEY, non-interactive flags), sandbox pre-cleanup, explicit unset TELEGRAM_BOT_TOKEN, install/onboard with live log tailing, and baseline assertions that Telegram provider/preset/channel are absent.
Channel add command, rebuild, post-add assertions
test/e2e/test-channels-add-remove.sh
Exports Telegram token, runs nemoclaw channels add telegram, rebuilds with live logs, asserts registration, applied preset in policy list, openclaw.json contains telegram, provider exists, and L7 egress probe outcome.
Channel remove command, rebuild, cleanup assertions
test/e2e/test-channels-add-remove.sh
Runs nemoclaw channels remove telegram, unsets token, rebuilds, and asserts openclaw.json no longer contains telegram, provider/preset removal, and prints final test summary.

Sequence Diagram

sequenceDiagram
  participant Sandbox
  participant NemoclawCLI
  participant Gateway
  participant api_telegram_org as api.telegram.org
  Sandbox->>NemoclawCLI: run `nemoclaw channels add/remove` (via sandbox_exec)
  NemoclawCLI->>Gateway: register/unregister telegram-bridge provider
  NemoclawCLI->>Sandbox: trigger `nemoclaw rebuild` (bakes openclaw.json)
  Gateway->>api_telegram_org: L7 egress probe (connectivity via proxy/preset)
  api_telegram_org-->>Gateway: HTTP response (2xx/4xx) or network error
  Gateway-->>Sandbox: policy/preset visible via `nemoclaw policy list`
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#3452: Adds an E2E script and parity assertions for channels add/remove telegram, verifying preset application and Telegram egress.
  • NVIDIA/NemoClaw#3448: Changes to channel add/remove flow and name canonicalization that this test exercises.
  • NVIDIA/NemoClaw#3672: Related remove-flow behavior (provider detach and preset un-application) validated by these assertions.

Suggested labels

VRDC, enhancement: messaging

Suggested reviewers

  • cv
  • ericksoa
  • jyaunches

Poem

🐰 I hopped into the CI glade,
A sandbox spun, a token laid.
I watched the build bake openclaw's file,
Policy set, then egress smiled.
Removed it neat — the meadow sighed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% 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): channels add/remove lifecycle' accurately summarizes the main change—a new E2E test script for the messaging channel add/remove lifecycle.
Linked Issues check ✅ Passed All coding requirements from issue #3462 Test 2 are met: the script tests onboard with no channel, channels add telegram with rebuild, channels remove telegram with rebuild, and asserts against baked image, gateway state, and egress.
Out of Scope Changes check ✅ Passed All changes are directly aligned with Test 2 requirements: test script, parity-map entry, and generated inventory entry for E2E test coverage.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/e2e-channels-add-remove-operation

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

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: channels-stop-start-e2e, e2e-parity-compare

Dispatch hint: channels-stop-start-e2e

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No merge-blocking E2E is required because this PR changes only E2E test assets and parity documentation. It does not alter runtime/user-flow implementation code.

Optional E2E

  • channels-stop-start-e2e (high): Closest existing workflow-dispatched coverage for messaging channel lifecycle and policy cleanup. It exercises channel stop/start/remove across messaging providers and can provide adjacent confidence that the newly added add/remove regression script is consistent with existing lifecycle behavior.
  • e2e-parity-compare (medium): Useful to validate the updated parity map structure and reporting path for the new test-channels-add-remove.sh entry without making it merge-blocking, because the changed assertions are marked deferred/not-started and no production runtime code changed.

New E2E recommendations

  • providers-messaging-channel-lifecycle (high): The PR adds test/e2e/test-channels-add-remove.sh, but no existing workflow job appears to dispatch it directly. Add a selective workflow job so future PRs touching channels add/remove, matching network policy presets, provider registration, or rebuild behavior can run this coverage by name.
    • Suggested test: Add a channels-add-remove-e2e job wired to test/e2e/test-channels-add-remove.sh, likely in .github/workflows/nightly-e2e.yaml or the regression E2E workflow with selective dispatch support.
  • scenario-framework-migration (medium): The parity-map entry marks the new assertions as deferred pending scenario-framework migration. Migrating the add/remove lifecycle into a validation suite would make the coverage available through E2E / Scenario Runner and parity comparison.
    • Suggested test: Create migrated scenario or validation suite coverage for ubuntu-repo-cloud-openclaw channel add/remove lifecycle and map the legacy assertions once stable.

Dispatch hint

  • Workflow: .github/workflows/nightly-e2e.yaml
  • jobs input: channels-stop-start-e2e

@hunglp6d hunglp6d marked this pull request as ready for review May 18, 2026 11:11

@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: 2

🤖 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-channels-add-remove.sh`:
- Around line 198-203: The script currently checks NEMOCLAW_NON_INTERACTIVE but
lacks an upfront check for the documented prerequisite
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE; add a similar explicit validation before
tests run that verifies the environment variable
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE is set to "1" and call the existing fail
(and print_summary) functions on mismatch, otherwise call pass with a
descriptive message so the test fails fast; reference the same check pattern
used for NEMOCLAW_NON_INTERACTIVE and reuse the fail, print_summary, and pass
helpers.
- Around line 114-127: The helper openclaw_has_telegram() is checking the
runtime sandbox path /sandbox/.openclaw/openclaw.json but the test should assert
the baked-image file at /opt/nemoclaw/openclaw.json; update the sandbox_exec
Python command in openclaw_has_telegram() to load /opt/nemoclaw/openclaw.json
instead, keeping the same output logic (print "yes" if "telegram" in
d.get("channels",{}) else "no") and preserving the same return codes (0 for yes,
1 for no, 2 for unreadable/other).
🪄 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: 67187ac8-e2d2-4361-b7cf-bc6e651c9695

📥 Commits

Reviewing files that changed from the base of the PR and between 50ad764 and 3c3916e.

📒 Files selected for processing (3)
  • test/e2e/docs/parity-inventory.generated.json
  • test/e2e/docs/parity-map.yaml
  • test/e2e/test-channels-add-remove.sh

Comment thread test/e2e/test-channels-add-remove.sh
Comment thread test/e2e/test-channels-add-remove.sh
@hunglp6d hunglp6d added the VRDC Issues and PRs submitted by NVIDIA VRDC test team. label May 19, 2026
@hunglp6d hunglp6d self-assigned this May 19, 2026
@hunglp6d hunglp6d added the v0.0.46 Release target label May 19, 2026

@cjagwani cjagwani 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.

Approving after a rebase to clear DIRTY.

Strong test PR — three files, all test artifacts, every assertion ties to either the #3462 spec or a named shipped regression (#3437 at C4a, #3671 at C6c). CI is fully green incl. ShellCheck + the full self-hosted e2e suite.

Notes for the author:

  1. CodeRabbit's /opt/nemoclaw/openclaw.json suggestion (line 114-127) is incorrect — the canonical runtime path is /sandbox/.openclaw/openclaw.json, matching sibling Test 1 on main (test-channels-stop-start.sh:247). You correctly kept the existing path. No change needed.

  2. Minor gap vs. #3462 Test 2 clause 7: the spec asks to assert "registry shows telegram removed from messagingChannels". C6a (baked openclaw.json) + C6b (gateway provider gone) cover this implicitly via the rebuild chain, but a direct registry check would close the loop. Optional follow-up — not blocking.

  3. The node -e fetch egress probe (line 166) is well-targeted: it matches the telegram preset's binary+path scoping and accepts STATUS_2xx OR 4xx so a fake token producing 401 still proves CONNECT passed. Nice.

Please rebase on main and we can merge.

@hunglp6d

hunglp6d commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @cjagwani , resolved the conflicts and ready to merge

@ericksoa ericksoa merged commit e1f3992 into main May 20, 2026
24 checks passed
@ericksoa ericksoa deleted the test/e2e-channels-add-remove-operation branch May 20, 2026 00:33
ericksoa pushed a commit that referenced this pull request May 20, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Wire `test-channels-add-remove.sh` into the nightly E2E workflow. The
test landed via PR #3696 but didn't get a nightly job slot at the time —
adding one now so regressions for #3437 (channels add preset auto-apply)
and #3671 (channels remove detach + un-apply + survive rebuild) get
scheduled coverage.

## Related Issue
<!-- Fixes #NNN or Closes #NNN. Remove this section if none. -->

## Changes
- New job `channels-add-remove-e2e` runs `bash
test/e2e/test-channels-add-remove.sh` on `ubuntu-latest`.
- Env: `TELEGRAM_BOT_TOKEN=test-fake-telegram-token-add-remove-e2e`,
`NEMOCLAW_NON_INTERACTIVE=1`, `NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1`,
`NEMOCLAW_SANDBOX_NAME=e2e-channels-add-remove`. Telegram-only —
Discord/Slack/WeChat walk the same `KNOWN_CHANNELS` + preset lookup code
path (already covered by `channels-stop-start-e2e`).
- On failure, uploads `/tmp/nemoclaw-e2e-install.log`,
`/tmp/nc-{add,remove}.log`, `/tmp/nc-rebuild-{add,remove}.log`.
- Registered in:
  - `inputs.jobs` description (for `workflow_dispatch` job selection).
- Three downstream aggregation `needs:` lists alongside
`channels-stop-start-e2e`.

## Type of Change

- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [ ] `npx prek run --all-files` passes
- [ ] `npm test` passes
- [ ] Tests added or updated for new or changed behavior
- [ ] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Hung Le <hple@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Tests**
* Added new end-to-end test for channels add/remove functionality with
improved failure diagnostics and automated artifact collection during
nightly test runs.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3932?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@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 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 v0.0.46 Release target VRDC Issues and PRs submitted by NVIDIA VRDC test team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(messaging): add E2E coverage for channels stop/start and channels add/remove rebuild flows

4 participants