renaming and light refactoring to better support adding other harnesses#1815
Open
renaming and light refactoring to better support adding other harnesses#1815
Conversation
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the OpenShell sandboxbackend implementation to better support multiple AgentHarness “harness” backends by splitting shared gRPC lifecycle logic into reusable components, extracting OpenClaw policy logic into a subpackage, and cleaning up naming to reflect AgentHarness semantics.
Changes:
- Replaced the monolithic
grpcBackendwithAgentHarnessOpenShellClient+agentHarnessOpenShellBackendand added aPreCreateSandboxFunchook for backend-specific pre-create work. - Extracted OpenClaw/NemoClaw policy building into
openshell/openclawand moved allowed-domain host normalization intosandboxbackend.NormalizeAllowedDomainHost. - Renamed/rewired constructors and backend registration (
NewOpenShellBackend, shared OpenClaw backend instance registered for bothopenclawandnemoclaw).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| go/core/pkg/sandboxbackend/openshell/translate.go | Renames request builder and gateway-name helper; switches to new policy builder. |
| go/core/pkg/sandboxbackend/openshell/translate_test.go | Updates tests to new builder name and to use openclaw exported constants. |
| go/core/pkg/sandboxbackend/openshell/policy.go | Refactors policy composition into mergeable fragments; uses shared allowed-domain host normalizer and extracted OpenClaw helpers. |
| go/core/pkg/sandboxbackend/openshell/openshell.go | Introduces reusable backend wrapper + pre-create hook; renames OpenShellBackend constructor. |
| go/core/pkg/sandboxbackend/openshell/openshell_test.go | Updates tests for renamed constructors and new exported exec helpers. |
| go/core/pkg/sandboxbackend/openshell/openclaw/policy.go | New package containing OpenClaw/NemoClaw baseline + channel policy logic and exported constants. |
| go/core/pkg/sandboxbackend/openshell/openclaw.go | Refactors OpenClaw backend to use the shared backend wrapper and adds translateModelConfig as pre-create hook. |
| go/core/pkg/sandboxbackend/openshell/grpc_backend.go | Removes the old shared gRPC backend implementation. |
| go/core/pkg/sandboxbackend/openshell/client.go | Clarifies the responsibility boundary of OpenShellClients vs higher-level clients. |
| go/core/pkg/sandboxbackend/openshell/agentharness_openshell_client.go | New higher-level OpenShell client wrapper for AgentHarness lifecycle and exec helpers. |
| go/core/pkg/sandboxbackend/network_host.go | New shared helper for normalizing allowed domain hosts. |
| go/core/pkg/sandboxbackend/network_host_test.go | Moves normalization tests into the sandboxbackend package. |
| go/core/pkg/app/app.go | Updates backend wiring; registers the same OpenClaw backend instance for both openclaw and nemoclaw. |
| go/core/internal/controller/agentharness_controller.go | Records status.backendRef.backend from spec.backend (needed for the openclaw/nemoclaw shared backend instance). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+76
to
+77
| ctx, cancel := b.CallCtx(ctx) | ||
| defer cancel() |
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.
No new features, mostly renames and moving code around a bit, so it's easier to implement new harnesses (e.g. hermes).
To implement a new backend:
AgentHarnessBackendTypevalue (e.g. hermes) ingo/api/v1alpha2hermes.go(for example) that embeds*agentHarnessOpenShellBackend(same asClawBackendinopenclaw.go.newAgentHarnessOpenShellBackend(...)with a name, function that creates the sandbox (look at thebuildAgentHarnessOpenshellCreateRequestfor an example), implementpreCreateSandboxwhere you translate the model config to something that hermes understands andOnAgentHarnessReadyto run any configuration needed, so agent can runIn
buildOpenshellSandboxBackendsingo/core/pkg/app/app.go, add an entry for the new backend