Skip to content

feat(openshell): route session reads over authenticated gRPC - #6793

Merged
cv merged 16 commits into
feat/openshell-grpc-client/aefrom
feat/openshell-grpc-gateway-auth/ae
Jul 19, 2026
Merged

feat(openshell): route session reads over authenticated gRPC#6793
cv merged 16 commits into
feat/openshell-grpc-client/aefrom
feat/openshell-grpc-gateway-auth/ae

Conversation

@ericksoa

@ericksoa ericksoa commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Routes OpenClaw session-list reads through an authenticated direct gRPC client for the sandbox's named OpenShell gateway. The compatibility path retries through supported OpenShell CLI execution only when configuration or sandbox lookup fails before dispatch, so completed commands are never replayed.

This is PR 4 of 26 in the OpenShell gRPC migration stack.

Changes

  • Resolve a named gateway's endpoint and auth mode from OpenShell user or system metadata, while loading mTLS and OIDC credentials only from the user's gateway directory.
  • Construct authenticated direct-gRPC clients for plaintext loopback, mTLS, and OIDC gateways, and fail closed for edge-tunneled or unknown auth modes.
  • Route OpenClaw session listing through direct gRPC with a bounded deadline; retry through the CLI only for read-only configuration or sandbox-lookup failures that occur before command dispatch.
  • Distinguish pre-dispatch lookup failures from completed nonzero commands and post-dispatch stream failures so the fallback cannot replay a command with an unknown outcome.
  • Cover credential resolution and routing in grpc-gateway-config.test.ts, grpc-sandbox-control.test.ts, sandbox-control-routing.test.ts, and passthrough.test.ts; a direct unconditional switch is insufficient because named gateways can require different auth material and staged compatibility is safe only before dispatch.

Stack

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:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: the command-reference update is isolated in the immediate stacked docs-only follow-up docs(openshell): document direct session transport #6794; this implementation slice updates its inline CLI help together with the behavior.
  • 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: transport-boundary review completed; only configuration and lookup failures before a read-only dispatch are eligible for CLI retry, while completed commands and post-dispatch failures are never replayed.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — the four focused gateway-config, gRPC-control, routing, and session-passthrough test files passed (60 tests); npm run typecheck:cli passed
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — targeted and changed-graph validation were used; required CI supplies the broad repository gates
  • 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: Aaron Erickson aerickson@nvidia.com

ericksoa added 2 commits July 13, 2026 15:43
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 449faa56-5875-433e-ae1f-1c57480469e4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/openshell-grpc-gateway-auth/ae

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

@github-code-quality

github-code-quality Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the feat/openshell-grpc-... branch.

TypeScript / code-coverage/cli

The overall coverage in the feat/openshell-grpc-... branch is 79%. The coverage in the feat/openshell-grpc-... branch is 80%.

Show a code coverage summary of the most impacted files.
File feat/openshell-grpc-... 3c4ea5a feat/openshell-grpc-... c0ea436 +/-
src/lib/inference/local.ts 82% 71% -11%
src/lib/shields/index.ts 72% 62% -10%
src/lib/inference/vllm.ts 87% 77% -10%
src/lib/sandbox/config.ts 73% 66% -7%
src/lib/state/o...oard-session.ts 90% 85% -5%
src/lib/policy/index.ts 58% 65% +7%
src/lib/actions...ateway-state.ts 65% 75% +10%
src/lib/tunnel/services.ts 73% 85% +12%
src/lib/adapter...teway-config.ts 0% 90% +90%
src/lib/adapter...dbox-control.ts 0% 98% +98%

Updated July 19, 2026 17:51 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 suggestions
Status: Canonical ledger: 0 blocker(s), 1 warning(s), 0 suggestion(s).

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 1 warning · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported the same number of blockers, 1 fewer warning, the same number of suggestions.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: onboard-repair, onboard-resume

2 optional E2E recommendations
  • sessions-agents-cli
  • openshell-gateway-auth-contract
