Skip to content

feat(tier3): let installed packages add custom execution backends - #215

Merged
rng1995 merged 6 commits into
mainfrom
feat/rmalani-nv/issue-214-env-mode-plugins
Oct 21, 2026
Merged

rng1995 merged 6 commits into
mainfrom
feat/rmalani-nv/issue-214-env-mode-plugins

Conversation

@rmalani-nv

@rmalani-nv rmalani-nv commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #214.

Summary

Installed packages can now add an --env-mode that runs Tier 3 on infrastructure Harbor does not ship: a custom execution backend. Teams can use an internal sandbox service without forking SkillEvaluator or giving up its policy checks.

[project.entry-points."skillevaluator.env_modes"]
acme = "skillevaluator_acme.backend:SPEC"

SPEC is an EnvironmentBackendSpec. It names a Harbor BaseEnvironment class and declares:

  • the backend's accepted, required, and reserved --ek kwargs;
  • host variables to forward, and which of them (and which kwargs) are file paths;
  • optional agent wrappers;
  • Compose support;
  • a prerequisite hook;
  • an install hint.

SkillEvaluator passes the class to harbor run --env <import path>. Harbor 0.24 supports this, and SkillEvaluator already uses it for local, docker, and gke.

Custom execution backends follow the same policy as Harbor-native backends:

  • Runtime-policy, backend-reserved, and secret-bearing kwargs are rejected.
  • Only declared upper-case host variables reach the Harbor process, and a skill's harbor.runtime_env cannot set them.
  • A backend cannot forward agent, provider, or other backends' credentials, judge settings, or process-control variables. KUBECONFIG is allowed.
  • Relative paths in declared path variables and kwargs are made absolute before Harbor changes directory.
  • doctor checks required kwargs, then runs the backend's prerequisites hook, then the class's Harbor preflight(). Load, factory, and preflight failures are redacted.
  • A backend's agent wrapper must subclass any wrapper the evaluator provider requires (for example SkillEvaluatorGatewayCodex); otherwise the run stops before trials start.
  • Tasks with docker-compose.yaml are rejected unless the backend sets supports_docker_compose=True.
  • Built-in mode names cannot be replaced, and a name registered by more than one installed package is refused. Listing modes reads metadata only, and a backend is imported only when selected. SKILLEVALUATOR_DISABLE_CUSTOM_BACKENDS=1 ignores all of them.
  • Published benchmark cards show a custom backend as Isolated sandbox.

With no custom backends installed, the CLI surface and every built-in mode behave exactly as before. The golden CLI surface test is unchanged.

Changes

  • tier3_environments.py: EnvironmentBackendSpec, discovery, and loading. Stdlib only, so --help still imports nothing from Harbor.
  • tier3/harbor/runner.py: custom backend handling at each env-mode branch.
  • cli.py: custom backends appear in the --env-mode choices.
  • Docs: a "Custom execution backends" section in docs/agents-and-sandboxes.mdx that covers what a backend must provide (pinned Harbor, staged image, workspace, verifier artifacts, cleanup) and the baseline/with-skill acceptance run. Also a pointer in docs/cli-reference.mdx and a CHANGELOG entry.

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests:
    • tests/test_custom_execution_backends.py (59): registry, policy, redaction, wrapper resolution, duplicate claims, and path anchoring.
    • tests/test_custom_backend_package.py (3): builds and installs a separate backend wheel, then checks discovery, doctor, and Harbor's import-path dispatch from fresh processes.
  • Updated documentation for user-visible changes
  • Ran make lint
  • Ran make test: 13,752 passed, 27 skipped, 2 failed. The 2 failures (test_harbor_secure_docker_environment.py::test_sidecar_retains_*structurally_required_nonsecret*) fail the same way on unchanged main on my macOS machine.
  • Ran make build
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

🤖 Generated with Claude Code

Add a `skillevaluator.env_modes` entry-point group. Each entry names an
EnvModePlugin that points at a Harbor BaseEnvironment class and declares
the --ek kwargs, required kwargs, reserved kwargs, host variables,
prerequisite hook, agent wrappers, and Compose support for that mode.

Plugin modes reuse the existing Harbor-native policy: runtime-policy and
secret-bearing kwargs are rejected, only declared host variables reach
the Harbor process, skill runtime_env cannot set them, and a plugin may
not forward agent credentials, judge settings, or process-control
variables. Plugins cannot shadow built-in modes, are imported only when
selected, and can be disabled with SKILLEVALUATOR_DISABLE_ENV_MODE_PLUGINS=1.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Roshni Malani <[email protected]>
@rmalani-nv
rmalani-nv force-pushed the feat/rmalani-nv/issue-214-env-mode-plugins branch from 1d09960 to 31c258e Compare October 19, 2026 19:12

@rng1995 rng1995 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.

Automated review: 6 findings (0 P1, 3 P2, 3 P3); 6 posted inline.

…ries

Address review findings on the plugin hook:

- Refuse plugin host variables that Harbor's stock agents or other
  backends read as credentials: agent CLI prefixes (ANTHROPIC_, CLAUDE_,
  CODEX_, OPENAI_, OPENCODE_, GEMINI_), git and model hub tokens (GH_,
  GITHUB_, GITLAB_, HF_, HUGGING_FACE_), provider and operator secrets,
  and other built-in backends' secret variables. KUBECONFIG stays allowed.
- Require upper-case host variable names so skill runtime_env cannot
  bypass the protection with a different case.
- Keep published benchmark cards keyed on built-in modes; plugin modes
  render as "Isolated sandbox" with no derived isolation note.
- Import the plugin's environment module before preflight and unwrap
  Harbor's ValueError around import failures so install_hint is shown.
- Refuse a mode name registered by more than one package and name the
  conflicting distributions.
- Add host_path_env_vars and host_path_environment_kwargs so relative
  paths are anchored before Harbor changes directory.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Roshni Malani <[email protected]>
@rmalani-nv

Copy link
Copy Markdown
Collaborator Author

@rng1995 Thanks for the review. Comments addressed, PTAL ?

@chrisknvidia

Copy link
Copy Markdown
Collaborator

@rmalani-nv : could we use “custom execution backends” instead of “plugin modes” consistently across the PR title, documentation, user-facing messages, and new public API? “Plugin” already refers to agent plugins being evaluated, so reusing it for execution infrastructure could be confusing.
For example, EnvironmentBackendSpec would describe the registration descriptor more clearly than EnvModePlugin. The existing --env-mode flag and skillevaluator.env_modes entry-point group still make sense.
Let me know wdyt?

@chrisknvidia

Copy link
Copy Markdown
Collaborator

Could we add a small integration test that installs a separate backend package and exercises discovery, doctor, and Harbor dispatch from a fresh process? This would cover the actual packaging/import path alongside the registry unit tests.

It would also help to document that backend packages must support the pinned Harbor version and preserve the evaluator’s staged image, workspace, and verifier requirements. A full baseline/treatment run—with correct outputs, artifacts, and cleanup—could then be the acceptance test for each backend integration.

@rng1995 rng1995 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.

Re-reviewed head 0377555, including the changes since the earlier review and existing discussions. Two additional reproducible findings are inline; I am also following up in the existing duplicate-registration thread for a remaining edge case. Validation with the repository lock: 385 focused tests passed, 1 deselected; all 17 current CI check runs succeeded. The failure reproductions use synthetic credentials and a backend test double, not a live external backend.

rng1995 and others added 2 commits October 20, 2026 01:21
Address maintainer and review feedback on the env-mode extension point:

- Rename "plugin modes" to custom execution backends across the public
  API, messages, and docs: EnvironmentBackendSpec, EnvironmentBackendError,
  custom_backend_names, load_custom_backend, and
  SKILLEVALUATOR_DISABLE_CUSTOM_BACKENDS. The --env-mode flag and the
  skillevaluator.env_modes entry-point group are unchanged.
- Redact backend load and factory failures with the same secret handling
  as preflight before they reach doctor, kwarg validation, or run errors.
- Resolve a backend's agent wrapper together with the provider's: keep a
  backend wrapper that subclasses the provider wrapper (for example
  SkillEvaluatorGatewayCodex for openai-compatible Codex), and stop with a
  configuration error instead of silently replacing it otherwise.
- Count registrations per distribution, so two packages registering the
  same target are refused as ambiguous while one package seen twice on
  sys.path is one claim.
- Drop allow_workload_identity from --ek only for gke, where it is a
  SkillEvaluator wrapper option, so a backend that accepts it receives it.
- Add a fresh-process integration test that builds and installs a separate
  backend wheel and checks discovery, doctor, and Harbor import-path
  dispatch.
- Document what a backend must provide (pinned Harbor, staged image,
  workspace, verifier artifacts, cleanup) and the baseline/with-skill
  acceptance run.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Roshni Malani <[email protected]>
@rmalani-nv rmalani-nv changed the title feat(tier3): let installed packages register --env-mode plugins feat(tier3): let installed packages add custom execution backends Oct 20, 2026
@rmalani-nv

Copy link
Copy Markdown
Collaborator Author

@chrisknvidia thanks, both done in 07054da.

Naming. Agreed that "plugin" collides with the agent plugins under evaluation. The PR now says "custom execution backends" in the title, description, docs, CHANGELOG, user-facing messages, and public API:

  • EnvironmentBackendSpec (was EnvModePlugin)
  • EnvironmentBackendError
  • custom_backend_names(), load_custom_backend(), clear_custom_backend_cache()
  • SKILLEVALUATOR_DISABLE_CUSTOM_BACKENDS

--env-mode and the skillevaluator.env_modes entry-point group are unchanged. The docs section is now "Custom execution backends", and messages read "Custom execution backend 'acme' ...".

Integration test. tests/test_custom_backend_package.py builds a standards-conforming wheel for a separate skillevaluator-demo-backend package and installs it into its own directory (uv pip install --offline --no-deps --target when uv is available, which it is in CI). Then, from fresh interpreters:

  • discovery: the mode appears in the CLI's --env-mode choices, and the backend module is not imported;
  • doctor: the backend's prerequisite row passes with valid kwargs, reports the hook's error for a bad endpoint, and reports a missing required kwarg;
  • Harbor dispatch: build_harbor_run_command produces the --env and --ek values, and Harbor's own EnvironmentFactory.create_environment_from_config constructs the installed class with those kwargs.

Docs. I added "What a backend must provide":

  • support the pinned harbor==0.24.0;
  • run the evaluator-staged image, not a generic one;
  • preserve the workspace and skills_dir;
  • preserve the verifier contract and return /logs/verifier and /logs/agent;
  • clean up every trial resource.

The acceptance test is a full baseline plus with-skill Tier 3 run on the backend, with expected scores, retained artifacts, no leftover resources, and results compared against --env-mode docker.

I also fixed the inline findings from you and @rng1995 (workload-identity scoping, redaction of load failures, Codex wrapper resolution with gateway providers, duplicate claims with identical targets) and replied on each thread. Full suite: 13,752 passed. The only 2 failures are the Docker sidecar tests that fail the same way on main locally.

@rng1995 rng1995 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.

Re-reviewed at 8bd194d. All inline threads are addressed. I re-ran my original repros against a real dist-info backend package on sys.path (not monkeypatched entry points), and each case now behaves as intended:

  • Credential forwarding: every name from the original finding is refused, and so are AWS_*, GOOGLE_APPLICATION_CREDENTIALS, NVIDIA_API_KEY and GEMINI_API_KEY. KUBECONFIG and the backend's own ACME_SANDBOX_URL still reach Harbor.
  • Host variable case: lower- and mixed-case names are rejected when the spec is built. A skill's runtime_env can't override a declared variable in any casing.
  • Benchmark cards: benchmark.py is no longer changed, and a custom backend renders as Isolated sandbox.
  • install_hint: shown when the backend SDK is missing.
  • Duplicate claims: refused and named, including identical targets from two packages. One package seen twice on sys.path counts once.
  • Relative paths: values in host_path_env_vars and host_path_environment_kwargs are made absolute. Undeclared values are left unchanged.
  • allow_workload_identity (@chrisknvidia's thread): a backend that declares it now receives --ek allow_workload_identity=true, and the filter applies to GKE only. I've left that thread for Chris to resolve.
  • Redaction: a synthetic token in a load or factory failure is redacted in doctor, the kwarg policy error, build_harbor_run_command, and the runtime wrapper path.
  • Codex wrappers: a SkillEvaluatorGatewayCodex subclass is kept for both openai and openai-compatible. A plain Codex subclass is kept for openai and refused for openai-compatible. With no backend entry, the provider's wrapper is used.

The rename to custom execution backends, the installed-wheel integration test, and the "What a backend must provide" docs cover Chris's general comments.

Locally, the new tests plus the related Tier 3 suites: 6,736 passed, 1 failed. The failure is test_harbor_local_mode.py::test_streamed_timeout_callback_matches_result_and_contains_descendants, a timing flake in code this PR doesn't touch; it passes on rerun.

Before merge: the merge with main after the 0.6.0 release put this PR's CHANGELOG entry under ## 0.6.0 - 2026-10-20 / ### Added. This change isn't in 0.6.0, so please move the entry under ## Unreleased in its own ### Added section.

Optional nit: for a duplicate claim, doctor prints "... Uninstall all but one. Reinstall the package that provides custom execution backend 'shared'." The generic reinstall hint contradicts the first sentence.

@rng1995
rng1995 removed the request for review from mosheabr October 21, 2026 13:13
@rng1995
rng1995 merged commit 3728e2f into main Oct 21, 2026
17 checks passed
@rng1995
rng1995 deleted the feat/rmalani-nv/issue-214-env-mode-plugins branch October 21, 2026 13:13
rng1995 added a commit that referenced this pull request Oct 22, 2026
Merge main 3728e2f (#215 custom execution backends, #212 judge-aware
lift, v0.6.0 release).

Conflicts:
- src/skillevaluator/tier3/harbor/runner.py: the unsupported env_mode
  failure keeps the PR's coded INVALID_CONFIGURATION result with main's
  _supported_env_modes() list (built-in plus installed custom backends).
  The runtime-plan failure keeps the PR's coded result, followed by
  main's new try/except around the agent_import_paths selection.
- CHANGELOG.md (auto-merged): git placed the PR's error-code entry in
  the released 0.6.0 section; moved it to Unreleased under ### Added.
  Main's 0.6.0 section is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995 added a commit that referenced this pull request Oct 22, 2026
Main's #215 added a terminal failure to _run_harbor_eval_impl when an
installed custom execution backend's agent wrapper cannot be selected
(its wrapper does not subclass the provider's required wrapper, cannot
be imported for that check, or the backend fails to load). It still
returned the legacy {"error": [...]} shape, so it was the only terminal
failure in the run entry point without execution_status or error_code.

It now returns the PR's coded result with SKILLEVALUATOR-CONFIG-001, the
same code as the runtime-plan rejection raised just before it in the
credential-validation stage. The new test fails on the merge commit
with the legacy shape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995 added a commit that referenced this pull request Oct 22, 2026
Brings in main up to 3728e2f: #212 judge-aware lift, 15adf98 (schema
"unavailable" rejection) and #215 custom execution backends.

Conflicts:
- docs/cli-reference.mdx: kept the branch's experimental hermes agent note
  and main's custom execution backends sentence on --env-mode.
- src/skillevaluator/cli.py: import MAX_TRIAL_RETRIES and
  PLUGIN_LOAD_CHOICES with main's all_env_modes; --env-mode lists
  installed backends.
- src/skillevaluator/tier3_environments.py: kept the branch's plugin-load
  and trial-retry constants and main's custom backend registry.
- src/skillevaluator/tier3/harbor/collector.py: main's strategy-aware
  aggregate matcher keeps the branch's N/A-metric filter; main's
  constituent judge models merge runs before the branch's
  artifact-aware failure and N/A merges.
- src/skillevaluator/tier3/harbor/runner.py: an explicit agent import path
  may be a native plugin wrapper or a custom backend's wrapper; agent
  import paths and the arm base paths are resolved inside main's backend
  error handling before native plugin wrappers are chosen. The arm base
  for a custom backend is the backend's own agent wrapper (else the stock
  agent), as build_harbor_run_command launches it, so a native wrapper
  over an unknown base falls back or refuses.
- src/skillevaluator/evaluation/tier3_report.py: both helper sets kept.
  Lift data uses main's type check and the branch's activation-aware
  intervals; dimensions take main's judge_lift and the branch's baseline
  N/A flag; evaluators keep lift None without a comparison (main's
  judge exclusion included). When judge-mixed cases exist, the
  effectiveness headline (or the legacy members comparison) and its basis
  come from the matching-judge comparison (#212), the case-weighted
  interval that pairs those cases is dropped, partial and never-activated
  comparisons still get no lift, and the lift note says when no matching-
  judge comparison remains. Main's _dimension_score calls use the
  branch's weighted_dimension_score.
- src/skillevaluator/reporting/cli.py: the branch's None-safe evaluator
  table renders a missing score, baseline or lift as main's "n/a".
- tests/reporting/test_reporters.py: both test sets kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
@rng1995 rng1995 mentioned this pull request Oct 30, 2026
15 of 20 tasks
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
* feat(tier3): let installed packages register --env-mode plugins
* fix(tier3): tighten env-mode plugin credential and publication boundaries
* feat(tier3): name them custom execution backends and close review gaps

Signed-off-by: Roshni Malani <[email protected]>
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
Merge main 3728e2f (#215 custom execution backends, #212 judge-aware
lift, v0.6.0 release).

Conflicts:
- src/skillevaluator/tier3/harbor/runner.py: the unsupported env_mode
  failure keeps the PR's coded INVALID_CONFIGURATION result with main's
  _supported_env_modes() list (built-in plus installed custom backends).
  The runtime-plan failure keeps the PR's coded result, followed by
  main's new try/except around the agent_import_paths selection.
- CHANGELOG.md (auto-merged): git placed the PR's error-code entry in
  the released 0.6.0 section; moved it to Unreleased under ### Added.
  Main's 0.6.0 section is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
Main's #215 added a terminal failure to _run_harbor_eval_impl when an
installed custom execution backend's agent wrapper cannot be selected
(its wrapper does not subclass the provider's required wrapper, cannot
be imported for that check, or the backend fails to load). It still
returned the legacy {"error": [...]} shape, so it was the only terminal
failure in the run entry point without execution_status or error_code.

It now returns the PR's coded result with SKILLEVALUATOR-CONFIG-001, the
same code as the runtime-plan rejection raised just before it in the
credential-validation stage. The new test fails on the merge commit
with the legacy shape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
Brings in main up to 3728e2f: #212 judge-aware lift, 15adf98 (schema
"unavailable" rejection) and #215 custom execution backends.

Conflicts:
- docs/cli-reference.mdx: kept the branch's experimental hermes agent note
  and main's custom execution backends sentence on --env-mode.
- src/skillevaluator/cli.py: import MAX_TRIAL_RETRIES and
  PLUGIN_LOAD_CHOICES with main's all_env_modes; --env-mode lists
  installed backends.
- src/skillevaluator/tier3_environments.py: kept the branch's plugin-load
  and trial-retry constants and main's custom backend registry.
- src/skillevaluator/tier3/harbor/collector.py: main's strategy-aware
  aggregate matcher keeps the branch's N/A-metric filter; main's
  constituent judge models merge runs before the branch's
  artifact-aware failure and N/A merges.
- src/skillevaluator/tier3/harbor/runner.py: an explicit agent import path
  may be a native plugin wrapper or a custom backend's wrapper; agent
  import paths and the arm base paths are resolved inside main's backend
  error handling before native plugin wrappers are chosen. The arm base
  for a custom backend is the backend's own agent wrapper (else the stock
  agent), as build_harbor_run_command launches it, so a native wrapper
  over an unknown base falls back or refuses.
- src/skillevaluator/evaluation/tier3_report.py: both helper sets kept.
  Lift data uses main's type check and the branch's activation-aware
  intervals; dimensions take main's judge_lift and the branch's baseline
  N/A flag; evaluators keep lift None without a comparison (main's
  judge exclusion included). When judge-mixed cases exist, the
  effectiveness headline (or the legacy members comparison) and its basis
  come from the matching-judge comparison (#212), the case-weighted
  interval that pairs those cases is dropped, partial and never-activated
  comparisons still get no lift, and the lift note says when no matching-
  judge comparison remains. Main's _dimension_score calls use the
  branch's weighted_dimension_score.
- src/skillevaluator/reporting/cli.py: the branch's None-safe evaluator
  table renders a missing score, baseline or lift as main's "n/a".
- tests/reporting/test_reporters.py: both test sets kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
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.

[FEA]: Let installed packages add custom execution backends (--env-mode)

3 participants