Skip to content

refactor!: compile web search to an openshell_api with REST rules - #14651

Merged
cv merged 7 commits into
v1from
refactor/web-search-as-api
Nov 21, 2026
Merged

cv merged 7 commits into
v1from
refactor/web-search-as-api

Conversation

@kaofelix

@kaofelix kaofelix commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

The SDK now compiles a webSearch integration into an openshell_api resource whose new rest rules admit only the search requests, and the openshell provider no longer serves openshell_web_search. HCL configurations that declared openshell_web_search must declare an openshell_api instead; YAML deployments keep their webSearch definitions.

Problem

OpenShell has no web search concept: a search registration is an ordinary provider profile and registration, the same objects openshell_api creates. The openshell provider still served openshell_web_search as a separate resource, with its own profile builder, registration naming, credential handling, lifecycle and import code, and Brave and Tavily hard-coded below the SDK. openshell_api could not replace it, because it granted either full access to each endpoint's path subtree or MCP rules, never specific REST requests such as Brave's GET /res/v1/web/search. The SDK also wrote a second copy of the search grant into each sandbox's policy.

Change

  • openshell_api REST rules. A rest block, beside mcp, lists rules in OpenShell's own allow-rule shape, matching a method, a path glob, or both. With it the resource takes one endpoint naming only a scheme, host and port, and the profile enforces exactly those requests. A resource sets at most one of rest and mcp, and neither when APF serves its profile.
  • OpenShell validates profile rules at plan time. Every API profile, REST, MCP or full access, passes through OpenShell's own policy validation, openshell_policy::validate_and_canonicalize_sandbox_policy, so a plan fails on rules that validation rejects. NemoClaw adds no rule checks of its own for REST.
  • Web search compiles in the SDK. SearchProvider and its table of hosts, key headers, default sandbox variables and REST rules move from nemoclaw-openshell into the SDK's integration configuration. A webSearch integration compiles to an openshell_api target with those values. The OpenShell endpoint grant is the same one the search resource created. On an APF-governed gateway the target sets no rules, because APF's profile does.
  • Registration names. A search registers as <provider>-search-<credential reference hash>-<image scope>, so sandboxes that share the provider, credential reference and image still share one registration, and the name fits OpenShell's 40-character limit. Inference provider and api integration names cannot use the brave-search or tavily-search prefixes, so those names identify a web search, as the plan output's label relies on.
  • One grant. The sandbox policy no longer repeats the search grant; the attached profile grants the search API, as it does for any API. Policy rules may now be named nemoclaw-brave or nemoclaw-tavily.
  • Removed. openshell_web_search, nemoclaw-openshell's search module, and the search paths in the provider's profile, registration, connection, lifecycle, import and input code. The deleted module's notice described collector-grant code that an earlier change had already removed.
  • Export. The search-specific drift check compared every scalar input; general export validation compares only identity and JSON inputs. The check now covers every openshell_api target, so export also refuses drift in an api integration's credential_env, sandbox_env, auth_style or header_name.
  • Labels. Plan output still names a search row web search/<provider>. Apply progress names every openshell_api row, search included, API credential.
  • Docs and examples. The HCL travel team registers its search with openshell_api and rest rules; the provider reference, agent, and sandbox network pages describe the new grant; the sandboxEnv description now names the provider's default variable, which the sandbox already received.

Deployments applied with web search before this change cannot plan or destroy afterwards: their state holds openshell_web_search resources, which the openshell provider no longer serves. No state migration is provided; such a deployment must be torn down with the earlier release first. An APF bundle must serve the search profile under its new name, nemoclaw-api-<provider>-search-….

Beyond CI

  • A one-off comparison, not kept as a test, showed that rest rules produce the same OpenShell endpoints as the removed search_policy for both Brave and Tavily.
  • Not run: cargo ci live-docker and cargo ci live-kind, and the ignored managed_gateway_live profile revision test, which now imports the REST-restricted API profiles in place of search profiles.
  • Unverified: a live search request through the new profile; live Brave and Tavily requests were already unqualified (Qualify more platforms, placements, models, and integrations #12641).

openshell_api gains a rest block of method and path rules for one host
endpoint. The SDK compiles a webSearch integration into that resource, and
the openshell provider no longer serves openshell_web_search.
@copy-pr-bot

copy-pr-bot Bot commented Nov 19, 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.

@kaofelix

Copy link
Copy Markdown
Collaborator Author
Authoring session — opening
Field Status Value Evidence or limit
Harness recorded Claude Code 2.1.318, then 2.1.319 Version field on each session record entry
Skills recorded nemoclaw-contributor-create-pr (injected) Skill invocations to the cutoff; no other skill was loaded
Instruction files recorded AGENTS.md, user CLAUDE.md and its included AGENTS.md, auto-memory MEMORY.md (injected); WRITING.md, two auto-memory entries, PULL_REQUEST_TEMPLATE.md, SESSION_REPORT_TEMPLATE.md (complete reads) Startup injections and read results in the record
Tool calls recorded Refactor interval: Bash: 149; Write: 1; AskUserQuestion: 1; Skill: 1. Whole session: Bash: 243; Read: 3; Write: 3; AskUserQuestion: 1; Skill: 1 Attempted tool_use blocks, failures included, counted once by ID; commands that Bash ran, such as cargo, python3, git and gh, are not counted separately
Tokens recorded input: 70280354; cached input: 68577902; output: 116294 Refactor interval: final message.usage per API response through the cutoff; input sums uncached, cache-creation and cache-read tokens. The whole session, onboarding work included, used input 89954607, cached input 87176150, output 186417
Session window recorded Whole session 2026-11-05T18:17Z to 2026-11-19T13:34Z, about 13 days 19 h; refactor interval from 2026-11-18T16:50Z, about 20 h 44 min First record entry and the refactor request to the cutoff, idle time included; the earlier part of the session was onboarding work and research on another branch
Compactions recorded 0 No compaction entries in the record to the cutoff
Models recorded claude-sonnet-5-5, then claude-opus-5-5 from 2026-11-18T16:51Z Assistant message model, in order; the refactor interval used claude-opus-5-5 only
Reasoning levels recorded medium Effort field on every request; no changes

@github-actions

Copy link
Copy Markdown
Contributor

@wscurran wscurran added area: integrations Third-party service integration behavior area: security Security controls, permissions, secrets, or hardening integration: brave Brave integration behavior v1 NemoClaw v1 branch labels Nov 19, 2026
@kaofelix
kaofelix marked this pull request as ready for review November 20, 2026 13:41
cv pushed a commit that referenced this pull request Nov 21, 2026
…4736)

Teams that keep OpenTofu in their own repository and pipelines now have
one guide for running NemoClaw's providers without the CLI or SDK. It
walks through installing the providers from a bundle, state and locking,
CI/CD, credentials, sandbox replacement, and teardown, and says at each
step what the SDK would have done for them, so they can pick a path.

## Problem

The providers already work from hand-written HCL with any state backend,
as the compatibility page says. The steps, though, are spread across the
provider reference, the compatibility page, and comments in
`examples/hcl`, and installation gets a single bullet. Nothing tells a
team how to keep `.terraform.lock.hcl` valid across runners, which
inputs a plan job needs, what happens when a create's reply is lost, or
that `tofu destroy` deletes the model cache that `nemoclaw destroy`
would keep.

Resolves #14723. Running under Terraform stays with #14725, and
publishing the providers stays with #12638.

## Change

