Repository navigation
Conversation
Signed-off-by: Nathaniel Watson <nwatson@nvidia.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 2
Please check the settings in the CodeRabbit UI or the
|
Signed-off-by: Nathaniel Watson <nwatson@nvidia.com>
Signed-off-by: Nathaniel Watson <nwatson@nvidia.com>
Signed-off-by: Nathaniel Watson <nwatson@nvidia.com>
Signed-off-by: Nathaniel Watson <nwatson@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Let an application keep its existing human-approval workflow while using the generic Nomos Relay worker to dispatch the approved operation through the remaining middleware.
Draft, stacked on #154 (
feat/relay-native-tool-correlation). The enabled feature depends on the unreleased execution-context transport in NeMo Relay PR #1749. The SDK, lockfile and manifest now target matching Relay 1.0 source builds; Relay 0.11 installations are incompatible. The Python packages are pinned to public commit101e1e9efrom that PR, and the managed-worker tests use a CLI built from the same revision. Keep this draft until the matching release is available and published-package clean installation is verified. Source-build instructions.Problem and before/after
A host application may pause a tool call for human approval, end the original model attempt, and execute the approved operation later. That replay need not retain a live model-request snapshot. Treating it as a fresh model proposal either refuses it for missing provenance or asks for another Council decision.
This change provides an explicit alternative for operators who trust the host to perform the required human-approval checks:
H2 is the LLM-execution interceptor that captures request provenance; H3 is the tool-execution interceptor that authorizes dispatch. These are integration labels, not new Relay APIs.
Example
The operator opts in for exact guarded tools whose executor is local:
After checking its saved human decision, the application supplies separate Relay execution context:
{ "data": { "host_approval": { "version": 1, "source": "example.application", "approval_id": "approval-example", "tool_name": "write_file", "approved_arguments": { "path": "/workspace/project/note.txt", "content": "hello" } } } }The actual business arguments must match
approved_arguments. This object is not a model-generated tool argument, event metadata or a Council writ.Policy decisions and the existing approval interface
The core policy API is introduced separately in #160. This worker change does not rebase #154 onto that policy work. Approved replay now requires the core policy-only API and enabled, healthy OPA; it cannot silently use an older service that ignores the new inspection flag.
The worker preserves a single review-outcome status. Successful tool execution still uses its existing
executedstatus; this does not turn the core API'sapprovedresponse into a tool result before execution.status: requires_human_approval,execution_status: not_executedstatus: denied,execution_status: not_executedThere is no
forbiddenstatus,human_approval_requiredalias, or publicpolicy_decisionfield. Human-review feedback uses boundedpolicy.reason,policy.guidanceandpolicy.decision_id; the metadata has no second outcome discriminator. A legacydeniedresponse with human-looking fields remains denied.On approved replay, the fresh policy-only response must be
policy_allowedorrequires_human_approval, with no writ or contradictory execution claim. The independently verified host approval is still mandatory.deniedalways stops;approved, unknown/mixed-contract responses and policy errors cannot pass this inspection boundary.A human-review request is not a denial or Council vote and does not increment the denial counter. Unified
deniedresults from the Council service include policy prohibitions and count toward the existing consecutive authorization-denial limit; the worker does not guess their origin from text or vote counts. Signed receipts record the actual service outcome, not fabricated member votes. An unsuccessful policy inspection closes the approval's journal attempt without dispatch; retry requires a fresh host approval ID rather than an automatic retry.Trust and execution contract
authorization_source: host_human_approval, and tool annotations are preserved.>=1.0.0,<1.1and thenvidia.nemo.relay.worker.v1protocol. Ordinary calls still follow Council authorization; host-approved replay remains opt-in. A stale SDK missing execution context fails activation explicitly.Implementation and review entry points
host_approval.py: required standard assertion fields with additional properties preserved/ignored for authorization, bounded JSON and exact argument matching.plugin.py: explicit branch selection, fresh policy inspection, validation, journaling and continuation.policy.py: bounded typed outcomes; no routing by error text.repository.py: retain host approval scopes across ordinary turn cleanup.settings.pyand generated schema: default-off configuration and guarded/local-tool checks.Execution context: Relay envelope, Nomos approval contract
Relay PR #1749 defines a closed
ApplicationExecutionContextenvelope with an optionaldataobject. Relay transports that object's contents without interpreting application-specific approvals. Nomos owns and validatesexecution_context.data.host_approval, using its packaged JSON Schema and operational validator.The five assertion fields remain required; extra assertion properties and other application data are allowed. The obsolete
decisionproperty is rejected. Valid shape alone grants nothing: configured source trust, exact tool/arguments, current policy and replay checks remain mandatory. The host must revalidate the final operation before execution.No context, an omitted
data, or valid application data withouthost_approvalfollows ordinary Council review. A supplied null/malformed approval, malformed envelope, or legacy flatexecution_context.host_approvalis refused without fallback. The entire context remains bounded to 16 KiB and 64 container levels. Existing callers must add thedatawrapper before enabling this feature.Validation
Relay 1.0 migration
relay-plugin.tomldeclares the namespaced worker protocol and Relay>=1.0.0,<1.1. SDK/runtime dependencies anduv.lockpin public Relay commit101e1e9e; no workstation paths are committed.NOMOS_TEST_RELAY_BINrather than installing an executable-less package.make test: 992 passed, 5 expected skips; 93.08% branch-aware coverage, above the unchanged 90% floor. Includes real managed Python workers and source-built Node-host cases.data.host_approval, untrusted/malformed/mismatched assertions, replay protection, downstream middleware and current-policy denial after human approval. Council answers and business callbacks are local fixtures.These are macOS ARM64 / Python 3.12 source-build results. They do not establish compatibility with a published Relay 1.0 release. Earlier failed setup attempts and the initial obsolete-context assertion failure were retained; no timeout or coverage threshold was changed.
Previous envelope/schema checkpoint
For the earlier envelope/schema update:
make test: 986 passed, 10 expected skips; 93.08% branch-aware coverage, above the unchanged 90% floor.make lintpassed, including types, generated documentation and repository checks.The source-matched tests exercise in-process interceptors; they do not establish remote-worker transport, live connector writes, approval UI or multi-replica durability. Those results preceded the Relay 1.0 packaging migration above; published-release validation remains outstanding. Independent review found no actionable issue in the final schema, implementation, packaging or documentation.
Historical checkpoint results
Five-field approval update (
9f41d08): the object itself asserts affirmative human approval; the redundant decision field is removed. All legacy decision properties are rejected, includingapproved,deniedand null. Sixty focused host-approval tests passed. A real source-matched Relay cache regression passed: one approved effect, a schema-valid untrusted-source refusal despite a populated cache, and an obsolete-decision schema refusal before middleware. This uses a synthetic callback and does not claim live connector or remote-worker coverage.The full offline run had 925 passed, 10 skipped and 10 failures; every failure was the published runtime's
worker did not start within 10ssocket/registration deadline. All ten failed cases passed unchanged in isolation: 21 evidence E2E tests, including nine affected cases, plus one installed-worker test. The original full run remains recorded as failed; the underlying startup delay was not established. No timeout or threshold was changed. Staged integration hooks and independent review passed.The updated worker is independently reviewed and remains stacked on #154 at
f53daa18.make testwith published 0.11.1 dependencies: 926 passed, 10 skipped; 93.12% branch-aware coverage (unchanged 90% floor). Includes installed-worker and enclosing-Nomos contract/evidence tests.f1d606de: 1 passed. It runs H3 in process through real Relay execution interceptors and its tool cache, showing a cached result cannot bypass rejection of a later invalid assertion. This is not a remote-worker or approval-UI test.CouncilService, loopback OPA and Relay execution context. It proves policy-required human review, hard denials, policy-allowed replay, a satisfied human-review requirement and a hard prohibition that remains blocked after approval. Middleware is in process; this does not claim remote-worker transport or UI coverage.make lintpassed, including formatting, mypy, schema/manifest/lock consistency, generated docs, Markdown links and private-key detection. Independent correctness and security/publication reviews found no blocking issue.The standard suite skips two live-service checks, two source-runtime modules (run separately), one slow worker test, one Linux
/proccase, and four Node-specific installed-worker cases. Unit tests explicitly simulate the new SDK callback field; they do not claim the pinned 0.11.1 SDK can transport it. No live model, host approval UI, external side effects or replicated-service durability were tested. The combined tier uses the real core service and OPA, with synthetic business callbacks.Related work
Host runtime facts (separate from human approval)
This draft also accepts optional
execution_context.data.runtime_contextfor configured exact tools. For example, a model can target/workspace/project/outputwhile the host resolves execution to/srv/workspaces/project. Without that mapping, reviewers cannot establish that the paths correspond.The worker explicitly trusts a configured source and exact guarded local tools, verifies the native call ID and exact canonical argument snapshot, then forwards only
{version, source, runtime}. The core support is #178, stacked on #160; it independently checks the authenticated issuer, source and tool. Enable both trust gates for a coordinated rollout. Defaults trust no issuer.Runtime facts never select the human-approved path, rewrite executable arguments or alter the signed operation digest. OPA denial and required human approval still apply. The full context, including argument snapshots and optional separate
host_approval, must fit Relay's 16 KiB budget. Input facts are live-only; reviewer reasoning may still persist quoted paths.See runtime-context contract and examples. Independent cross-stack review, focused trust/binding tests and a real managed-worker transport test passed; the transport test uses fixture Council responses and makes no live model-quality claim.
Runtime-context validation completed: 1,028 tests passed, 5 documented opt-in/platform skips, 93.15% branch coverage; worker lint, generated-schema/docs and secret-scan checks passed. A live application → Relay → installed Python worker → Council → local executor test also passed: three members approved the mapped directory creation and the executor returned exit code 0. Council rules and thresholds were unchanged. Genuine delayed human-approved replay with runtime facts remains untested live; the installed-worker fixture covers combined runtime/approval transport and current-policy refusal.