Skip to content

Slack messaging rebuild can preserve channel config but drop slack network policy #3753

@jyaunches

Description

@jyaunches

Summary

Slack messaging channel configuration can survive a sandbox rebuild while the required slack network policy preset is not present on the recreated sandbox. The result is a sandbox that appears Slack-configured (openclaw.json contains Slack account config and provider placeholders), but Slack cannot connect because egress to Slack endpoints is missing/denied.

This is distinct from the OpenShell credential-placeholder issue and from Slack authorization bugs. It is a NemoClaw lifecycle/state consistency issue: channel state and policy state can drift across rebuild/resume.

Why this matters

This blocks reproducing and validating Slack behavior such as #3729 because the test never reaches Slack event handling. Before a DM or channel @mention can test allowlist behavior, Socket Mode must connect and receive events. If Slack config exists but the Slack policy preset is absent, the user sees Slack enabled/configured but no inbound messages arrive.

Observed evidence from fresh Percy/Spark setup

Environment:

  • Host: DGX Spark (sparky)
  • NemoClaw: v0.0.39
  • OpenShell CLI/gateway: 0.0.37
  • OpenClaw in sandbox: v2026.4.24
  • Sandbox: percy
  • Messaging channel: Slack
  • Slack app/workspace configured with Socket Mode and Event Subscriptions (message.im, app_mention)

After a rebuild/resume, Percy was Ready and Slack config still existed inside the sandbox:

"channels": {
  "defaults": {},
  "slack": {
    "accounts": {
      "default": {
        "botToken": "xoxb-OPENSHELL-RESOLVE-ENV-SLACK_BOT_TOKEN",
        "enabled": true,
        "appToken": "xapp-OPENSHELL-RESOLVE-ENV-SLACK_APP_TOKEN"
      }
    }
  }
}

But nemoclaw percy status listed policies without slack:

Policies: npm, pypi, huggingface, brew, brave, local-inference

Slack provider logs then showed repeated provider startup failures while attempting Socket Mode startup, e.g. HTTP 403s on Slack calls and failure to retrieve the WSS URL. Earlier in the same setup, after manually applying the Slack policy, Slack API health calls were allowed by the slack policy.

Code evidence / likely drift point

The code currently tracks messaging channels and applied policy presets separately:

  • src/lib/onboard/initial-policy.ts
    • CREATE_TIME_POLICY_PRESETS_BY_CHANNEL maps slack -> slack.
    • prepareInitialSandboxCreatePolicy(basePolicyPath, activeMessagingChannels, ...) merges create-time presets only from activeMessagingChannels.
  • src/lib/onboard.ts
    • Computes activeMessagingChannels from token/reuse state.
    • Registers runtime metadata separately:
      • policies: initialSandboxPolicy.appliedPresets
      • messagingChannels: ...
  • src/lib/actions/sandbox/rebuild.ts
    • Rebuild backs up/deletes the sandbox, stashes messaging channels into the onboard session, then calls onboard({ resume: true, nonInteractive: true, recreateSandbox: true }).
    • After onboard, it preserves messagingChannels / disabledChannels / credential hashes, but policy preservation depends on the create-time policy path and registry/session state being recomputed correctly.

The observed failure mode is that Slack channel config is regenerated/restored, but the create-time policy for Slack is not present in the live sandbox policy and the registry status no longer shows slack.

Reproduction plan for a new session

Use a real Slack app/workspace or a test Slack app with valid tokens. The bug is about policy/config drift, so inbound Slack messages are not required to prove the core issue.

  1. Fresh onboard a sandbox with Slack enabled:

    nemoclaw onboard
    # choose local or any working inference provider
    # select Slack messaging
    # provide valid SLACK_BOT_TOKEN and SLACK_APP_TOKEN
  2. Confirm initial state is consistent:

    nemoclaw <sandbox> status
    openshell policy get --full <sandbox> | grep -i slack
    docker exec <container> sh -lc 'grep -n "slack" -A12 -B2 /sandbox/.openclaw/openclaw.json'

    Expected initial good state:

    • nemoclaw <sandbox> status includes slack in Policies.
    • live OpenShell policy contains Slack endpoints (slack.com, api.slack.com, wss-primary.slack.com, wss-backup.slack.com, etc.).
    • /sandbox/.openclaw/openclaw.json contains Slack channel config.
  3. Trigger rebuild lifecycle:

    nemoclaw <sandbox> rebuild --yes

    Alternative paths worth testing because they use rebuild/resume semantics:

    • nemoclaw <sandbox> channels add slack
    • nemoclaw <sandbox> channels remove slack then add again
    • interrupted rebuild followed by nemoclaw onboard --resume
  4. Re-check state:

    nemoclaw <sandbox> status
    openshell policy get --full <sandbox> | grep -i slack
    docker exec <new-container> sh -lc 'grep -n "slack" -A12 -B2 /sandbox/.openclaw/openclaw.json'
  5. Bug condition:

    • openclaw.json still contains Slack channel config, but
    • nemoclaw <sandbox> status does not list slack, or
    • openshell policy get --full <sandbox> lacks Slack network policy entries.

Expected behavior

If Slack messaging is configured/enabled after a rebuild, the recreated sandbox must include the Slack network policy preset at creation time or reapply it immediately after creation.

The invariant should be:

Slack channel enabled/configured implies Slack egress policy present.

This should hold across:

  • initial onboard
  • nemoclaw <sandbox> rebuild
  • nemoclaw onboard --resume
  • channels add/remove/start/stop flows that rebuild the sandbox
  • credential rotation rebuilds

Acceptance criteria / done definition

  • Add regression coverage for the rebuild path showing that a sandbox with messagingChannels: ["slack"] is recreated with the slack policy preset.
  • After nemoclaw <sandbox> rebuild --yes, both are true:
    • Slack channel config remains present in /sandbox/.openclaw/openclaw.json.
    • live OpenShell policy contains the slack network policy entries.
  • nemoclaw <sandbox> status reports slack in Policies when Slack messaging is configured.
  • No manual nemoclaw <sandbox> policy-add slack is required after rebuild.
  • Existing channel stop/remove semantics remain intact: if Slack is intentionally removed/stopped, the policy should not be silently re-granted unless the configured active channel state requires it.

Related but distinct issues

Metadata

Metadata

Assignees

Labels

VRDCIssues and PRs submitted by NVIDIA VRDC test team.integration: slackSlack integration or channel behavior

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions