Skip to content

[DGX Spark][Onboard] balanced tier creates global brave provider profile as side effect — second sandbox with Brave Search fails rebuild preflight with false "credential invalid" #7097

Closed

Description

@lyral-commits

Description

Applying the balanced policy tier to any sandbox creates a global brave.yaml provider profile as a side effect, even when Brave Search web tool is not explicitly enabled. When a second sandbox later enables Brave Search, onboard reports custom provider profile 'brave' already exists and nemoclaw rebuild preflight incorrectly fails with "Brave Search credential is invalid" — even though the credential is valid and Brave Search works correctly in practice.

Two defects:

  1. balanced tier applying the brave egress preset creates a global provider profile as a side effect — network policy and provider profile are independent concerns and should not be coupled.
  2. rebuild preflight incorrectly rejects a valid Brave credential, blocking rebuild unless BRAVE_API_KEY is re-supplied as an env var.

Reproduced on both v0.0.83 LKG and v0.0.84. Related to but distinct from #5367 (that bug was a gateway-unusable failure; this is a false preflight rejection with a working credential).

Platform scope: Reproduced on DGX Spark (Ubuntu 24.04 aarch64); likely affects all platforms using balanced tier; other platforms not tested.
Regression: Unknown — earlier versions not tested.

Environment

Device:        DGX Spark (GB10)
OS:            Ubuntu 24.04 aarch64
Architecture:  aarch64
Node.js:       v22.23.1
npm:           10.9.8
Docker:        29.2.1
OpenShell CLI: 0.0.72
NemoClaw:      v0.0.83 and v0.0.84 (both reproduce)
OpenClaw:      2026.6.10

Steps to Reproduce

  1. Install NemoClaw with any sandbox using the balanced policy tier (express install or nemoclaw onboard with default Balanced tier). Brave Search web tool does not need to be enabled.
  2. Create a second sandbox and enable Brave Search web tool during onboarding.
  3. Observe during onboard:
error .../provider-profiles/brave.yaml profile=brave field=id
custom provider profile 'brave' already exists
Error: × provider profile import failed
  1. Run: nemoclaw {sandbox} rebuild --yes
  2. Observe rebuild preflight fails:
Brave Search credential is invalid.
Brave Search requires BRAVE_API_KEY or a saved Brave Search credential in non-interactive mode.

Expected Result

  • brave.yaml provider profile import is idempotent (skip-if-exists, no error).
  • rebuild preflight correctly validates the saved credential; if credential is functional, preflight passes.

Actual Result

  • custom provider profile 'brave' already exists error on second sandbox onboard.
  • rebuild --yes fails preflight with "Brave Search credential is invalid."
  • Workaround: set BRAVE_API_KEY before running rebuild.
  • Brave Search actually works correctly (TUI web search returns results) despite the errors.

Logs

Not captured.

