Skip to content

Commit da97031

Browse files
authored
Drop unsent Harness options and reject prompts without an environment (#468)
Core sends only model, system_prompt, model_provider and harness_config in agent_options. Delete the adapter keys no Core path produces: codex override_system_prompt, reasoning_summary, mode, mcp_servers, enable_features, disable_features, skills and the controls copied into web_search/model_verbosity; mcode mode, override_system_prompt, skills, plugins and mcp_servers. Codex reads ExecutionControls directly. The managed Skill installer, the Runtime capability-download and skill-upload wrappers, the Runtime capability-context flags and the no-op feature preference removals go with them. Dispatch now rejects any other agent_options key, and an execution preparation with neither or both of local_environment and disable_execution_environment, with unsupported_configuration before a factory runs. claude_sdk's own unknown-key branch is unreachable and removed. agent.ManagedSkillsRoot becomes StateDir, its only remaining use.
1 parent 1074e47 commit da97031

84 files changed

Lines changed: 258 additions & 2595 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/daemon/internal/agent/claudesdk/options.go‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ func prepareConfiguration(config Config, req proto.PromptRequestPayload) (startR
135135
start.Model = value
136136
case "system_prompt":
137137
start.SystemPrompt = value
138-
default:
139-
return fail("unsupported option: " + name)
140138
}
141139
}
142140
if strings.TrimSpace(start.Model) == "" {

‎apps/daemon/internal/agent/claudesdk/session_test.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func TestTextFactoryCompletionAndFailures(t *testing.T) {
7474
}
7575

7676
func TestTextFactoryRejectsUnsupportedInput(t *testing.T) {
77-
for _, kind := range []string{"execution-controls", "tool", "option", "outside"} {
77+
for _, kind := range []string{"execution-controls", "tool", "outside"} {
7878
t.Run(kind, func(t *testing.T) {
7979
root := t.TempDir()
8080
t.Setenv("OAC_RUNTIME_HOME", root)
@@ -85,8 +85,6 @@ func TestTextFactoryRejectsUnsupportedInput(t *testing.T) {
8585
request.ExecutionControls = &proto.ExecutionControls{WebSearch: "disabled", TextVerbosity: "low"}
8686
case "tool":
8787
request.FunctionTools = []proto.FunctionTool{{}}
88-
case "option":
89-
request.AgentOptions["allowed_tools"] = "anything"
9088
case "outside":
9189
config.StateDir = filepath.Dir(root)
9290
}

‎apps/daemon/internal/agent/claudesdk/workspace_test.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestWorkspaceTrustedBindingAndEnvironment(t *testing.T) {
7676
}
7777

7878
func TestWorkspaceRejectsConflictsBeforeSideEffects(t *testing.T) {
79-
for _, name := range []string{"none", "workspace-root", "mcp", "caller-policy", "relative", "missing", "ambient-setting", "duplicate-env", "bad-env"} {
79+
for _, name := range []string{"none", "workspace-root", "mcp", "relative", "missing", "ambient-setting", "duplicate-env", "bad-env"} {
8080
t.Run(name, func(t *testing.T) {
8181
config := workspaceFixture(t)
8282
req := workspaceRequest()
@@ -88,8 +88,6 @@ func TestWorkspaceRejectsConflictsBeforeSideEffects(t *testing.T) {
8888
req.LocalEnvironment = &proto.LocalEnvironment{ID: "environment", NetworkAccess: "enabled", WorkspaceRoot: config.Workspace.ScratchDir}
8989
case "mcp":
9090
req.MCPHTTPServers = &[]proto.MCPHTTPServer{{ConnectionOrigin: "service", ServerLabel: "remote", ServerURL: "https://example.test/mcp"}}
91-
case "caller-policy":
92-
req.AgentOptions["workspace"] = "override"
9391
case "relative":
9492
config.Workspace.Directory = "relative"
9593
case "missing":

‎apps/daemon/internal/agent/codex/declaration.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func discover(ctx context.Context, options agent.DiscoveryOptions, info proto.Su
5151
return discoverWithCheck(ctx, options, info, CheckCLIAvailable)
5252
}
5353
func discoverWithCheck(parent context.Context, options agent.DiscoveryOptions, info proto.SupportedAgentKind, check func(context.Context, string) (string, error)) *agent.Runtime {
54-
runtime := &agent.Runtime{Info: info, Session: Factory, SessionCapabilityContext: true, ExecutorCapabilityContext: true}
54+
runtime := &agent.Runtime{Info: info, Session: Factory}
5555
ctx, cancel := context.WithTimeout(parent, 15*time.Second)
5656
defer cancel()
5757
version, err := check(ctx, "")

‎apps/daemon/internal/agent/codex/declaration_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestMCPRequiredDiscoveryRequiresPinnedNative(t *testing.T) {
1515
for _, version := range []string{"codex-cli 0.153.4", "codex-cli 0.153.3", "codex-cli 0.154.0"} {
1616
runtime := discoverWithCheck(t.Context(), agent.DiscoveryOptions{Stdout: io.Discard, Stderr: io.Discard}, Declaration.Info, func(context.Context, string) (string, error) { return version, nil })
1717

18-
if !runtime.Info.Available || runtime.Executor == nil || (runtime.Preparation != nil) != SupportsLocalEnvironment(version) || !runtime.SessionCapabilityContext || !runtime.ExecutorCapabilityContext {
18+
if !runtime.Info.Available || runtime.Executor == nil || (runtime.Preparation != nil) != SupportsLocalEnvironment(version) {
1919
t.Fatalf("factories: %+v", runtime)
2020
}
2121
if runtime.Info.Capabilities.MCPHTTPRequired.IsSupported() != (version == "codex-cli 0.153.4") {

‎apps/daemon/internal/agent/codex/execution_controls.go‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎apps/daemon/internal/agent/codex/execution_controls_test.go‎

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,18 @@ import (
77
"github.com/MiniMax-AI/OpenAgentCore/internal/agentdaemon/proto"
88
)
99

10-
func TestExecutionControlsOverrideWithoutMutatingNativeOptions(t *testing.T) {
10+
func TestExecutionControlsSelectNativeSettings(t *testing.T) {
1111
t.Setenv("OAC_RUNTIME_HOME", t.TempDir())
12-
original := map[string]any{"model": "test-model", "web_search": "live", "model_verbosity": "high"}
13-
request := proto.PromptRequestPayload{AgentOptions: original}
14-
if got := executionOptions(request); !reflect.DeepEqual(got, original) {
15-
t.Fatal("ordinary options changed")
16-
}
1712
for _, search := range []string{"disabled", "cached", "live"} {
1813
for _, verbosity := range []string{"low", "medium", "high"} {
19-
request.ExecutionControls = &proto.ExecutionControls{WebSearch: search, TextVerbosity: verbosity}
20-
options := executionOptions(request)
21-
if options["model"] != "test-model" || original["web_search"] != "live" || original["model_verbosity"] != "high" {
22-
t.Fatal("operator options mutated")
23-
}
24-
plan, err := BuildSessionPlan("run", "state", options)
14+
plan, err := BuildSessionPlan("state", map[string]any{"model": "test-model"}, &proto.ExecutionControls{WebSearch: search, TextVerbosity: verbosity})
2515
if err != nil {
2616
t.Fatal(err)
2717
}
28-
want := map[string]string{"web_search": `"` + search + `"`, "model_verbosity": `"` + verbosity + `"`}
29-
for _, kv := range plan.ExtraConfig {
30-
if v, ok := want[kv[0]]; ok {
31-
if kv[1] != v {
32-
t.Fatal("native control differs", kv)
33-
}
34-
delete(want, kv[0])
35-
}
36-
}
3718
plan.Cleanup()
38-
if len(want) != 0 {
39-
t.Fatal("native settings omitted", want)
19+
want := [][2]string{{"web_search", `"` + search + `"`}, {"model_verbosity", `"` + verbosity + `"`}}
20+
if !reflect.DeepEqual(plan.ExtraConfig, want) {
21+
t.Fatalf("config = %v, want %v", plan.ExtraConfig, want)
4022
}
4123
}
4224
}
@@ -48,8 +30,7 @@ func TestExecutionControlsRejectIncompleteOrInvalidValues(t *testing.T) {
4830
{}, {WebSearch: "disabled"}, {TextVerbosity: "medium"},
4931
{WebSearch: "invalid", TextVerbosity: "medium"}, {WebSearch: "disabled", TextVerbosity: "invalid"},
5032
} {
51-
options := executionOptions(proto.PromptRequestPayload{ExecutionControls: &controls})
52-
if plan, err := BuildSessionPlan("run", "state", options); err == nil {
33+
if plan, err := BuildSessionPlan("state", nil, &controls); err == nil {
5334
plan.Cleanup()
5435
t.Fatal("invalid controls accepted", controls)
5536
}

‎apps/daemon/internal/agent/codex/generation_config.go‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎apps/daemon/internal/agent/codex/harness_config_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import (
1313

1414
func TestHarnessConfigAppliedWithoutChangingProvider(t *testing.T) {
1515
t.Setenv("OAC_RUNTIME_HOME", t.TempDir())
16-
plan, err := BuildSessionPlan("run", "native-config", map[string]any{
16+
plan, err := BuildSessionPlan("native-config", map[string]any{
1717
"model": "fixture", "harness_config": map[string]any{"model_reasoning_effort": "high"},
1818
"model_provider": map[string]any{"base_url": "https://provider.invalid/v1", "protocol": "responses", "api_key": "test-key"},
19-
})
19+
}, nil)
2020
if err != nil {
2121
t.Fatal(err)
2222
}
@@ -27,7 +27,7 @@ func TestHarnessConfigAppliedWithoutChangingProvider(t *testing.T) {
2727
}
2828

2929
func TestHarnessConfigConflictFailsBeforePreparation(t *testing.T) {
30-
_, err := BuildSessionPlan("run", "", map[string]any{"harness_config": map[string]any{"model_provider": "bypass"}})
30+
_, err := BuildSessionPlan("", map[string]any{"harness_config": map[string]any{"model_provider": "bypass"}}, nil)
3131
if err != harnessconfig.ErrHarnessConfig {
3232
t.Fatalf("configuration must fail before filesystem preparation: %v", err)
3333
}

‎apps/daemon/internal/agent/codex/mcp_config.go‎

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ import (
88
"strings"
99
)
1010

11-
// mcpServerConfig is the daemon-internal MCP server config flattened
12-
// from agent_options["mcp_servers"] (rendered by render.TargetCodex /
13-
// the mcpServers JSON shape). Written into <CODEX_HOME>/config.toml
11+
// mcpServerConfig is the daemon-internal MCP server config resolved from
12+
// the request's MCP bindings. Written into <CODEX_HOME>/config.toml
1413
// before spawning the app-server child.
1514
type mcpServerConfig struct {
1615
Name string
1716
URL string
18-
Headers map[string]string
1917
Command string
2018
Args []string
21-
Env map[string]string
2219
EnabledTools *[]string
2320
Required bool
2421
BearerTokenEnvVar string
@@ -76,7 +73,6 @@ func writeCodexMCPConfig(codexHome string, servers map[string]mcpServerConfig) e
7673
}
7774
b.WriteString("]\n")
7875
}
79-
writeMCPHeaderMap(&b, "http_headers", srv.Headers)
8076
writeMCPHeaderMap(&b, "env_http_headers", srv.EnvHTTPHeaders)
8177
b.WriteByte('\n')
8278
continue
@@ -94,22 +90,6 @@ func writeCodexMCPConfig(codexHome string, servers map[string]mcpServerConfig) e
9490
}
9591
b.WriteString("]\n")
9692
}
97-
if len(srv.Env) > 0 {
98-
envKeys := make([]string, 0, len(srv.Env))
99-
for k := range srv.Env {
100-
envKeys = append(envKeys, k)
101-
}
102-
sort.Strings(envKeys)
103-
b.WriteString("\n[mcp_servers.")
104-
b.WriteString(tomlQuoteString(name))
105-
b.WriteString(".env]\n")
106-
for _, k := range envKeys {
107-
b.WriteString(tomlQuoteString(k))
108-
b.WriteString(" = ")
109-
b.WriteString(tomlQuoteString(srv.Env[k]))
110-
b.WriteByte('\n')
111-
}
112-
}
11393
b.WriteByte('\n')
11494
}
11595

0 commit comments

Comments
 (0)