Skip to content

feat(execution): add Copilot-native evaluation sandbox - #545

Open
Chris (cwkendall) wants to merge 3 commits into
microsoft:mainfrom
cwkendall:fix/copilot-native-sandbox
Open

feat(execution): add Copilot-native evaluation sandbox#545
Chris (cwkendall) wants to merge 3 commits into
microsoft:mainfrom
cwkendall:fix/copilot-native-sandbox

Conversation

@cwkendall

@cwkendall Chris (cwkendall) commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Adds an opt-in config.sandbox policy for copilot-sdk evaluations so model-visible commands run inside Copilot CLI/MXC's native OS sandbox. Waza remains a thin policy adapter: it declares the task workspace, skills, explicit prerequisites, network/auth posture, and non-interactive approval policy while Copilot owns Seatbelt, bubblewrap, and ProcessContainer enforcement. Omitting the block preserves existing evaluation behaviour.

The design and ownership boundary are documented in docs/design/195-copilot-native-eval-sandbox.md.

Related issue

Closes #544

Agent handoff

  • Scope: Optional Copilot-native task isolation, schema 1.3 configuration, process-environment isolation, grader propagation, tests, example, and public documentation.
  • Key files changed: internal/execution/copilot.go, internal/execution/copilot_client_wrappers.go, internal/execution/sdkclient.go, internal/models/spec.go, schemas/eval.schema.json, and docs/design/195-copilot-native-eval-sandbox.md.
  • Important decisions: Waza does not implement an OS sandbox. A fresh task workspace is read/write; declared skills are read-only/executable; network, caches, Git/GitHub auth, arbitrary host paths, sandbox bypass, and managed-policy requests needing a human are denied by default. Sandboxed clients use a separately keyed, allowlisted process environment, and the executor rejects configuration mismatches. Model-backed prompt graders retain the task sandbox.
  • Follow-ups or known gaps: Remote MCP servers and trusted program graders remain separate boundaries. Copilot's native sandbox does not impose CPU/memory/process quotas; adversarial runs still need an outer resource-limited environment. Local Windows sandboxing currently requires a Windows Insiders build.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor or maintenance
  • CI/CD or release change

Validation

  • go test ./...
  • make lint or golangci-lint run - go vet ./... passes; the pinned golangci-lint binary was unavailable locally, so the required CI lint job remains the authoritative gate.
  • Docs site checked (npm --prefix site run build)
  • Web/dashboard checks run, if web/ changed - not applicable; no dashboard files changed.
  • Manual validation completed:
    • go generate ./internal/execution ./cmd/waza
    • go build -o bin/waza ./cmd/waza
    • git diff --check
    • Copilot CLI 1.0.80 live file canary passed three consecutive runs after reducing model variance to one shell invocation.
    • Concurrent live sessions proved task path policies do not leak.
    • Independent standards and security reviews passed.
  • Not applicable; reason:

Documentation

  • README updated, if user-facing behavior changed
  • site/ docs updated, if CLI, YAML, dashboard, or validator behavior changed
  • Examples updated, if relevant — not needed; existing examples remain unchanged
  • Not applicable

Risk and rollback

  • Risk level: Medium. The feature is opt-in and fail-closed, but it relies on Copilot CLI's public-preview native sandbox across supported operating systems.
  • Rollback plan: Revert this single commit. Existing specs that omit config.sandbox retain their previous behaviour.

Notes for reviewers

Please focus on the ownership boundary in the design document, the native RPC policy mapping in sessionSandboxConfiguration, the process-level environment keying in sdkclient.go, and the live/concurrent isolation tests. The implementation deliberately avoids custom Seatbelt profiles, bubblewrap wrappers, shell parsing, chroot, or container orchestration.

Delegate OS enforcement to Copilot CLI and MXC while Waza supplies least-privilege task workspace, skill, network, credential, and environment policy. Preserve existing execution when sandboxing is omitted.

Closes microsoft#544

Amp-Thread-ID: https://ampcode.com/threads/T-019ffe44-0a2f-7568-a1ff-4a62816cedf2
Co-authored-by: Amp <amp@ampcode.com>

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds schemaVersion 1.3 support to opt Copilot SDK evaluations into Copilot CLI’s native OS sandbox, including path-policy derivation, environment sanitization, and documentation updates.

Changes:

  • Introduces config.sandbox (schema 1.3+) across schema, spec parsing/validation, execution requests, and grader context propagation.
  • Implements sandbox enforcement in the Copilot executor: workspace/skill path policy, bypass/managed-approval rejection, and sanitized CLI process environment handling.
  • Updates docs/examples to schemaVersion 1.3 and adds extensive tests (unit + opt-in live canaries).

Reviewed changes

Copilot reviewed 33 out of 35 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
site/src/content/docs/reference/schema.mdx Bumps schemaVersion references to 1.3 and documents config.sandbox.
site/src/content/docs/reference/schema-changes.md Updates current versions to 1.3 and adds a 1.3 changelog entry.
site/src/content/docs/reference/cli.mdx Updates waza migrate docs to reference schema 1.3.
site/src/content/docs/guides/snapshot-replay.mdx Updates cross-artifact schemaVersion references to 1.3.
site/src/content/docs/guides/eval-yaml.mdx Documents config.sandbox and adds a sandbox guide section.
schemas/eval.schema.json Adds config.sandbox schema + conditional constraint tying sandbox to executor: copilot-sdk.
internal/validation/schema_test.go Adds schema validation test ensuring sandbox requires copilot-sdk.
internal/orchestration/runner_test.go Updates execution request test to include sandbox propagation.
internal/orchestration/runner.go Propagates sandbox into execution requests and grader context.
internal/models/spec_test.go Adds tests for sandbox loading, strict field rejection, and validation rules.
internal/models/spec.go Adds SandboxConfig, strict YAML unmarshalling, and schema/executor validation.
internal/models/schema_version.go Bumps CurrentSchemaVersion to 1.3 with commentary.
internal/graders/prompt_grader_test.go Verifies sandbox is passed through prompt grader execution requests.
internal/graders/prompt_grader.go Propagates sandbox into prompt grader execution requests.
internal/graders/grader.go Adds sandbox field to grader context.
internal/execution/workspace_test.go Adds test that workspace capture rejects symlinks.
internal/execution/sdkclient_test.go Adds tests for env sanitization, auth precedence, and shared-client keying.
internal/execution/sdkclient.go Adds sanitized CLI env handling, proxy filtering, and shared-client key changes.
internal/execution/engine.go Extends execution request with sandbox config.
internal/execution/copilot_test.go Adds sandbox policy/path validation tests and opt-in live canary tests.
internal/execution/copilot_engine_test.go Adds tests for sandbox prerequisites and shutdown cleanup behavior.
internal/execution/copilot_client_wrappers.go Adds session wrapper method to configure Copilot sandbox + permissions.
internal/execution/copilot.go Implements sandbox configuration flow, permission wrapping, workspace handling, and symlink-safe capture.
examples/custom-agent/eval.yaml Updates example to schema 1.3 and enables sandbox with explicit skill dirs.
examples/custom-agent/README.md Documents the example as a runnable sandbox isolation demo.
docs/design/195-copilot-native-eval-sandbox.md Adds design doc for Copilot-native sandboxing approach and contracts.
docs/PRD.md Updates date and adds an epic entry for sandboxing model-visible commands.
docs/INTEGRATION-TESTING.md Documents how to enable and test the native command sandbox.
docs/GUIDE.md Adds user-facing guide section on configuring sandboxed evals.
cmd/waza/cmd_run.go Enables environment sanitization automatically when sandbox is enabled.
cmd/waza/cmd_migrate_test.go Makes migrate tests track models.CurrentSchemaVersion dynamically.
README.md Updates schema 1.3 references and adds Copilot-native sandbox documentation.
AGENTS.md Updates fixture isolation description to account for sandboxed workspace roots.
Files not reviewed (2)
  • cmd/waza/copilot_client_wrapper_mocks_test.go: Generated file
  • internal/execution/copilot_client_wrapper_mocks_test.go: Generated file
Suppressed comments (1)

site/src/content/docs/reference/cli.mdx:1

  • This sentence mixes “current schema version” with the fact that waza migrate only performs changes on future major migrations. To avoid confusion (since “current” varies by artifact type and minor bumps don’t require migration), consider wording like: “The current major schema version is 1 (current minor 1.3), so … no file changes are made.”

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/execution/copilot.go
Comment thread internal/execution/copilot.go Outdated
Comment thread internal/execution/copilot.go
Comment thread internal/models/spec.go
Canonicalize the denied temporary root, inspect bypass requests through typed SDK fields, make workspace capture race-safe without per-file path resolution, and reject unsupported schema majors. Keep the existing custom-agent example unchanged.

Issue: microsoft#544
Amp-Thread-ID: https://ampcode.com/threads/T-019ffe44-0a2f-7568-a1ff-4a62816cedf2
Co-authored-by: Amp <amp@ampcode.com>
Copilot AI review requested due to automatic review settings August 19, 2026 03:30

Copilot AI 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.

Pull request overview

Copilot reviewed 31 out of 33 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • cmd/waza/copilot_client_wrapper_mocks_test.go: Generated file
  • internal/execution/copilot_client_wrapper_mocks_test.go: Generated file
Suppressed comments (2)

schemas/eval.schema.json:128

  • The conditional schema enforces config.executor == "copilot-sdk" only when executor is present, because the then branch does not require the executor property. If executor is optional elsewhere in the schema, {config: {sandbox: ...}} could pass validation without asserting the executor constraint. Consider adding required: ["executor"] inside the then’s config subschema (or otherwise ensuring the conditional both requires and constrains executor when sandbox is present).
  "allOf": [
    {
      "if": {
        "properties": {
          "config": {
            "required": [
              "sandbox"
            ]
          }
        }
      },
      "then": {
        "properties": {
          "config": {
            "properties": {
              "executor": {
                "const": "copilot-sdk"
              }
            }
          }
        }
      }
    }
  ],

internal/execution/sdkclient.go:158

  • sanitizedCLIEnv allocates and populates large allowlist maps on every call. Since the allowlist is static, consider hoisting allowed (and proxyVariables) to package-level vars to reduce per-call allocations and work, especially if the shared client is created repeatedly in tests or in multi-engine scenarios.
func sanitizedCLIEnv(environ []string) []string {
	allowed := map[string]bool{
		"PATH": true, "HOME": true, "USER": true, "USERNAME": true,
		"LOGNAME": true, "SHELL": true, "TERM": true, "COLORTERM": true,
		"TMPDIR": true, "TEMP": true, "TMP": true, "LANG": true, "TZ": true,
		"HTTP_PROXY": true, "HTTPS_PROXY": true, "ALL_PROXY": true, "NO_PROXY": true,
		"SSL_CERT_FILE": true, "SSL_CERT_DIR": true, "NODE_EXTRA_CA_CERTS": true,
		"REQUESTS_CA_BUNDLE": true, "CURL_CA_BUNDLE": true, "NIX_SSL_CERT_FILE": true,
		"GIT_SSL_CAINFO": true, "COPILOT_HOME": true,
		"LC_ALL": true, "LC_COLLATE": true, "LC_CTYPE": true, "LC_MESSAGES": true,
		"LC_MONETARY": true, "LC_NUMERIC": true, "LC_TIME": true, "LC_PAPER": true,
		"LC_NAME": true, "LC_ADDRESS": true, "LC_TELEPHONE": true,
		"LC_MEASUREMENT": true, "LC_IDENTIFICATION": true,
		"XDG_CONFIG_HOME": true, "XDG_CACHE_HOME": true, "XDG_DATA_HOME": true,
		"XDG_STATE_HOME": true, "XDG_RUNTIME_DIR": true,
		"XDG_DATA_DIRS": true, "XDG_CONFIG_DIRS": true,
		"SYSTEMROOT": true, "COMSPEC": true, "PATHEXT": true, "USERPROFILE": true,
		"APPDATA": true, "LOCALAPPDATA": true,
	}

Comment thread internal/execution/copilot.go
Match the existing documentation style, make path overlap checks filesystem-aware, and keep the sandbox environment allowlist platform-correct.

Issue: microsoft#544
Amp-Thread-ID: https://ampcode.com/threads/T-019ffe44-0a2f-7568-a1ff-4a62816cedf2
Co-authored-by: Amp <amp@ampcode.com>
Copilot AI review requested due to automatic review settings August 19, 2026 04:34

Copilot AI 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.

Pull request overview

Copilot reviewed 31 out of 33 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • cmd/waza/copilot_client_wrapper_mocks_test.go: Generated file
  • internal/execution/copilot_client_wrapper_mocks_test.go: Generated file
Suppressed comments (2)

internal/execution/copilot.go:198

  • copilotClientOptions is called with an empty CLI path in the custom NewCopilotClient branch, which makes the behavior diverge from the production path-resolution logic in sharedClientOptions (COPILOT_CLI_PATH / embedded CLI lookup + “refuse PATH fallback”). Consider either (a) resolving the CLI path here too (same rules as sharedClientOptions) so custom client factories get consistent, fully-initialized options, or (b) documenting clearly that custom factories are responsible for setting StdioConnection.Path and accepting any resulting PATH fallback behavior.
		copilotOptions := copilotClientOptions("error", cliArgs, "", sanitizeEnvironment)
		client = options.NewCopilotClient(copilotOptions)

internal/execution/copilot_client_wrappers.go:135

  • These failures return generic errors without enough context to debug operational issues (e.g., which workspace/skill dirs were being configured, or whether the rejection was for options vs permissions). Consider including key context (workspaceDir, number of readonly dirs) and, if available from the RPC response types, any diagnostic/message field returned by Copilot so operators can understand why a host rejected the sandbox policy.
	updated, err := w.inner.RPC.Options.Update(ctx, options)
	if err != nil {
		return err
	}
	if !updated.Success {
		return fmt.Errorf("copilot rejected the sandbox configuration")
	}
	if permissions == nil {
		return nil
	}
	configured, err := w.inner.RPC.Permissions.Configure(ctx, permissions)
	if err != nil {
		return err
	}
	if !configured.Success {
		return fmt.Errorf("copilot rejected the workspace permission boundary")
	}

Comment thread schemas/eval.schema.json
Comment on lines +105 to +128
"allOf": [
{
"if": {
"properties": {
"config": {
"required": [
"sandbox"
]
}
}
},
"then": {
"properties": {
"config": {
"properties": {
"executor": {
"const": "copilot-sdk"
}
}
}
}
}
}
],
Copilot AI review requested due to automatic review settings August 19, 2026 04:38
@microsoft-github-policy-service

Copy link
Copy Markdown

Chris (@cwkendall) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

Copilot AI 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.

Pull request overview

Copilot reviewed 31 out of 33 changed files in this pull request and generated no new comments.

Files not reviewed (2)
  • cmd/waza/copilot_client_wrapper_mocks_test.go: Generated file
  • internal/execution/copilot_client_wrapper_mocks_test.go: Generated file
Suppressed comments (6)

internal/models/spec.go:129

  • The JSON schema requires config.sandbox.enabled, but the Go model will accept sandbox: {} (or a missing enabled) and silently treat it as disabled because Enabled is a non-pointer bool. To keep runtime behavior consistent with the published schema/docs, enforce presence of enabled when the sandbox block exists (e.g., make Enabled a *bool and validate non-nil, or have UnmarshalYAML explicitly error when the enabled key is missing in a mapping node).
// SandboxConfig controls Copilot CLI's native sandbox for model-visible tools.
type SandboxConfig struct {
	Enabled              bool     `yaml:"enabled" json:"enabled"`
	AllowDevToolCaches   bool     `yaml:"allow_dev_tool_caches,omitempty" json:"allow_dev_tool_caches,omitempty"`
	AllowOutboundNetwork bool     `yaml:"allow_outbound_network,omitempty" json:"allow_outbound_network,omitempty"`
	AllowLocalNetwork    bool     `yaml:"allow_local_network,omitempty" json:"allow_local_network,omitempty"`
	GitAuth              bool     `yaml:"git_auth,omitempty" json:"git_auth,omitempty"`
	GHAuth               bool     `yaml:"gh_auth,omitempty" json:"gh_auth,omitempty"`
	ReadonlyPaths        []string `yaml:"readonly_paths,omitempty" json:"readonly_paths,omitempty"`
	ReadwritePaths       []string `yaml:"readwrite_paths,omitempty" json:"readwrite_paths,omitempty"`
}

func (s *SandboxConfig) UnmarshalYAML(node *yaml.Node) error {
	allowed := map[string]bool{
		"enabled": true, "allow_dev_tool_caches": true,
		"allow_outbound_network": true, "allow_local_network": true,
		"git_auth": true, "gh_auth": true,
		"readonly_paths": true, "readwrite_paths": true,
	}
	if node.Kind == yaml.MappingNode {
		for i := 0; i < len(node.Content); i += 2 {
			if field := node.Content[i].Value; !allowed[field] {
				return fmt.Errorf("unknown sandbox field %q", field)
			}
		}
	}

	type rawSandboxConfig SandboxConfig
	var decoded rawSandboxConfig
	if err := node.Decode(&decoded); err != nil {
		return err
	}
	*s = SandboxConfig(decoded)
	return nil

internal/execution/copilot.go:191

  • copilotClientOptions(..., cliPath="", ...) sets up a copilot.StdioConnection without a resolved CLI path. If any non-test caller provides NewCopilotClient and then starts a real CLI process, this can reintroduce PATH fallback / ambiguous binary selection, which undermines the “refusing PATH fallback” posture used elsewhere. Consider either (a) resolving cliPath the same way as sharedClientOptions (COPILOT_CLI_PATH or embedded) before building options, or (b) explicitly documenting/enforcing that custom client factories must provide a fully specified connection path.
	sanitizeEnvironment := options != nil && options.SanitizeEnvironment

internal/execution/copilot.go:198

  • copilotClientOptions(..., cliPath="", ...) sets up a copilot.StdioConnection without a resolved CLI path. If any non-test caller provides NewCopilotClient and then starts a real CLI process, this can reintroduce PATH fallback / ambiguous binary selection, which undermines the “refusing PATH fallback” posture used elsewhere. Consider either (a) resolving cliPath the same way as sharedClientOptions (COPILOT_CLI_PATH or embedded) before building options, or (b) explicitly documenting/enforcing that custom client factories must provide a fully specified connection path.
		client = SharedClient(SharedClientOptions{CLIArgs: cliArgs, SanitizeEnvironment: sanitizeEnvironment})
	} else {
		copilotOptions := copilotClientOptions("error", cliArgs, "", sanitizeEnvironment)
		client = options.NewCopilotClient(copilotOptions)

schemas/eval.schema.json:128

  • The if schema does not require config to be present. In JSON Schema, properties does not fail when a property is missing, so the if condition can evaluate as “true” for instances without config, causing the then branch (executor const) to apply more broadly than intended. A concrete fix is to add "required": ["config"] inside the if, and (optionally) also constrain config to be an object in that condition to avoid surprising matches.
  "allOf": [
    {
      "if": {
        "properties": {
          "config": {
            "required": [
              "sandbox"
            ]
          }
        }
      },
      "then": {
        "properties": {
          "config": {
            "properties": {
              "executor": {
                "const": "copilot-sdk"
              }
            }
          }
        }
      }
    }
  ],

internal/execution/copilot_client_wrappers.go:126

  • These failures are hard to diagnose because they don’t include which RPC was rejected and don’t surface any available response details. Consider including the operation name (Options.Update vs Permissions.Configure) and key context (e.g., workspaceDir), and if the RPC responses expose any error/reason fields, append them to the error message to make troubleshooting sandbox policy failures actionable.
	updated, err := w.inner.RPC.Options.Update(ctx, options)
	if err != nil {
		return err
	}
	if !updated.Success {
		return fmt.Errorf("copilot rejected the sandbox configuration")
	}

internal/execution/copilot_client_wrappers.go:136

  • These failures are hard to diagnose because they don’t include which RPC was rejected and don’t surface any available response details. Consider including the operation name (Options.Update vs Permissions.Configure) and key context (e.g., workspaceDir), and if the RPC responses expose any error/reason fields, append them to the error message to make troubleshooting sandbox policy failures actionable.
	configured, err := w.inner.RPC.Permissions.Configure(ctx, permissions)
	if err != nil {
		return err
	}
	if !configured.Success {
		return fmt.Errorf("copilot rejected the workspace permission boundary")
	}

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.

Add opt-in Copilot-native sandboxing for evaluations

2 participants