fix(messaging): restore channel policy on start - #6016
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
📝 WalkthroughWalkthrough
ChangesPolicy preset re-apply on channel start
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
PR Review Advisor — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
Review findings by urgency: 0 required fixes, 2 items to resolve/justify, 1 in-scope improvement
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/actions/sandbox/policy-channel-conflict.test.ts (1)
1109-1115: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the rollback via observable state, not
updateSandboxMockinternals.These expectations lock the test to the current state-adapter call sequence instead of the public outcome. Prefer asserting that
startSandboxChannel()leavesteamsdisabled after the failure, and keep the rebuild-skipped assertion as the behavioral proof. As per path instructions, "Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions."🤖 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 `@src/lib/actions/sandbox/policy-channel-conflict.test.ts` around lines 1109 - 1115, The test for startSandboxChannel() is asserting rollback through updateSandboxMock call internals, which ties it to implementation details instead of behavior. Replace those mock-call shape checks with assertions on observable state after the failure, specifically that teams remains disabled in the sandbox state while keeping the rebuild-skipped assertion. Use startSandboxChannel() and the surrounding sandbox state helpers as the primary references, and verify the public outcome rather than the adapter call sequence.Source: Path instructions
🤖 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.
Nitpick comments:
In `@src/lib/actions/sandbox/policy-channel-conflict.test.ts`:
- Around line 1109-1115: The test for startSandboxChannel() is asserting
rollback through updateSandboxMock call internals, which ties it to
implementation details instead of behavior. Replace those mock-call shape checks
with assertions on observable state after the failure, specifically that teams
remains disabled in the sandbox state while keeping the rebuild-skipped
assertion. Use startSandboxChannel() and the surrounding sandbox state helpers
as the primary references, and verify the public outcome rather than the adapter
call sequence.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 92a1c2bf-e3ab-49d6-ac85-7204a5d94f2e
📒 Files selected for processing (2)
src/lib/actions/sandbox/policy-channel-conflict.test.tssrc/lib/actions/sandbox/policy-channel.ts
PR Review Advisor (Nemotron Ultra) — InformationalMerge posture: Informational / low confidence Action checklist
Findings index
Review findings by urgency: 0 required fixes, 1 item to resolve/justify, 0 in-scope improvements
|
Vitest E2E Scenario Results —
|
| Job | Result |
|---|---|
| channels-stop-start-vitest |
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Vitest E2E Scenario Results —
|
| Job | Result |
|---|---|
| channels-stop-start-vitest |
Automated review disposition — head
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/actions/sandbox/policy-channel-remove-flow.test.ts (1)
78-92: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the dry-run outcome, not helper silence.
The log assertion is a good public-boundary check, but the
not.toHaveBeenCalled()assertions onapplyPreset,updateSandbox, andrebuildSandboxtie this test to the current implementation. Prefer proving the dry-run contract via observable state/output fromstartSandboxChanneland keep collaborator-level assertions only where they guard an actual external effect boundary. As per path instructions, "Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions."🤖 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 `@src/lib/actions/sandbox/policy-channel-remove-flow.test.ts` around lines 78 - 92, The dry-run test for startSandboxChannel should assert the public outcome instead of internal collaborator call silence. Keep the log/output check for the dry-run message, and remove or replace the applyPreset, updateSandbox, and rebuildSandbox not-to-have-been-called expectations with assertions on observable state or returned behavior that prove no changes were applied. Use startSandboxChannel, policyChannel, and the dryRun path as the primary symbols to locate the test.Source: Path instructions
🤖 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.
Nitpick comments:
In `@src/lib/actions/sandbox/policy-channel-remove-flow.test.ts`:
- Around line 78-92: The dry-run test for startSandboxChannel should assert the
public outcome instead of internal collaborator call silence. Keep the
log/output check for the dry-run message, and remove or replace the applyPreset,
updateSandbox, and rebuildSandbox not-to-have-been-called expectations with
assertions on observable state or returned behavior that prove no changes were
applied. Use startSandboxChannel, policyChannel, and the dryRun path as the
primary symbols to locate the test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e26f6d19-b500-4761-bb5d-8b55f5c637fc
📒 Files selected for processing (1)
src/lib/actions/sandbox/policy-channel-remove-flow.test.ts
Vitest E2E Scenario Results — ✅ All requested jobs passedRun: 28410075670
|
Exact live E2E evidence — head
|
## Summary Refreshes the v0.0.70 release docs from the release announcement and the `v0.0.69..v0.0.70` commit range. It also documents the `channels start` policy restoration behavior that was missing from the shared OpenClaw and Hermes command references, and bumps the Fern CLI version used for docs validation. ## Changes - Replaced the stale `v0.0.70` release-notes entry with the actual release themes, including CLI, onboarding, inference, messaging, Windows, documentation, and release-validation changes. - Documented that `channels start` reapplies the matching built-in network policy preset before rebuild and rolls back to disabled if policy restoration fails. - Bumped `fern/fern.config.json` from `5.55.0` to `5.59.0` for the docs refresh. - Source summary: - #5754 -> `docs/about/release-notes.mdx`: Notes Docker Desktop gateway bridge retry behavior during onboarding. - #5930 -> `docs/about/release-notes.mdx`: Links `nemoclaw use` default sandbox selection to the command reference. - #5948 -> `docs/about/release-notes.mdx`: Links reasoning-compatible endpoint validation to inference documentation. - #5950 -> `docs/about/release-notes.mdx`: Links Windows bootstrap WSL recovery behavior to Windows preparation and troubleshooting docs. - #5856 -> `docs/about/release-notes.mdx`: Notes rebuilt policy preset registry repair. - #5882 and #5949 -> `docs/about/release-notes.mdx`: Notes Hermes stale base-image state repair. - #6016 -> `docs/reference/commands.mdx`, `docs/reference/commands-nemohermes.mdx`, and `docs/manage-sandboxes/messaging-channels.mdx`: Documents channel policy restoration and rollback on `channels start`. - #5859 -> `docs/about/release-notes.mdx`: Links quickstart network approval guidance. - #5863 -> `docs/about/release-notes.mdx`: Links Teams allowlist guidance in the messaging page. - #5756, #5926, #6010, and #6011 -> `docs/about/release-notes.mdx`: Summarizes the Vitest E2E validation cutover. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [ ] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [x] Tests not applicable — justification: doc-only prose refresh with no runtime behavior change. - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [ ] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [ ] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [ ] Targeted tests pass for changed behavior - [ ] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [x] 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) `npm run docs` exited 0 and Fern reported one existing light-mode accent contrast warning. `fern check --warnings` confirmed the warning is the site theme contrast ratio, not content introduced by this PR. --- Signed-off-by: Miyoung Choi <miyoungc@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary `channels start` re-enabled the persisted messaging plan without re-applying the channel's network-policy preset. Once rebuild began truthfully pruning disabled presets in NVIDIA#5856, the next rebuild no longer had stale registry state to restore, so a restarted channel could have correct agent config but inactive egress policy. Re-apply the preset at the channel action boundary and fail closed by restoring the disabled plan when policy application fails. ## Related Issue Contributes to NVIDIA#5919. Blocks the final `channels-stop-start` cutover proof in NVIDIA#5756; follow-up to NVIDIA#5856. ## Changes - Re-apply the manifest-owned channel policy preset during `channels start`, before an immediate or queued rebuild. - Use action-correct recovery guidance for failed `channels start` policy application. - Roll the messaging plan back to disabled and skip rebuild when the preset cannot be applied. - Cover interactive ordering, the exact non-interactive queued-rebuild path, and failure rollback. ## 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 sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: restores the already-documented `channels start` contract; no command or configuration surface changes. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [ ] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: pending independent messaging/policy review. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior - [x] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run 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) Verification details: - focused channel/rebuild suite: 68 passed - `npm run typecheck:cli` - `make check` - full non-live suite at the source-change head: 2,421 suites passed; 9,689 tests passed; 26 skipped; 0 failed; subsequent commits are test-only and pass focused suites plus normal hooks - normal signed commit and push hooks --- Signed-off-by: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved Teams channel start flow by reapplying the required policy preset before any rebuild is queued. * In non-interactive mode with Teams disabled, the preset is reapplied first; rebuilds are not queued and “Change queued” is logged. * If preset reapplication (or rollback) fails, the channel’s disabled state is restored, the process exits, and recovery guidance is shown (including “Could not restore 'teams' to disabled state” when applicable). * **Tests** * Added coverage for preset/rebuild call order and failure/rollback scenarios. * Added a “dry run” test to ensure no rebuild or preset actions occur and the expected message is logged. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
## Summary Refreshes the v0.0.70 release docs from the release announcement and the `v0.0.69..v0.0.70` commit range. It also documents the `channels start` policy restoration behavior that was missing from the shared OpenClaw and Hermes command references, and bumps the Fern CLI version used for docs validation. ## Changes - Replaced the stale `v0.0.70` release-notes entry with the actual release themes, including CLI, onboarding, inference, messaging, Windows, documentation, and release-validation changes. - Documented that `channels start` reapplies the matching built-in network policy preset before rebuild and rolls back to disabled if policy restoration fails. - Bumped `fern/fern.config.json` from `5.55.0` to `5.59.0` for the docs refresh. - Source summary: - NVIDIA#5754 -> `docs/about/release-notes.mdx`: Notes Docker Desktop gateway bridge retry behavior during onboarding. - NVIDIA#5930 -> `docs/about/release-notes.mdx`: Links `nemoclaw use` default sandbox selection to the command reference. - NVIDIA#5948 -> `docs/about/release-notes.mdx`: Links reasoning-compatible endpoint validation to inference documentation. - NVIDIA#5950 -> `docs/about/release-notes.mdx`: Links Windows bootstrap WSL recovery behavior to Windows preparation and troubleshooting docs. - NVIDIA#5856 -> `docs/about/release-notes.mdx`: Notes rebuilt policy preset registry repair. - NVIDIA#5882 and NVIDIA#5949 -> `docs/about/release-notes.mdx`: Notes Hermes stale base-image state repair. - NVIDIA#6016 -> `docs/reference/commands.mdx`, `docs/reference/commands-nemohermes.mdx`, and `docs/manage-sandboxes/messaging-channels.mdx`: Documents channel policy restoration and rollback on `channels start`. - NVIDIA#5859 -> `docs/about/release-notes.mdx`: Links quickstart network approval guidance. - NVIDIA#5863 -> `docs/about/release-notes.mdx`: Links Teams allowlist guidance in the messaging page. - NVIDIA#5756, NVIDIA#5926, NVIDIA#6010, and NVIDIA#6011 -> `docs/about/release-notes.mdx`: Summarizes the Vitest E2E validation cutover. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [x] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [ ] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [x] Tests not applicable — justification: doc-only prose refresh with no runtime behavior change. - [x] Docs updated for user-facing behavior changes - [ ] Docs not applicable — justification: - [ ] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [ ] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [ ] Targeted tests pass for changed behavior - [ ] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [x] 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) `npm run docs` exited 0 and Fern reported one existing light-mode accent contrast warning. `fern check --warnings` confirmed the warning is the site theme contrast ratio, not content introduced by this PR. --- Signed-off-by: Miyoung Choi <miyoungc@nvidia.com>
Summary
channels startre-enabled the persisted messaging plan without re-applying the channel's network-policy preset. Once rebuild began truthfully pruning disabled presets in #5856, the next rebuild no longer had stale registry state to restore, so a restarted channel could have correct agent config but inactive egress policy. Re-apply the preset at the channel action boundary and fail closed by restoring the disabled plan when policy application fails.Related Issue
Contributes to #5919. Blocks the final
channels-stop-startcutover proof in #5756; follow-up to #5856.Changes
channels start, before an immediate or queued rebuild.channels startpolicy application.Type of Change
Quality Gates
channels startcontract; no command or configuration surface changes.Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Verification details:
npm run typecheck:climake checkSigned-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit