Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(computer): disable Codex model_invoke features via config overrides

Dongdong Chen60a97dea1f1c
diff --git a/apps/computer/local-daemon/README.md b/apps/computer/local-daemon/README.md
index 6f86be65..fef59ee1 100644
--- a/apps/computer/local-daemon/README.md
+++ b/apps/computer/local-daemon/README.md
@@ -93,7 +93,9 @@ Codex's workspace mode turns off the shell and unified exec and keeps only the
code-mode host's `apply_patch`, with the working directory as the only writable
root. It therefore reads no files, and the Daemon appends the workspace files'
contents to the end of the prompt, because the `workspace-write` sandbox limits
-writes but not reads.
+writes but not reads. Codex feature disables use `-c`/`--config
+features.<name>=false` rather than `--disable <name>` so older Codex versions
+ignore features they do not define instead of aborting on startup.
`go test -tags live_model_invoke ./internal/provider -run TestLiveCodex` runs one
structured call and one workspace call with the locally signed-in Codex (checking
diff --git a/apps/computer/local-daemon/internal/provider/model_invoke.go b/apps/computer/local-daemon/internal/provider/model_invoke.go
index 5e8fff0a..57927e56 100644
--- a/apps/computer/local-daemon/internal/provider/model_invoke.go
+++ b/apps/computer/local-daemon/internal/provider/model_invoke.go
@@ -57,11 +57,12 @@ const (
ModelInvokeFailed = "failed"
)
-// codexInvokeDisabledFeatures turns off every Codex 0.166 tool family a
-// one-shot call must not reach: shell and code execution, sub-agents, goals,
-// browsers, computer use, connected apps, plugins, hooks, image tools, tool
-// discovery, Skills and sleeping. An unknown name makes Codex refuse to start,
-// which is reported as runtime_incompatible.
+// codexInvokeDisabledFeatures turns off every Codex tool family a one-shot
+// call must not reach: shell and code execution, sub-agents, goals, browsers,
+// computer use, connected apps, plugins, hooks, image tools, tool discovery,
+// Skills and sleeping. Each name is passed as a features.<name>=false config
+// override rather than --disable so older Codex releases ignore features they
+// do not define instead of refusing to start.
var codexInvokeDisabledFeatures = []string{
"shell_tool", "unified_exec", "code_mode_host", "multi_agent", "goals",
"browser_use", "browser_use_external", "browser_use_full_cdp_access",
@@ -358,7 +359,7 @@ func (m ModelInvoker) sessionInvoke(ctx context.Context, request ModelInvokeRequ
environment["CODEX_HOME"] = home
args := append([]string{"--config", `web_search="disabled"`}, codexInvokeSandboxConfig(runtime.GOOS)...)
for _, feature := range codexInvokeDisabledFeatures {
- args = append(args, "--disable", feature)
+ args = append(args, "--config", "features."+feature+"=false")
}
invokeCtx, cancel := context.WithTimeout(ctx, modelInvokeTimeout(request.Timeout))
defer cancel()
@@ -519,7 +520,7 @@ func codexModelInvokeArgs(mode, effort, work, schemaPath, lastPath string) []str
if mode == ModelInvokeWorkspace && codexWorkspaceKeptFeatures[feature] {
continue
}
- args = append(args, "--disable", feature)
+ args = append(args, "-c", "features."+feature+"=false")
}
if schemaPath != "" {
args = append(args, "--output-schema", schemaPath)
diff --git a/apps/computer/local-daemon/internal/provider/model_invoke_test.go b/apps/computer/local-daemon/internal/provider/model_invoke_test.go
index 9bc0b07c..a9f0cbd4 100644
--- a/apps/computer/local-daemon/internal/provider/model_invoke_test.go
+++ b/apps/computer/local-daemon/internal/provider/model_invoke_test.go
@@ -36,8 +36,12 @@ func argValue(args []string, name string) string {
func disabledFeatures(args []string) []string {
var features []string
for index, arg := range args {
- if arg == "--disable" {
- features = append(features, args[index+1])
+ if (arg == "-c" || arg == "--config") && index+1 < len(args) {
+ if name, ok := strings.CutPrefix(args[index+1], "features."); ok {
+ if feature, isFalse := strings.CutSuffix(name, "=false"); isFalse {
+ features = append(features, feature)
+ }
+ }
}
}
return features
@@ -55,6 +59,9 @@ func TestCodexModelInvokeArgsPinEffortIsolationAndNoPrompt(t *testing.T) {
if !slices.Contains(args, `model_reasoning_effort="low"`) || !slices.Contains(args, `web_search="disabled"`) {
t.Fatalf("args lack effort or web search override: %q", args)
}
+ if slices.Contains(args, "--disable") {
+ t.Fatalf("codex exec must disable features via -c overrides rather than --disable: %q", args)
+ }
want := []string{
"shell_tool", "unified_exec", "code_mode_host", "multi_agent", "goals",
"browser_use", "browser_use_external", "browser_use_full_cdp_access",
@@ -78,6 +85,9 @@ func TestCodexModelInvokeArgsPinEffortIsolationAndNoPrompt(t *testing.T) {
if argValue(workspace, "--sandbox") != "workspace-write" {
t.Fatalf("workspace args = %q", workspace)
}
+ if slices.Contains(workspace, "--disable") {
+ t.Fatalf("workspace mode passed --disable: %q", workspace)
+ }
// Workspace mode keeps only the code-mode host, which carries apply_patch;
// a shell could read any file the user can.
if got := disabledFeatures(workspace); !slices.Equal(got, slices.DeleteFunc(slices.Clone(want), func(f string) bool { return f == "code_mode_host" })) {
@@ -90,6 +100,36 @@ func TestCodexModelInvokeArgsPinEffortIsolationAndNoPrompt(t *testing.T) {
}
}
+func TestCodexModelInvokeAvoidsUnknownDisableFlagsOnOlderCodex(t *testing.T) {
+ // Codex 0.150.1 rejects unknown --disable names (such as sleep_tool) at
+ // startup while ignoring unknown -c features.<name>=false overrides.
+ fixture := newCodexInvokeFixture(t, func(_ context.Context, command *exec.Cmd) error {
+ for index, arg := range command.Args {
+ if arg == "--disable" && index+1 < len(command.Args) && command.Args[index+1] == "sleep_tool" {
+ _, _ = io.WriteString(command.Stderr, "Error: Unknown feature flag: sleep_tool\n")
+ return errors.New("exit status 1")
+ }
+ }
+ return os.WriteFile(argValue(command.Args, "-o"), []byte(`{"answer":"ok"}`), 0o600)
+ })
+ lookup := fixture.invoker.Lookup
+ fixture.invoker.Lookup = func(ctx context.Context, runtimeType string) (ModelInvokeRuntime, bool, error) {
+ installed, ok, err := lookup(ctx, runtimeType)
+ installed.Version = "codex-cli 0.150.1"
+ return installed, ok, err
+ }
+ for _, request := range []ModelInvokeRequest{
+ structuredRequest(),
+ {RuntimeType: "codex", Mode: ModelInvokeText, ReasoningEffort: "low", Input: "hello", Timeout: time.Minute},
+ {RuntimeType: "codex", Mode: ModelInvokeWorkspace, ReasoningEffort: "low", Input: "edit", Timeout: time.Minute},
+ } {
+ result := fixture.invoker.Invoke(context.Background(), request)
+ if result.Outcome != ModelInvokeCompleted {
+ t.Fatalf("mode %s on Codex 0.150.1: %+v", request.Mode, result)
+ }
+ }
+}
+
func TestClaudeModelInvokeArgsDisableToolsAndCustomizations(t *testing.T) {
schema := json.RawMessage(`{"type":"object"}`)
args := claudeModelInvokeArgs(ModelInvokeStructured, "low", schema)
diff --git a/apps/computer/local-daemon/internal/provider/model_session_test.go b/apps/computer/local-daemon/internal/provider/model_session_test.go
index ed494da7..94faf2a0 100644
--- a/apps/computer/local-daemon/internal/provider/model_session_test.go
+++ b/apps/computer/local-daemon/internal/provider/model_session_test.go
@@ -25,6 +25,15 @@ func init() {
}
func fakeSessionServer(record string) int {
+ for index, arg := range os.Args[1:] {
+ if arg == "--disable" && index+2 < len(os.Args) {
+ name := os.Args[index+2]
+ if name != "plugins" && name != "goals" {
+ fmt.Fprintf(os.Stderr, "Error: Unknown feature flag: %s\n", name)
+ return 1
+ }
+ }
+ }
launch, _ := json.Marshal(map[string]any{"args": os.Args[1:], "codex_home": os.Getenv("CODEX_HOME"), "tmpdir": os.Getenv("TMPDIR"), "teamhub": os.Getenv("TEAMHUB_CLI_TOKEN")})
file, err := os.OpenFile(record, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o600)
if err != nil {
@@ -111,7 +120,9 @@ func TestModelInvokerAnswersSessionCallsOnOneResidentCodex(t *testing.T) {
t.Fatal(err)
}
args := strings.Join(launch.Args, " ")
- if launch.Args[0] != "app-server" || !strings.Contains(args, "--disable shell_tool") || !strings.Contains(args, `--config web_search="disabled"`) {
+ if launch.Args[0] != "app-server" || !strings.Contains(args, "--config features.shell_tool=false") ||
+ !strings.Contains(args, "--config features.sleep_tool=false") || strings.Contains(args, "--disable sleep_tool") ||
+ !strings.Contains(args, `--config web_search="disabled"`) {
t.Fatalf("app-server args %v", launch.Args)
}
if launch.CodexHome != filepath.Join(root, "codex-home") || launch.TempDir != filepath.Join(root, "tmp") || launch.TeamHub != "" {
diff --git a/apps/node-services/scripts/codex-model-call.ts b/apps/node-services/scripts/codex-model-call.ts
index 71d32e35..757fcc6e 100644
--- a/apps/node-services/scripts/codex-model-call.ts
+++ b/apps/node-services/scripts/codex-model-call.ts
@@ -180,7 +180,7 @@ export async function createCodexModelCall(
];
for (const feature of DISABLED_FEATURES)
if (!(request.mode === "workspace" && feature === "code_mode_host"))
- args.push("--disable", feature);
+ args.push("-c", `features.${feature}=false`);
if (request.outputSchema) {
await writeFile(
join(call, "schema.json"),