1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-1 Warning — Document the compatibility fallback's source boundary and removal condition

  • Location: src/lib/adapters/openshell/sandbox-control-routing.ts:31
  • Category: architecture
  • Problem: The new CLI compatibility retry documents which pre-dispatch failures it handles, but does not state why gateway configuration/lookup failures cannot be repaired at their source in this change or what condition will allow the fallback to be removed.
  • Impact: Without an explicit source boundary and exit condition, this workaround can become a permanent alternate transport path and obscure whether direct gateway configuration support has converged.
  • Recommendation: Add a concise source-of-truth note identifying the unsupported/pre-dispatch state, why it remains necessary here, and the concrete upstream capability or migration condition that permits removing the CLI retry.
  • Verification: Read the routing docblock at sandbox-control-routing.ts:31-35 and the resolver's unsupported-auth branches in grpc-gateway-config.ts to confirm the fallback's stated scope and removal trigger.
  • Test coverage: Existing sandbox-control-routing.test.ts covers fallback behavior; add or retain a contract-level assertion/documented test case tying fallback to the explicitly named unsupported configuration boundary when that boundary is changed.
  • Evidence: sandbox-control-routing.ts:31-35 defines a CLI retry for direct-client configuration and pre-dispatch lookup failure. sandbox-control-routing.test.ts tests configuration failure and explicit pre-dispatch retry branches. The routing documentation does not identify a source-side limitation or a removal condition.

Workflow run details

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

ericksoa added 9 commits July 13, 2026 16:00
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>

# Conflicts:
#	src/lib/adapters/openshell/grpc-sandbox-control.test.ts
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Base automatically changed from feat/openshell-grpc-client/ae to chore/openshell-grpc-protocol/ae July 14, 2026 04:42
@ericksoa ericksoa changed the title feat(openshell): resolve gRPC gateway credentials feat(openshell): route session reads over authenticated gRPC Jul 14, 2026
@ericksoa
ericksoa changed the base branch from chore/openshell-grpc-protocol/ae to feat/openshell-grpc-client/ae July 14, 2026 04:50
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Base automatically changed from feat/openshell-grpc-client/ae to chore/openshell-grpc-protocol/ae July 14, 2026 04:56
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@ericksoa
ericksoa changed the base branch from chore/openshell-grpc-protocol/ae to feat/openshell-grpc-client/ae July 14, 2026 05:07
@wscurran wscurran added feature PR adds or expands user-visible functionality integration: openclaw OpenClaw integration behavior labels Jul 14, 2026
apurvvkumaria pushed a commit that referenced this pull request Jul 17, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Make the maintainer merge gate evaluate only current, complete GitHub
Actions evidence for the exact PR diff. Before this change, stale retry
jobs and later all-skipped body-edit runs could block an otherwise-green
PR; after it, the gate selects the latest complete attempt while failing
closed when GitHub evidence is incomplete.

## Changes

- Group duplicate check runs by authoritative workflow identity; require
exact-diff evidence for required checks and exact-head evidence for
supported non-PR Actions events.
- Resolve rerun attempts through every page of the GitHub Actions jobs
API, then recheck the run attempt to reject races without hiding
matrix-job failures.
- Require every latest-attempt job for the check name to appear in the
PR rollup and bind every required name to parseable Actions evidence.
- Reject legacy status contexts that reuse a required check name without
exact-diff Actions provenance.
- Ignore all-skipped workflow runs only when GitHub metadata proves a
complete skipped run and another meaningful run for the same PR diff and
workflow.
- Normalize GitHub Actions statuses and conclusions against their
documented value sets so unknown metadata cannot count as meaningful
evidence.
- Bind Actions evidence to the immutable run `head_sha` as well as PR
association metadata so live PR fields cannot make a stale run look
current.
- Bind substantive `pr.yaml` evidence to its canonical immutable
PR/head/base title, require `checks` and `changes` from the same `gate
true` run, and fail closed on malformed metadata-only `gate false`
shapes.
- Reject `check-hash` evidence created at or before the latest paginated
`base_ref_changed` event, preventing a retargeted PR from inheriting a
base-trusted result from its prior base.
- Compare the PR base snapshot with the live base branch tip so
review-blocked PRs cannot mask stale exact-diff evidence.
- Require exactly one successful head/base-bound E2E coordination check
from the GitHub Actions app, including the legacy check-name migration
path.
- Require required merge-gate checks to conclude `SUCCESS`; optional
checks may still conclude `NEUTRAL` or `SKIPPED`.
- Rerun trusted installer-hash verification after PR base retargets so
required evidence cannot be inherited from the prior base.
- Keep the Dependabot DCO exemption identity-bound while producing a
successful required job and preserving mandatory commit verification.
- Recognize only the exact all-skipped `pr.yaml` metadata-edit job
shape, preserving earlier substantive matrix evidence while rejecting
malformed lookalikes.
- Keep malformed URLs, invalid timestamps, stale heads, mixed workflow
identities, incomplete conclusions, and ambiguous evidence fail-closed.
- Add regression coverage for stale attempts, pagination, rerun races,
missing jobs, skipped body-edit runs, malformed identities and
timestamps, singleton and tied runs, matrix jobs, status contexts, and
custom checks.