Activity

  1. added
    NV QA
    needs: triage
    on Jul 17, 2026
  2. self-assigned this
    on Jul 17, 2026
  3. jason-ma-nv commented on Jul 17, 2026

    @jason-ma-nv
    Collaborator

    Automated triage findings (unassigning after investigation — this needs maintainer decisions I shouldn't make unattended). Both defects were traced to source.

    Defect 1 — custom provider profile 'brave' already exists on second-sandbox onboard

    NemoClaw's own provider-profile import is already idempotent at both (and the only two) call sites, so this is not a mechanical NemoClaw fix:

    • src/lib/onboard/brave-provider-profile.ts:126-127 — if (/already exists/i.test(rawDiagnostic)) continue; (tolerates OpenShell's non-zero re-import), covered by src/lib/onboard/brave-provider-profile.test.ts:99-113.
    • src/lib/actions/credentials-add.ts:64 — same tolerance.

    The brave egress policy preset (nemoclaw-blueprint/policies/presets/brave.yaml) is a pure L7 egress allowlist with no provider-profile reference, and tier resolution (src/lib/policy/tiers.ts) returns preset names only — nothing in NemoClaw TS turns "brave egress preset applied" into "provider profile imported" (the profile import is token-gated: brave-provider-profile.ts:98,106). So the un-tolerated × provider profile import failed is emitted outside NemoClaw's wrapped call sites — i.e. OpenShell materializing/rejecting a provider profile when the egress preset is applied, or a direct import. Needs a design decision + OpenShell-side confirmation, not a repo change here.

    Defect 2 — rebuild --yes preflight false "Brave Search credential is invalid"

    Root cause is real and localized to the web-search rebuild preflight:

    • src/lib/actions/sandbox/rebuild-target-runtime.ts:34-60 (preflightRebuildWebSearchCredential) → rebuildOnboardDependencies.ensureValidatedWebSearchCredential(config, /*nonInteractive*/ true).
    • src/lib/onboard/web-search-flow.ts:277-286 resolves the key only from process.env (getCredential → src/lib/credentials/store.ts:185-190, env-only) and throws the exact "requires BRAVE_API_KEY or a saved Brave Search credential" message when it is absent.
    • The durable web-search credential is not on the host env after a fresh rebuild process — it lives in the OpenShell gateway as a sandbox-scoped provider named `${sandboxName}-${provider}-search` (src/lib/onboard/messaging-prep.ts:91). So preflight fails even though the credential is valid and Brave works at runtime.

    The inference preflight already solves this exact "gateway holds the secret, host env doesn't" case — src/lib/actions/sandbox/rebuild-credential-preflight.ts:189-194 ("provider registered in gateway — skipping env check"). The web-search preflight has no equivalent gateway-registered fallback.

    Suggested fix (for a maintainer): in preflightRebuildWebSearchCredential, when host-env validation throws, check whether the sandbox-scoped web-search provider `${sandboxName}-${provider}-search` is registered in the gateway (mirroring providerExistsInGateway) and, if so, accept — skip the host-env requirement. This threads the sandbox name + a gateway check into the preflight.

    Why I'm not landing it unattended: it relaxes a credential preflight (a security-relevant trust boundary), and its correctness depends on the gateway provider-name + gateway recognition, which can't be verified on the CPU/DGX-Spark hosts available to this loop — a mocked unit test would pass regardless of whether the real gateway lookup is right, giving false confidence. It should be implemented and verified against a real gateway.

    The two defects are in separate flows (onboard/import vs. rebuild preflight) and can be fixed separately.

  4. removed their assignment
    on Jul 17, 2026
  5. added
    area: onboarding
    area: policy
    area: sandbox
    integration: brave
    platform: dgx-spark
    and removed
    needs: triage
    on Jul 17, 2026
  6. self-assigned this
    on Jul 18, 2026
  7. nvshaxie commented on Jul 18, 2026

    @nvshaxie
    Contributor

    Claimed this and opened #7129 for the rebuild preflight failure (defect 2).

    Root cause: saveCredential stages web-search keys to the process env only — nothing is persisted to host disk by design (credentials-gateway-only contract); the OpenShell gateway provider (<sandbox>-brave-search) is the durable system of record, which is why Brave Search keeps working in the TUI. A fresh rebuild --yes process therefore has no host BRAVE_API_KEY, and the preflight demanded one even though the OpenClaw recreate path reuses the gateway-registered credential (messaging-prep requiresExactOpenClawProviderBinding). #7129 makes the preflight accept that same gateway credential-only binding (identity metadata only — no credential values read), failing closed for mismatched bindings, staged host keys, and non-OpenClaw agents.

    On defect 1 (balanced tier creating a global brave provider profile, and custom provider profile 'brave' already exists on the second onboard): NemoClaw's provider profile import has tolerated already exists since #6165 (in v0.0.53+), so the re-import itself is non-fatal on v0.0.83/84 — the message you saw is OpenShell's stderr, not an aborting error. Whether the brave egress preset should stop registering the provider profile is a design decision: the profile is what drives the L7 proxy's X-Subscription-Token rewrite for that preset, so decoupling them needs maintainer direction rather than a drive-by change. Leaving that part open here.

  8. added a commit that references this issue on Jul 18, 2026
    c1cc4b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NV QAarea: onboardingarea: policyarea: sandboxintegration: braveplatform: dgx-spark

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions