Skip to content

fix(cli): accept tagged trusted gateway identity - #8757

Merged
jyaunches merged 2 commits into
mainfrom
codex/fix-tagged-gateway-readiness
Aug 10, 2026
Merged

fix(cli): accept tagged trusted gateway identity#8757
jyaunches merged 2 commits into
mainfrom
codex/fix-tagged-gateway-readiness

Conversation

@senthilr-nv

@senthilr-nv senthilr-nv commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Linux readiness now recognizes the target-bound OpenShell gateway tag when the kernel-backed executable matches the independently trusted gateway binary. The existing Docker-driver environment, target, and stable process-sampling checks still fail closed.

Related Issue

Fixes #8755

Changes

  • Accept openshell-gateway[nemoclaw=<name>;port=<port>] as process identity only after /proc/<pid>/exe matches the trusted gateway binary and the tag matches the configured target.
  • Let that fully verified target-bound listener establish port ownership when OpenShell does not print endpoint text; explicit endpoint mismatch and incomplete or ambiguous listener evidence still fail closed.
  • Extract the combined process-generation and executable-sample predicate used by the production readiness collector so focused tests can protect both stability requirements.
  • Add regression coverage for the OpenShell v0.0.101 tag and for foreign executables, another gateway target, missing executable evidence, missing Docker-driver environment evidence, macOS direct attribution, executable drift, and process-generation drift.

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: docs/reference/system-readiness.mdx already documents the independently resolved, kernel-backed executable match and stable process-sampling contract.
  • 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: The change retains fail-closed executable, environment, target, platform, and process-generation gates. Focused negative tests cover each changed or adjacent attribution boundary.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: docs/reference/system-readiness.mdx already documents the exact gateway target, independently resolved kernel-backed executable identity, and stable process-sampling contract implemented by this change.
  • Agent: Codex Desktop

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: affected source tests passed 57/57; npm run test:changed passed 72/72; npm run build:cli, npm run typecheck:cli, npm run test:titles:check, and npm run checks:repository passed.
  • 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: Senthil Ravichandran senthilr@nvidia.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved gateway readiness validation by confirming process identity across multiple checks.
    • Added stronger protection against unrelated gateway processes being accepted.
    • Improved handling of process or executable changes and missing verification evidence.
    • Added support for validating gateway listeners on macOS.
    • Improved detection of listeners associated with the intended gateway target when endpoint details are unavailable.

Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
@senthilr-nv senthilr-nv self-assigned this Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The gateway readiness path now validates stable process generations, trusted executable paths, Docker-driver environment evidence, and target-bound listeners. Tagged gateway identities can pass when owned-target and executable checks succeed. Tests cover accepted identities and fail-closed rejection cases.

Changes

Gateway process identity validation

Layer / File(s) Summary
Trusted process evidence contract
src/lib/readiness/gateway-production.ts, src/lib/readiness/gateway-production.test.ts
Adds gatewayProcessSamplesMatchTrustedBinary to require stable process generations and trusted executable samples. Tests cover PID changes, executable changes, and missing samples.
Gateway identity classification
src/lib/readiness/gateway-production.ts, src/lib/readiness/gateway-production.test.ts
Requires independently observed executable paths and accepts recognized owned targets or matching normalized argv0 paths. Tests cover tagged identities, foreign executables, mismatched targets, missing evidence, and macOS listeners.
Target-bound listener classification
src/lib/readiness/gateway-production.ts, src/lib/readiness/gateway-production.test.ts
Records target-bound listener PIDs and passes positive target evidence into port-conflict classification. Tests cover endpoint-text mismatch and unavailable endpoint text.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#8594: Modifies Docker-driver gateway reuse and port-listener ownership classification.
  • NVIDIA/NemoClaw#8682: Updates gateway process identity and readiness validation during sandbox recovery.
  • NVIDIA/NemoClaw#8738: Introduced the gateway readiness process-identity validation refined by this change.