## Type of Change

- [x] 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

- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: This changes an internal
maintainer skill and does not alter NemoClaw user-facing behavior.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: Three independent
read-only security/correctness reviews found no blocker; the full
133-test affected suite and repository hooks passed.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npx vitest run
test/skills/check-gates-compliance.test.ts
test/skills/check-gates-evidence.test.ts` (133 passed); live checker
passes #7024 and rejects #6793 only for its stale pre-retarget
`check-hash` evidence
- [x] Applicable broad gate passed — `npm run check:diff`
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>


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

* **New Features**
* Tightened maintainer merge-gate CI evaluation to use exact-diff
evidence and added final-revision re-verification for conflicts if PR
revision/merge state changes.
* Extended contributor compliance to support Dependabot-style DCO-body
bypass and surfaced bypass status in gate output.
* **Bug Fixes**
* Improved CI gate check deduplication by selecting the latest attempt
per check context and failing closed when evidence is incomplete.
* Updated conflicts gate logic to consider both mergeability and merge
state (including clearer “behind” handling).
* **Tests**
* Refactored and expanded check-gates compliance/evidence coverage using
shared fixtures, including exact-diff coordination, pagination, and
malformed evidence cases.
* **Documentation**
* Updated merge-gate workflow guidance to reflect the stricter
exact-diff and merge-readiness rules.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Co-authored-by: Charan Jagwani <cjagwani@nvidia.com>
@apurvvkumaria apurvvkumaria self-assigned this Jul 19, 2026

@apurvvkumaria apurvvkumaria left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking correctness/security findings on exact head 8fd2064:

  1. execSandboxReadOnlyWithGrpcFallback wraps both client construction and await grpc.exec(...) in the same broad catch. A rejected execution promise is therefore labeled a configuration failure and replayed through the CLI, even though the outcome may be post-dispatch. This contradicts the PR's no-replay contract. Only an explicit OpenShellGrpcPreDispatchError should be eligible for fallback; an untyped rejection must be returned as the execution failure, with coverage for both rejected post-dispatch and rejected typed pre-dispatch cases.

  2. The fallback control is a process-global, unscoped CLI client. When the sandbox is bound to a named gateway but a different gateway is active, a configuration/lookup fallback can execute against the active gateway instead of gatewayName—and a same-named sandbox can return another gateway's session data. Construct the CLI fallback for the requested gateway (and reject ambient endpoint overrides that can bypass that binding), and test the exact --gateway <name> invocation.

  3. When the local registry row is absent, resolveSandboxGatewayName(undefined) silently chooses the default gateway even though ensureLiveSandboxOrExit may just have validated the sandbox on another active gateway. Preserve the legacy active-gateway CLI capture path for unregistered sandboxes, or fail before direct dispatch; do not direct gRPC to a guessed gateway.

I can address these with a narrow append-only maintainer commit while preserving the original author's credit.

Co-authored-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>

@apurvvkumaria apurvvkumaria left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on exact head 55e7d3f: post-dispatch rejections fail closed without CLI replay; typed pre-dispatch failures use a gateway-scoped fallback that rejects endpoint overrides; unregistered sandboxes preserve the active-gateway compatibility path. Focused tests, CLI type-checking, structural guards, formatting, commit hooks, DCO, and GitHub signature verification passed. CI and advisors are now running on this head.

@cv
cv merged commit 0d2a9ac into feat/openshell-grpc-client/ae Jul 19, 2026
51 checks passed
@cv
cv deleted the feat/openshell-grpc-gateway-auth/ae branch July 19, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PR adds or expands user-visible functionality integration: openclaw OpenClaw integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants