Skip to content

Codex: function tools sent without strict:false — model can't omit optional params (breaks Claude Code subagent spawns outside git repos) #43

Closed

Description

@Yan-Yu-Lin

Summary

Codex function tools are translated without an explicit strict field. The Responses API defaults function tools to strict mode, and under strict constrained decoding the model cannot omit optional parameters — it fills every property in the schema on every call.

For plain tools this is just noise (empty strings, default enums), but it breaks Claude Code's Agent tool in a nasty way: the model is forced to emit the optional isolation parameter on every subagent spawn. It always picks "worktree" (or "remote"), so:

  • Spawning a subagent from a non-git directory always fails with Cannot create agent worktree: not in a git repository and no WorktreeCreate hooks are configured. — local subagents are effectively unusable outside git repos.
  • Inside git repos, every subagent gets worktree isolation whether you want it or not, so subagents can't write to paths outside the worktree via Write/Edit.

The model literally cannot comply when asked to omit the field — we watched a session try twice (it even named the attempt "truly omit isolation test") and the emitted tool call still contained isolation: "worktree".

Repro

Minimal probe against claude-code-proxy serve (Codex provider, gpt-5.6-sol): define a tool with required: ["prompt"] and two optional fields, and instruct the model to call it with only prompt:

{
  "name": "spawn_agent",
  "input_schema": {
    "type": "object",
    "properties": {
      "prompt":    { "type": "string" },
      "isolation": { "type": "string", "enum": ["worktree", "remote"] },
      "mode":      { "type": "string", "enum": ["default", "acceptEdits"] }
    },
    "required": ["prompt"]
  }
}

Result before the fix — optional fields force-filled despite explicit instructions to omit them:

{ "prompt": "hello", "isolation": "remote", "mode": "default" }

Fix

Send an explicit strict: false on translated function tools, matching what the official Codex CLI does. Same probe after the fix:

{ "prompt": "hello" }

End-to-end confirmed: Claude Code running through the patched proxy now omits isolation and spawns local subagents from non-git directories normally.

One-commit fix here: Yan-Yu-Lin@a60c26f (branch codex-strict-false) — happy to open a PR if you want it.

For reference, CLIProxyAPI does the same thing in its Claude→Codex translation (sjson.SetBytes(tool, "strict", false) in internal/translator/codex/claude/codex_claude_request.go), plus some extra schema hardening ($schema stripping, >64-char tool-name shortening).

cargo test --all passes with the change.

Activity

  1. raine commented on Jul 13, 2026

    @raine
    Owner

    Thanks, should be fixed in latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions