Skip to content

feat(blueprint): prepare external target observation - #10310

Closed
apurvvkumaria wants to merge 3 commits into
mainfrom
codex/9872-external-observation-main
Closed

feat(blueprint): prepare external target observation#10310
apurvvkumaria wants to merge 3 commits into
mainfrom
codex/9872-external-observation-main

Conversation

@apurvvkumaria

@apurvvkumaria apurvvkumaria commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR prepares the typed, read-only observation boundary for an explicit external OpenShell target. The boundary checks the public release before an opaque credential handoff and then sequences identity, workspace, and inventory observations without using ambient CLI state.

Machine authentication and the exact supported OpenShell release remain undecided. This PR adds no credential read, SDK transport, authenticated call, or remote mutation.

Related Issue

Related to #9872

Changes

  • Move the merged Phase 1 slice 1: Route sandbox inventory and readiness through the OpenShell adapter #9803 sandbox observer types into one generated shared boundary for the Blueprint Runner and root CLI adapters. The two packages cannot directly share source imports, and the focused boundary tests protect the shared contract.
  • Add an external target request with an explicit endpoint, workspace, configured release, and allWorkspaces: false.
  • Sequence public health and release validation before the opaque file-backed credential handoff. Fake-only tests verify positive, release-mismatch, denial, timeout, schema, workspace-mismatch, and diagnostic-redaction behavior.
  • Reject external targets in the CLI observer before it can read ambient CLI state.
  • Add the shared boundary to the TypeScript build and Vitest source aliases.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • 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:
  • Tests 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: Local review covered credential boundaries, explicit targeting, authorization, diagnostic redaction, dependencies, sequencing, and remote effects. It found no blocking issue.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification:
    • npx vitest run --project plugin nemoclaw/src/shared/openshell-observation-boundary.test.ts --project cli src/lib/adapters/openshell/sandbox-observer-cli.test.ts: 22 tests passed.
    • npm run typecheck:cli: passed.
    • npm --prefix nemoclaw run typecheck: passed.
    • Clean root and plugin builds: passed.
    • npx vitest run --project package-contract test/package-contract/blueprint-external-target-plan.test.ts: 1 test passed.
    • npm run checks:repository: passed.
    • npm run validate:pr: passed.
    • npm run test:package: 1,230 tests passed. Ten credential-command tests stopped at the installed OpenShell lifecycle-authority check; exact origin/main reproduced the same ten failures.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Apurv Kumaria akumaria@nvidia.com

Summary by CodeRabbit

  • New Features

    • Added external OpenShell target observation, including gateway health, release compatibility, workspace identity, current user, and sandbox inventory.
    • Added structured sandbox readiness, lookup, and observation results.
    • Added sanitized error reporting that avoids exposing credentials or authentication details.
  • Bug Fixes

    • External targets are rejected early by CLI-based sandbox operations with clear invalid-request errors.
    • Workspace mismatches and incompatible gateway releases are detected before inventory access.
    • Observation requests now reject unvalidated targets and protect returned results from unexpected changes.

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria apurvvkumaria self-assigned this Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This repository limits you to 10 open pull requests. Please close or merge an existing PR before opening another one.

@github-actions github-actions Bot closed this Aug 25, 2026
@github-code-quality

github-code-quality Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall line coverage in commit 7c0a6fc in the codex/9872-external-... branch remains at 96%, unchanged from commit 28beb3d in the main branch.

Show a line coverage summary of the most impacted files.
File main 28beb3d codex/9872-external-... 7c0a6fc +/-
nemoclaw/src/sh...et-boundary.cts 98% 98% 0%
nemoclaw/src/sh...on-boundary.cts 0% 95% +95%

TypeScript / code-coverage/cli

The overall line coverage in commit 7c0a6fc in the codex/9872-external-... branch remains at 83%, unchanged from commit 28beb3d in the main branch.

Show a line coverage summary of the most impacted files.
File main 28beb3d codex/9872-external-... 7c0a6fc +/-
src/lib/adapter...box-observer.ts 100% 0% -100%
src/lib/adapter...observer-cli.ts 100% 99% -1%
src/lib/onboard...uild-context.ts 74% 74% 0%
src/lib/sandbox...rce-identity.ts 82% 82% 0%
src/lib/adapter...shell/client.ts 86% 87% +1%

Updated August 26, 2026 00:15 UTC

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1a35ebe7-5196-4908-aabf-c1bfd62f6b19

📥 Commits

Reviewing files that changed from the base of the PR and between 39bd78d and 7c0a6fc.

📒 Files selected for processing (5)
  • nemoclaw/src/shared/openshell-external-target-boundary.cts
  • nemoclaw/src/shared/openshell-observation-boundary.cts
  • nemoclaw/src/shared/openshell-observation-boundary.test.ts
  • src/lib/adapters/openshell/sandbox-observer-cli.test.ts
  • test/package-contract/blueprint-external-target-plan.test.ts

Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds validated external OpenShell target plans, immutable observation requests and receipts, sanitized observer failures, adapter guards, shared exports, and expanded boundary and package-contract tests.

Changes

OpenShell external observation

Layer / File(s) Summary
Validated target contracts
nemoclaw/src/shared/openshell-external-target-boundary.cts, nemoclaw/src/shared/openshell-observation-boundary.cts
Sanitized target plans are readonly, frozen, and registered as validated. External gateway targets now require validated plans.
Immutable observation workflow
nemoclaw/src/shared/openshell-observation-boundary.cts
Observer exceptions become sanitized transport errors. Requests and successful observation results are copied and deeply frozen. Sequential observations use the validated plan for release and workspace checks.
Adapter validation and shared exports
src/lib/adapters/openshell/*, nemoclaw/tsconfig.shared.json, nemoclaw/vitest.project.ts, vitest.config.ts
Adapters re-export the shared boundary and reject external targets before CLI operations. TypeScript and Vitest resolve the shared .cts source.
Boundary and package-contract coverage
nemoclaw/src/shared/openshell-observation-boundary.test.ts, test/package-contract/blueprint-external-target-plan.test.ts
Tests cover rejection stages, forged plans, immutable requests and receipts, sanitized errors, and packaged boundary behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 7c0a6

This PR adds typed, read-only external-target observation and validation without credential reads, authenticated calls, or remote mutations; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: brandonpelfrey

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preparing external target observation support for Blueprint.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/9872-external-observation-main

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria apurvvkumaria reopened this Aug 25, 2026
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Blocking findings reported

Advisor assessment: Blockers require maintainer review
Next action: Review the blockers below.
Findings: 1 blocker · 0 warnings · 0 suggestions
Synthesis status: Completed · high confidence · 1 blocker · 0 warnings · 0 suggestions

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite for the commit under review.

Recommended E2E: None

Manual-only E2E: cloud-onboard, managed-image-multiarch-startup, security-posture, cloud-inference
The manual PR workflow does not run these selectors for the commit under review. Run them from reviewed code on main.

Blockers

PRA-1 Blocker — Remove the unconsumed external-observation framework

  • Location: nemoclaw/src/shared/openshell-observation-boundary.cts:144
  • Category: architecture
  • Problem: The PR adds an external-observation contract, credential-handoff sequence, runtime provenance state, and tests, but no production transport implements the contract and no production caller invokes the sequence. The root CLI wrapper only re-exports it. The current CLI transport and Blueprint Runner both reject external targets, so target-only planning remains the only supported behavior.
  • Impact: The repository gains an unimplemented cross-package API, a second ownership boundary, test configuration, and a runtime provenance scheme that future transport work must preserve. The changed source comment also incorrectly describes a Blueprint Runner consumer that does not exist.
  • Fix: Remove the observation boundary, root CLI re-export, observation-only tests, and their TypeScript and Vitest aliases. Keep the external-target planning boundary and add observation code with its concrete transport and Blueprint Runner consumer when external observation or apply becomes supported.
  • Verification: Search checked-in production sources for OpenShellExternalTargetObserver and observeExternalOpenShellTarget. Confirm that no implementation or caller exists outside the new boundary and wrapper, and confirm the CLI and Blueprint Runner reject external targets.
  • Test coverage: Preserve test/package-contract/blueprint-external-target-plan.test.ts coverage that proves external target-only planning does not use network, subprocess, ambient gateway state, credential contents, or filesystem mutation.
  • Evidence: nemoclaw/src/shared/openshell-observation-boundary.cts:144-364 defines OpenShellExternalTargetObserver and observeExternalOpenShellTarget. src/lib/adapters/openshell/sandbox-observer.ts:4-40 only re-exports the shared observation API. Repository search finds OpenShellExternalTargetObserver and observeExternalOpenShellTarget only in the new boundary, its tests, the wrapper, and package-contract test code. src/lib/adapters/openshell/sandbox-observer-cli.ts:210-217 and :243-250 reject external targets. nemoclaw/src/blueprint/runner.ts:1295-1299 rejects external-target apply because typed readiness and inventory are unavailable. nemoclaw/src/shared/openshell-observation-boundary.cts:4-10 claims that the Blueprint Runner consumes the boundary, but nemoclaw/src/blueprint/runner.ts:1265 only consumes openshell-external-target-boundary.cjs for target-only planning.

Recommended refactoring

Implementation guidance; a fix with equal or lower complexity is acceptable.

  • PRA-1: Remove Delete the unconsumed observation boundary, wrapper exports, observation tests, and configuration aliases.; use Keep the existing sanitized external-target planning boundary as the only external-target surface.. Net: -860 lines. Keep: Do not remove the target-plan validation or its package-contract test. Add an observation boundary only with the transport that enforces endpoint, credential, and workspace controls.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

cv added a commit that referenced this pull request Sep 1, 2026
<!-- markdownlint-disable MD041 -->
## Outcome

The Blueprint Runner can validate one explicit externally managed
OpenShell target and report the OpenShell `0.0.106` public health result
through the official TypeScript SDK.
The path uses an explicit HTTPS endpoint, workspace, and CA file without
ambient CLI state, credential contents, local gateway lifecycle calls,
or mutation.

## Reason

Kubernetes Jobs and non-root containers need a bounded first slice of
#9872 that can confirm the configured external gateway is reachable.
Authenticated identity, inventory, and readiness work requires separate
acceptance.

### Related issues

Part of #9872

## Changes

- Define shared external-target and observation contracts.
Inject the official SDK observer from the root Blueprint Runner entry
point.
- Validate external lifecycle inputs before effects.
Restrict this slice to unauthenticated public health and fixed or
redacted bounded diagnostics.
- Use one prerequisite validator for external-target plan and status.
Reject incomplete version ranges and managed-only fields before output,
file access, or observation.
- Document the experimental installed command, its OpenShell `0.0.106`
boundary, credential-file custody, external traffic, TLS and DNS trust,
unsupported capabilities, and recovery.
- Package the compiled Blueprint Runner boundary and the pinned optional
OpenShell SDK dependency graph.
Keep one canonical root-consumed SDK adapter and reject an unconsumed
Runner copy in the package contract.
- Add the trusted `external-gateway-health` PR workflow selection.
Its live commands use the bounded, redacted shell fixture and publish
redacted artifacts.
- Fail the trusted selection when no test executes.
Wait for the owned gateway process to exit after bounded `SIGTERM` and
`SIGKILL` cleanup before reporting cleanup success.
- Test the installed npm command through a consumer-style offline
install.
The committed lock supplies the dependency graph without registry
metadata lookup or lifecycle scripts.
- Record the OpenShell TypeScript SDK `0.0.106` dependency and security
review, including the current DNS, transport-lifecycle, licensing, and
provenance limits.

## Verification

- The current PR revision includes the current base revision, and the
worktree is clean.
- Large change flag: the current PR changes 43 paths with 2,708
additions and 402 deletions. Most additions are focused boundary,
package-contract, workflow, and live-E2E tests; maintainers should keep
the review surface visible.
- Clean root and plugin builds passed under Node `22.23.1`.
- Focused external-target plugin tests passed: 212 tests across five
files.
- Focused installed-package contracts passed: eight tests across four
files, including the Blueprint Runner command, the independent
`nemoclaw/lifecycle` export, wrong TLS peers, and the bounded deadline.
- Schema, repository, and pull-request workflow contracts passed: 205
tests across four files.
- Focused E2E support passed: 52 tests across three files.
- Root JavaScript, CLI TypeScript, and plugin TypeScript checks passed.
- Repository and source-shape checks passed with no cycles, no candidate
source-shape cases, and no invalid exceptions.
- `npm run docs` passed the generated agent-variant, published-route,
and Fern checks with no errors.
- `npm run validate:pr` passed the pre-commit, commit-message, and
pre-push gates on the current PR revision.
  The normal push also passed its pre-push TypeScript checks.
- Independent correctness and product-scope reviews found no actionable
implementation defect.
- Nine-category security review: `WARNING` with no `FAIL`. Accepted
residuals are platform DNS without address pinning, no SDK transport
close handle, and missing registry attestation or packaged license files
before any future Runner image distribution. This slice sends no
credential and makes no authenticated or mutating request.
- GitHub reports every commit in the PR range as Verified with reason
`valid`.
- Secret scans and independent reviews found no secrets, API keys, or
credentials.

<!-- nemoclaw-docs-review:start -->
- Documentation review: `docs-updated`
- Documentation evidence: npm run docs passed after clarifying plan and
status requirements.
- Documentation agent: openai/openai/gpt-5.6-sol
<!-- docs-review-head-sha: 5897d16 -->
<!-- docs-review-agents-blob-sha:
dd3528f -->
<!-- nemoclaw-docs-review:end -->
<!-- nemoclaw-targeted-validation:start -->
- Targeted validation: Focused E2E-support tests passed: 2 files and 50
tests. CLI and plugin type checks, repository checks, source-shape
checks, and npm run validate:pr passed.
<!-- nemoclaw-targeted-validation:end -->
<!-- nemoclaw-broad-gate:start -->
- Broad gate: passed — npm run validate:pr passed on commit
5897d16.
<!-- nemoclaw-broad-gate:end -->

Fresh GitHub CI, security scanning, managed-image prerequisites,
automated reviews, and trusted `external-gateway-health` E2E are
required on the current PR revision before merge.
Earlier run evidence is superseded.

## Review notes

This is the credential-free public-health slice of #9872, not issue
closure.
Workspace identity, authenticated inventory and readiness, machine
authentication, and every mutation remain out of scope.

This PR does not implement or qualify Kubernetes support or support
other OpenShell releases.
Closed PR #10310 is not a dependency.
This PR supplies its own concrete official SDK production consumer.

The `nemoclaw/lifecycle` API merged independently through #10703 and
requires a caller-injected observer.
It does not import, re-export, or qualify this PR's SDK transport, and
this PR does not adopt its lifecycle behavior.

A separate accepted change can separate gateway-release compatibility
policy from the health adapter.
Each gateway and SDK combination requires accepted scope, pinned
dependency versions, dependency review, deterministic tests, and
qualification evidence.
Unknown releases must continue to fail closed.

The package contract uses NemoClaw's `NEMOCLAW_INSTALLING=1` guard only
for the local consumer-link step.
It proves the guarded installed-command boundary, not an ordinary
unguarded package lifecycle.
The locked dependency graph and packed runtime remain covered
independently.

The SDK uses platform DNS and exposes no transport close handle.
This adapter remains limited to trusted infrastructure and a one-shot
Blueprint Runner process.
Blueprint Runner image publication remains blocked on a software bill of
materials, license inventory, provenance evidence, and runtime identity
tied to the distributed build.

A broad local E2E-support run was intentionally excluded from evidence
after concurrent child-process tests exhausted their five-second local
budgets.
The candidate-owned suites were rerun serially and passed; fresh Ubuntu
CI owns the broad current-PR result.

---
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>

---------

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Carlos Villela <cvillela@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant