feat(policy): add provider profile backed presets#3745
Conversation
📝 WalkthroughWalkthroughThis PR introduces OpenShell provider profile support to NemoClaw by shipping ten pre-configured provider profiles (Brave, Brew, Discord, Hugging Face, Jira, local-inference, npm, PyPI, Slack, Telegram), implementing an onboarding module to import them into OpenShell installations, and extending the policy system to treat imported profiles as dynamically available presets. ChangesProvider Profile Onboarding & Preset Integration
Sequence Diagram(s)sequenceDiagram
participant Wizard as Onboarding Wizard
participant Onboard as ensureNemoClawProviderProfiles
participant CLI as OpenShell CLI
participant FS as Filesystem
Wizard->>Onboard: import missing profiles
Onboard->>FS: scan NEMOCLAW_PROVIDER_PROFILES_DIR for .yaml files
Onboard->>CLI: provider list-profiles -o json
CLI-->>Onboard: existing profile IDs
Onboard->>FS: identify missing profiles
Onboard->>FS: copy missing YAMLs to temp directory
Onboard->>CLI: provider profile lint
Onboard->>CLI: provider profile import --from tempDir
CLI-->>Onboard: import result or error
Onboard->>FS: remove temp directory
Onboard-->>Wizard: ProviderProfileImportResult (imported/skipped/unsupported)
sequenceDiagram
participant Client as Preset Loader
participant Policy as src/lib/policy/index.ts
participant Cache as Provider Profile Cache
participant CLI as OpenShell CLI
Client->>Policy: listPresets() or loadPreset(name)
Policy->>Cache: check cache
alt Cache Hit
Cache-->>Policy: cached profiles
else Cache Miss
Policy->>Policy: check NEMOCLAW_OPENSHELL_PROVIDER_PROFILES_JSON env
alt Env Var Present
Policy->>Policy: parse JSON profiles
else Env Var Absent
Policy->>CLI: provider list-profiles -o json
CLI-->>Policy: profiles JSON
Policy->>Policy: parse JSON profiles
end
Policy->>Cache: store profiles
end
Policy->>Policy: filter profiles with policy endpoints
Policy->>Policy: convert profiles to preset YAML
Policy-->>Client: merged builtin + provider presets
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
|
✨ Thanks for submitting this detailed PR to add provider profile backed presets and improve policy preset discovery. This change aims to enhance the integration of NemoClaw with OpenShell and other providers by adding reusable presets and improving the onboarding process. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
docs/reference/nemoclaw-openshell-integration.md (2)
70-73: ⚡ Quick winAdd a
Next Stepssection at the bottom.This new page currently ends without the required related-links section.
As per coding guidelines, new docs pages should include “A ‘Next Steps’ section at the bottom links to related pages.”
🤖 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 `@docs/reference/nemoclaw-openshell-integration.md` around lines 70 - 73, Add a final "## Next Steps" section to this page (located near the existing "## Provider Profiles" heading) that lists related links for readers to continue (e.g., onboarding guide, policy presets reference, OpenShell gateway docs, and provider profile management), using the same heading style and relative-link format as other docs pages so the new section appears at the bottom and follows project doc conventions.
68-72: ⚡ Quick winUse one sentence per line in prose.
Lines 68 and 72 contain multiple sentences on a single source line; split them so each sentence is on its own line.
As per coding guidelines, “One sentence per line in source (makes diffs readable).”
🤖 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 `@docs/reference/nemoclaw-openshell-integration.md` around lines 68 - 72, The "Provider Profiles" paragraph contains multiple sentences on the same source line; split that paragraph so each sentence is its own line (e.g., separate "NemoClaw imports OpenShell provider profiles for its policy presets during onboarding.", "Existing OpenShell profiles are left untouched, and already-imported NemoClaw profiles are skipped so repeated onboarding remains idempotent.", and "If the OpenShell gateway does not support provider-profile import, NemoClaw continues with local fallback presets." into three separate lines) to comply with the one-sentence-per-line guideline.
🤖 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 `@docs/reference/nemoclaw-openshell-integration.md`:
- Around line 1-2: The new docs page "NemoClaw OpenShell Integration" is missing
required frontmatter and the SPDX header; add YAML frontmatter at the top
containing title, description, keywords, topics, tags, content type, difficulty,
audience, and status fields, then place the SPDX license header immediately
after that frontmatter block (as specified by the guidelines) so the file begins
with a YAML frontmatter block followed by the SPDX markdown header.
In `@src/lib/onboard.ts`:
- Around line 333-334: The onboarding entrypoint has grown heavyweight due to
the provider-profile orchestration wired via the providerProfileOnboard require;
extract the orchestration and logging logic out of src/lib/onboard.ts into a new
module (e.g., ./onboard/provider-profiles-orchestration) and keep
src/lib/onboard.ts as a thin call site that only imports/awaits a single
function (leave the providerProfileOnboard require or switch to an import of the
new module), or alternatively remove the additional orchestration/logging lines
from onboard.ts so it only delegates to providerProfileOnboard; update
references to providerProfileOnboard to call the single exported orchestration
function and ensure logging lives in the new module.
---
Nitpick comments:
In `@docs/reference/nemoclaw-openshell-integration.md`:
- Around line 70-73: Add a final "## Next Steps" section to this page (located
near the existing "## Provider Profiles" heading) that lists related links for
readers to continue (e.g., onboarding guide, policy presets reference, OpenShell
gateway docs, and provider profile management), using the same heading style and
relative-link format as other docs pages so the new section appears at the
bottom and follows project doc conventions.
- Around line 68-72: The "Provider Profiles" paragraph contains multiple
sentences on the same source line; split that paragraph so each sentence is its
own line (e.g., separate "NemoClaw imports OpenShell provider profiles for its
policy presets during onboarding.", "Existing OpenShell profiles are left
untouched, and already-imported NemoClaw profiles are skipped so repeated
onboarding remains idempotent.", and "If the OpenShell gateway does not support
provider-profile import, NemoClaw continues with local fallback presets." into
three separate lines) to comply with the one-sentence-per-line guideline.
🪄 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: 2897dc43-81cb-4314-978d-39c6df625cf2
📒 Files selected for processing (16)
docs/reference/nemoclaw-openshell-integration.mdnemoclaw-blueprint/provider-profiles/brave.yamlnemoclaw-blueprint/provider-profiles/brew.yamlnemoclaw-blueprint/provider-profiles/discord.yamlnemoclaw-blueprint/provider-profiles/huggingface.yamlnemoclaw-blueprint/provider-profiles/jira.yamlnemoclaw-blueprint/provider-profiles/local-inference.yamlnemoclaw-blueprint/provider-profiles/npm.yamlnemoclaw-blueprint/provider-profiles/pypi.yamlnemoclaw-blueprint/provider-profiles/slack.yamlnemoclaw-blueprint/provider-profiles/telegram.yamlsrc/lib/onboard.tssrc/lib/onboard/provider-profiles.tssrc/lib/policy/index.tstest/policies.test.tstest/provider-profile-onboard.test.ts
| # NemoClaw OpenShell Integration | ||
|
|
There was a problem hiding this comment.
Add required docs frontmatter and SPDX header placement.
This new docs page is missing required frontmatter fields, and the SPDX markdown header is also missing.
Proposed structure
+---
+title:
+ page: NemoClaw OpenShell Integration
+description: <add description>
+keywords: [<add keywords>]
+topics: [<add topics>]
+tags: [<add tags>]
+content_type: reference
+difficulty: <add difficulty>
+audience: <add audience>
+status: <add status>
+---
+
+<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -->
+<!-- SPDX-License-Identifier: Apache-2.0 -->
+
# NemoClaw OpenShell IntegrationAs per coding guidelines, “SPDX license header is present after frontmatter” and frontmatter must include “title, description, keywords, topics, tags, content type, difficulty, audience, and status fields.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # NemoClaw OpenShell Integration | |
| --- | |
| title: | |
| page: NemoClaw OpenShell Integration | |
| description: <add description> | |
| keywords: [<add keywords>] | |
| topics: [<add topics>] | |
| tags: [<add tags>] | |
| content_type: reference | |
| difficulty: <add difficulty> | |
| audience: <add audience> | |
| status: <add status> | |
| --- | |
| <!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> | |
| <!-- SPDX-License-Identifier: Apache-2.0 --> | |
| # NemoClaw OpenShell Integration |
🤖 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 `@docs/reference/nemoclaw-openshell-integration.md` around lines 1 - 2, The new
docs page "NemoClaw OpenShell Integration" is missing required frontmatter and
the SPDX header; add YAML frontmatter at the top containing title, description,
keywords, topics, tags, content type, difficulty, audience, and status fields,
then place the SPDX license header immediately after that frontmatter block (as
specified by the guidelines) so the file begins with a YAML frontmatter block
followed by the SPDX markdown header.
| const providerProfileOnboard: typeof import("./onboard/provider-profiles") = | ||
| require("./onboard/provider-profiles"); |
There was a problem hiding this comment.
Onboard entrypoint budget is currently blocked by this wiring.
CI is failing because src/lib/onboard.ts grew by +16 lines. Please move this provider-profile orchestration/logging out of src/lib/onboard.ts (keep only a thin call site here), or remove equivalent lines in this file so the budget check passes.
Also applies to: 1795-1805, 9751-9751
🤖 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/onboard.ts` around lines 333 - 334, The onboarding entrypoint has
grown heavyweight due to the provider-profile orchestration wired via the
providerProfileOnboard require; extract the orchestration and logging logic out
of src/lib/onboard.ts into a new module (e.g.,
./onboard/provider-profiles-orchestration) and keep src/lib/onboard.ts as a thin
call site that only imports/awaits a single function (leave the
providerProfileOnboard require or switch to an import of the new module), or
alternatively remove the additional orchestration/logging lines from onboard.ts
so it only delegates to providerProfileOnboard; update references to
providerProfileOnboard to call the single exported orchestration function and
ensure logging lives in the new module.
| if (list.status !== 0) { | ||
| return { | ||
| status: "unsupported", | ||
| imported: [], | ||
| skipped: [], | ||
| message: "OpenShell provider profiles are not available; using local preset fallbacks.", | ||
| }; | ||
| } |
There was a problem hiding this comment.
Do not classify every list-profiles failure as unsupported.
On Line 116, any non-zero exit is treated as "unsupported". This can silently suppress transient/runtime failures (timeout, execution failure, malformed runtime output) and skip profile import when OpenShell is actually supported.
Suggested fix
const list = runOpenshell(["provider", "list-profiles", "-o", "json"], {
ignoreError: true,
stdio: ["ignore", "pipe", "pipe"],
suppressOutput: true,
timeout: 10_000,
});
if (list.status !== 0) {
- return {
- status: "unsupported",
- imported: [],
- skipped: [],
- message: "OpenShell provider profiles are not available; using local preset fallbacks.",
- };
+ if (isUnsupportedProviderProfileCommand(list)) {
+ return {
+ status: "unsupported",
+ imported: [],
+ skipped: [],
+ message: "OpenShell provider profiles are not available; using local preset fallbacks.",
+ };
+ }
+ const details = outputText(list.stderr) || outputText(list.stdout) || "provider list-profiles failed";
+ throw new Error(`NemoClaw provider profile discovery failed: ${details.trim()}`);
}Based on learnings: handle failures at external/system boundaries where they can realistically occur, rather than masking them with generic fallbacks.
Summary
Adds NemoClaw provider profile manifests and teaches policy preset discovery to synthesize agent-visible presets from OpenShell provider profiles. Onboarding imports the NemoClaw profiles into OpenShell when supported, while retaining fallback built-in presets for older OpenShell versions.
Changes
nemoclaw-blueprint/provider-profiles/for Brave, brew, Discord, Hugging Face, Jira, local inference, npm, PyPI, Slack, and Telegram.src/lib/onboard/provider-profiles.tsand import profiles during onboarding without overwriting existing OpenShell profiles.src/lib/policy/index.tsto merge provider-backed presets with existing built-ins.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)Signed-off-by: Patrick Riel priel@nvidia.com
Summary by CodeRabbit
Release Notes
New Features
Documentation