Skip to content

renaming and light refactoring to better support adding other harnesses#1815

Open
peterj wants to merge 1 commit intomainfrom
peterj/agentharnessrenames
Open

renaming and light refactoring to better support adding other harnesses#1815
peterj wants to merge 1 commit intomainfrom
peterj/agentharnessrenames

Conversation

@peterj
Copy link
Copy Markdown
Collaborator

@peterj peterj commented May 8, 2026

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:

  1. Add a new AgentHarnessBackendType value (e.g. hermes) in go/api/v1alpha2
  2. Implement sandboxbackend.AsyncBackend
  • e.g. add a hermes.go (for example) that embeds *agentHarnessOpenShellBackend (same as ClawBackend in openclaw.go.
  1. Call newAgentHarnessOpenShellBackend(...) with a name, function that creates the sandbox (look at the buildAgentHarnessOpenshellCreateRequest for an example), implement preCreateSandbox where you translate the model config to something that hermes understands and OnAgentHarnessReady to run any configuration needed, so agent can run
  2. Register the backend
    In buildOpenshellSandboxBackends in go/core/pkg/app/app.go, add an entry for the new backend

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Copilot AI review requested due to automatic review settings May 8, 2026 00:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 grpcBackend with AgentHarnessOpenShellClient + agentHarnessOpenShellBackend and added a PreCreateSandboxFunc hook for backend-specific pre-create work.
  • Extracted OpenClaw/NemoClaw policy building into openshell/openclaw and moved allowed-domain host normalization into sandboxbackend.NormalizeAllowedDomainHost.
  • Renamed/rewired constructors and backend registration (NewOpenShellBackend, shared OpenClaw backend instance registered for both openclaw and nemoclaw).

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()
@peterj peterj requested a review from EItanya May 8, 2026 14:57
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.

2 participants