Suggested reviewers: cv, apurvvkumaria, jyaunches

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the coding objectives in [#8755], including tagged identity validation, fail-closed checks, and focused regression tests.
Out of Scope Changes check ✅ Passed The implementation and tests remain within the linked issue scope for gateway identity validation and readiness attribution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: accepting tagged trusted gateway identities during gateway readiness validation.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-tagged-gateway-readiness

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

@github-code-quality

github-code-quality Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit e066143 in the codex/fix-tagged-gat... branch remains at 96%, unchanged from commit 3574032 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit e066143 in the codex/fix-tagged-gat... branch remains at 82%, unchanged from commit 3574032 in the main branch.

Show a code coverage summary of the most impacted files.
File main 3574032 codex/fix-tagged-gat... e066143 +/-
src/lib/onboard...ne-authority.ts 96% 84% -12%
src/lib/inferen...anaged-state.ts 91% 81% -10%
src/lib/onboard...eate-journal.ts 89% 80% -9%
src/lib/cua/run...ime-manifest.ts 91% 84% -7%
src/lib/onboard...mage-runtime.ts 52% 49% -3%
src/lib/policy/index.ts 67% 68% +1%
src/lib/onboard...press-resume.ts 78% 81% +3%
src/lib/inferen...file/cleanup.ts 78% 84% +6%
src/lib/onboard...der/snapshot.ts 75% 83% +8%
src/lib/actions...-add-restart.ts 12% 20% +8%

Updated August 10, 2026 20:22 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/readiness/gateway-production.ts (1)

206-232: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use executable evidence in the onboarding identity path.

processIdentityMatchesGatewayBinary checks only the command line. A foreign Linux process can spoof its command line and Docker-driver environment markers. Listener discovery and stopDockerDriverGatewayProcess can then accept or terminate the wrong PID. Reuse gatewayProcessIdentityMatchesTrustedBinary with /proc/<pid>/exe evidence, or add equivalent executable checks.

🤖 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/readiness/gateway-production.ts` around lines 206 - 232, Update
processIdentityMatchesGatewayBinary and the related listener-discovery and
stopDockerDriverGatewayProcess paths to validate the candidate PID’s actual
executable via /proc/<pid>/exe, reusing
gatewayProcessIdentityMatchesTrustedBinary where applicable. Do not rely solely
on spoofable command-line or Docker-driver environment markers; reject
candidates whose executable evidence does not match the trusted gateway binary
before accepting or terminating the PID.

Source: Path instructions

🤖 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.

Outside diff comments:
In `@src/lib/readiness/gateway-production.ts`:
- Around line 206-232: Update processIdentityMatchesGatewayBinary and the
related listener-discovery and stopDockerDriverGatewayProcess paths to validate
the candidate PID’s actual executable via /proc/<pid>/exe, reusing
gatewayProcessIdentityMatchesTrustedBinary where applicable. Do not rely solely
on spoofable command-line or Docker-driver environment markers; reject
candidates whose executable evidence does not match the trusted gateway binary
before accepting or terminating the PID.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 60ceb11d-4258-4c29-9dcb-4bddca8065d6

📥 Commits

Reviewing files that changed from the base of the PR and between 54364f6 and bfe40e9.

📒 Files selected for processing (2)
  • src/lib/readiness/gateway-production.test.ts
  • src/lib/readiness/gateway-production.ts

@senthilr-nv senthilr-nv added bug-fix PR fixes a bug or regression area: cli Command line interface, flags, terminal UX, or output security v0.0.106 labels Aug 10, 2026
@senthilr-nv
senthilr-nv requested a review from jyaunches August 10, 2026 19:53
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized terminology decisions differ; normalized E2E selections differ; severity counts match.
3 terminology differences from the second opinion

Advisory only. These are normalized differences from the primary terminology receipt.

  • argv0 at src/lib/readiness/gateway-production.ts:228: selected only by the second-opinion lane as established.
  • owned gateway tag at src/lib/readiness/gateway-production.test.ts:155: selected only by the second-opinion lane as justified.
  • process-generation at src/lib/readiness/gateway-production.ts:166: selected only by the second-opinion lane as define.
5 additional E2E selections from the second opinion

Advisory only. The primary lane did not select these E2E jobs or targets.

  • openshell-gateway-upgrade: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • onboard-resume: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • onboard-repair: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • concurrent-gateway-ports: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • openshell-gateway-auth-contract: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests.

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • established — target-bound at src/lib/readiness/gateway-production.test.ts:317: Keep target-bound for listener evidence that proves the canonical gateway name and port.
  • justified — process generation at src/lib/readiness/gateway-production.ts:166: Keep process generation for the sampled process-instance identity requirement.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite against this exact revision.

Recommended E2E: None

2 optional E2E recommendations
  • mcp-bridge
  • ubuntu-repo-cloud-openclaw

Workflow run details

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

Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/readiness/gateway-production.ts (1)

206-232: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Complete the identity-path cutover before merge.

gatewayProcessCmdlineMatches remains executable from the runtime path and its tests. Add public-entrypoint tests for onboarding, host:probe, and rebuild preflight. Remove the superseded path, or document a bounded compatibility window with a linked retirement issue and exit criteria.

🤖 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/readiness/gateway-production.ts` around lines 206 - 232, Complete the
identity-path cutover by removing the superseded gatewayProcessCmdlineMatches
runtime path and updating all callers to use
gatewayProcessIdentityMatchesTrustedBinary. Add public-entrypoint tests covering
onboarding, host:probe, and rebuild preflight, including their trusted/untrusted
outcomes. If compatibility must remain, document its bounded window, linked
retirement issue, and explicit exit criteria.

Source: Path instructions

🧹 Nitpick comments (1)
src/lib/readiness/gateway-production.ts (1)

166-180: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Add one-sided null-generation coverage

gatewayProcessSamplesMatchTrustedBinary already rejects either missing generation. Add tests for null/valid and valid/null; the current test covers only null/null.

🤖 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/readiness/gateway-production.ts` around lines 166 - 180, Add tests
for gatewayProcessSamplesMatchTrustedBinary covering both one-sided
missing-generation cases: null/valid and valid/null, asserting each returns
false. Keep the existing null/null coverage and trusted-binary matching behavior
unchanged.
🤖 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.

Outside diff comments:
In `@src/lib/readiness/gateway-production.ts`:
- Around line 206-232: Complete the identity-path cutover by removing the
superseded gatewayProcessCmdlineMatches runtime path and updating all callers to
use gatewayProcessIdentityMatchesTrustedBinary. Add public-entrypoint tests
covering onboarding, host:probe, and rebuild preflight, including their
trusted/untrusted outcomes. If compatibility must remain, document its bounded
window, linked retirement issue, and explicit exit criteria.

---

Nitpick comments:
In `@src/lib/readiness/gateway-production.ts`:
- Around line 166-180: Add tests for gatewayProcessSamplesMatchTrustedBinary
covering both one-sided missing-generation cases: null/valid and valid/null,
asserting each returns false. Keep the existing null/null coverage and
trusted-binary matching behavior unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c83d0e94-eabb-4806-a09e-ea39dbdf6905

📥 Commits

Reviewing files that changed from the base of the PR and between bfe40e9 and e066143.

📒 Files selected for processing (2)
  • src/lib/readiness/gateway-production.test.ts
  • src/lib/readiness/gateway-production.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/readiness/gateway-production.test.ts

@jyaunches
jyaunches merged commit 63f8847 into main Aug 10, 2026
89 of 90 checks passed
@jyaunches
jyaunches deleted the codex/fix-tagged-gateway-readiness branch August 10, 2026 20:22
jyaunches added a commit that referenced this pull request Aug 10, 2026
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
apurvvkumaria pushed a commit that referenced this pull request Aug 10, 2026
## Summary

OpenShell v0.0.101 reports its active gateway endpoint as `Server:`,
while NemoClaw readiness accepted only `Gateway endpoint:`. This
companion to #8757 accepts both producer labels, requires every
recognized HTTP(S) loopback endpoint to agree with the expected port,
and restores reuse of a healthy managed gateway.

The first trusted PR E2E run also exposed a registered-but-stopped
gateway state: OpenShell returned a connection error without repeating
the gateway name, and public readiness classified the selected gateway
as unknown instead of stale. The revised collector scopes `status` to
the exact gateway and carries that authority into the existing
stale-state classifier.

The escaped regression had two detection gaps: the parser unit fixture
modeled only the older label, and the live double-onboard target did not
explicitly assert the producer label or the reuse outcome.

## Changes

- Parse the exact `Gateway endpoint:` and `Server:` labels, failing
closed on empty, malformed, off-host, off-port, non-HTTP(S), trailing,
or conflicting evidence.
- Scope public readiness status to the selected gateway and preserve
registered connection failures as stale lifecycle state.
- Add deterministic coverage across repeated production readiness probes
sharing the same healthy gateway fixture.
- Strengthen the live `double-onboard` target to prove the first
invocation starts the gateway and the second reuses the same runtime.

## 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 restores the documented
existing-gateway reuse behavior and does not change a command, flag,
configuration, default, output, or supported workflow.
- [x] Sensitive paths changed
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: an independent
nine-category review passed for the production change; endpoint text
remains supplementary to authoritative listener and runtime ownership
evidence, and the stale-state probe is explicitly scoped to the selected
gateway. The later exact-head change only linearizes a test mock for the
repository growth guardrail.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Documentation Writer Review

- [x] Documentation writer subagent reviewed the completed changes
- Result: `no-docs-needed`
- Evidence: The change restores the documented NemoClaw-managed
OpenShell gateway readiness contract for OpenShell v0.0.101. It accepts
`Server:` endpoint output, scopes status probes to the resolved gateway,
and preserves a registered gateway as `stale` after a connection error.
It does not change a NemoClaw command, flag, configuration, default,
output, or supported workflow. `docs/reference/system-readiness.mdx`
already documents canonical gateway ownership, stale reuse state, and
loopback/port endpoint binding. `docs/reference/commands.mdx` already
documents existing-gateway reuse and stale reconciliation.
`docs/changelog/2026-08-10.mdx` already covers v0.0.106 readiness with
OpenShell v0.0.101.
- Agent: Codex Desktop
<!-- docs-review-head-sha: 04228c9 -->
<!-- docs-review-agents-blob-sha: c4923a3 -->

## DGX Station Hardware Evidence

- [ ] Tested on DGX Station
- Tested commit:
- Station profile/scenario:
- Result:
- Supporting evidence:

## 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 validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result:
- `npm exec -- vitest run --project cli
src/lib/readiness/gateway-production.test.ts` — 51/51 passed
- `npm exec -- vitest run --project integration
test/onboard-gateway-port-conflict-fast-fail.test.ts` — 2/2 passed
  - `npm run typecheck:cli` — passed
  - `npm run checks:repository` — passed
- `npm run test:e2e-phases:check` — passed across 125 tests in 81 files
  - repository test-title checks — passed in the normal commit hooks
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: not applicable; focused
validation covers the changed readiness and E2E contracts.
- [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: Julie Yaunches <jyaunches@nvidia.com>


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

## Summary by CodeRabbit

* **Bug Fixes**
* Improved gateway endpoint detection across supported HTTP(S) formats.
* Correctly identifies invalid, malformed, mismatched, or conflicting
endpoints.
* Prevents incorrect gateway status results when endpoint information is
incomplete or unrelated.

* **Reliability**
* Re-onboarding now validates the active gateway endpoint and configured
port.
* NemoClaw reuses a healthy gateway only when its verified listener and
endpoint own the configured gateway port.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Co-authored-by: Senthil Ravichandran <senthilr@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output bug-fix PR fixes a bug or regression security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway readiness rejects tagged OpenShell v0.0.101 process identity

2 participants