- New guide `docs/build-deploy/opentofu-project.md`, under Building and
Deploying after Using Desired State:
- A table comparing your own project with the CLI or SDK on state, lost
creation replies (the pending-creation guard), ownership generations,
plan checks, destroy, and recovery.
- Installing from the bundle's `providers` directory as a filesystem
mirror: the version from `manifest.json`, exact pins for pre-release
versions, the `provider_installation` block, and what to do with the
lock file when the bundle changes.
- State: any backend that locks, kept apart from CLI state, one
OpenShell workspace name per project and OpenTofu workspace, and the
directory that `NEMOCLAW_KUBERNETES_STATE` names for a managed
Kubernetes gateway.
- CI/CD: what a job needs, including model endpoints that readiness data
sources poll and their 32,400 second default wait; one gateway endpoint
everywhere; `tofu providers lock -fs-mirror` for other runner platforms;
and a postcondition that stops a plan at an incompatible gateway, since
the travel examples do not check `compatible`.
- Credentials as variable names: `credential_env` on the travel team's
`openshell_api` registration, the gateway's TLS variables, and
`kubeconfig_env` on a managed Kubernetes gateway's three
`openshell_kubernetes_*` resources, next to the kubeconfig path Helm
takes and the variable the gateway's specification names. A model
server's key reaches `openshell_inference` through `credential_env` on a
literal server, or through `credential_source` on a readiness read's
`ref` for a server that requires its generated key.
- `terraform_data` with `replace_triggered_by`, from the travel example,
plus the `tofu apply -replace` step after an agent start loses its
reply.
- Teardown: what `tofu destroy` deletes, keeping the OpenShell workspace
with `-exclude`, and the GTC DC example's targeted teardown for a
managed Kubernetes gateway, whose `openshell_kubernetes_storage` the
provider never deletes.
- The compatibility page's Hand-Written HCL section now agrees with the
guide on what `tofu destroy` deletes and on what state stores for
credentials.
- The overview, the docs index, and the provider reference link to the
guide. The provider reference's install bullet now points to it, and
Fern navigation lists it.
- Current limits gain rows for Terraform (#14725), the missing
lost-reply guard in hand-written HCL (#14726), handing a CLI deployment
over (#14721), and the unpublished tested version set (#14722).

Every HCL snippet is an excerpt of `examples/hcl/travel` or
`examples/hcl/travel-team`, apart from the gateway postcondition, which
mirrors the check generated graphs add. The credential example uses
`openshell_api` instead of `openshell_web_search`, which #14651
replaces. I left the provider reference's teardown bullet alone because
it sits next to a line #14651 rewrites; the guide agrees with it and
adds the `-exclude` step.

The parent RFC (#14699) is not accepted yet, so here is the decision
record:

- Decision: document the hand-written HCL path that v1 already has.
- Reason: compatibility already supports it with any backend, and an
integration test applies both examples unchanged. The guide adds no new
support claim.
- Placement: one task guide in Building and Deploying. The provider
reference keeps the per-type contracts.
- Validation: the docs build and link checks, plus the OpenTofu runs
below.

No test qualifies a complete deployment from hand-written HCL on live
resources. The provider reference already says so, and the guide repeats
it. No issue tracks adding that qualification yet.

## Beyond CI

With OpenTofu 1.13.9 and a development bundle's `providers` directory on
macOS ARM64:

- `tofu init` with the guide's CLI configuration installed the NVIDIA
providers from the mirror at the pinned version, labelled
`unauthenticated`, and sent `kreuzwerker/docker` to the registry.
- Without an exact pin, `tofu init` found no matching release for the
pre-release provider. After a pin changed, `tofu init` needed
`-upgrade`.
- `.terraform.lock.hcl` held checksums for the local platform only.
`tofu providers lock -fs-mirror=... -platform=linux_amd64`, run against
a mirror laid out for that platform, added its checksum and kept the
existing one.
- The gateway postcondition snippet passed `tofu validate` against the
bundle's openshell provider.
- With built-in `terraform_data` stand-ins, `prevent_destroy` made `tofu
destroy` refuse to run, and `tofu destroy -exclude` destroyed everything
except the excluded resource.

Not run: `tofu init` for the full travel example, because the Docker
provider's registry download was blocked in this environment; `tofu
validate` or `plan` of the examples; and anything against a live
gateway.


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

## Summary by CodeRabbit

* **Documentation**
* Added a guide to using the providers from a team-owned OpenTofu
project and pipeline, including setup, state management, CI checks,
credentials, and teardown.
* Added links to the guide from the documentation overview and provider
reference.
* Updated provider installation guidance and documented limitations for
hand-written configurations, including unsupported imports and Terraform
testing.
* Clarified how state, credentials, and resource protection affect
teardown, and added references to tracked provider limitations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Deepak Jain <deepujain@gmail.com>
@cv
cv merged commit 5a8b723 into v1 Nov 21, 2026
152 of 155 checks passed
@cv
cv deleted the refactor/web-search-as-api branch November 21, 2026 10:43
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: integrations Third-party service integration behavior area: security Security controls, permissions, secrets, or hardening integration: brave Brave integration behavior v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants