Skip to content

fix(codex): restore tools for kenari-routed models - #5

Merged
doedja merged 1 commit into
mainfrom
fix/codex-kenari-tool-mode
Jul 27, 2026
Merged

fix(codex): restore tools for kenari-routed models#5
doedja merged 1 commit into
mainfrom
fix/codex-kenari-tool-mode

Conversation

@doedja

@doedja doedja commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Problem

Any model routed through Kenari on the Codex backend had no tools. Codex replied:

I can't access a shell tool in this session.

Reported against kenari/gpt-5-6-sol, but it affected every kenari-routed model.

Root cause

Codex runs the gpt-5.6 family in tool_mode="code_mode". In that mode it sends tools: [] at the top level and puts the real tool definitions in an OpenAI-proprietary input item:

{"type": "additional_tools", "role": "developer", "tools": [...]}

OpenAI's own backend expands that item into usable tools. The Kenari gateway forwards it as an ordinary developer message, so the model ends up with nothing.

codexKenariModels cloned the native template wholesale ({...template}), so every kenari entry inherited tool_mode, use_responses_lite and multi_agent_version.

Confirmed directly against the gateway, identical request twice:

tools sent as gateway response
additional_tools input item "I don't have access to a shell tool in this session"
top-level tools function_call {"cmd":"ls -la"}

Fix

  • Drop tool_mode and multi_agent_version, force use_responses_lite: false on kenari catalog entries so Codex uses classic top-level function tools.
  • Normalize dots to dashes in the template lookup. Cache ids use gpt-5-6-sol while native slugs use gpt-5.6-sol, so native.slug === model.id never matched and every model fell back to nativeModels[0].

Verification

kenari/gpt-5-6-sol -> LICENSE README.md bin docs package.json src test
kenari/glm-5-2     -> directory contents listed

89/89 tests pass. New unit test covers the mode strip and the dotted-slug match.

Known tradeoff

Kenari-routed Codex no longer uses code_mode, even on gpt-5.6 where OpenAI supports it natively. Native Codex login keeps it. Restoring it needs a gateway-side change: lower additional_tools input items into real top-level tools before forwarding upstream.

Codex runs the gpt-5.6 family in tool_mode="code_mode". In that mode it
sends an empty top-level tools array and puts the real tool definitions
in an "additional_tools" input item, which only OpenAI's own backend
expands into usable tools. The Kenari gateway forwards that item as an
ordinary developer message, so the model saw no tools at all and replied
"I can't access a shell tool in this session".

codexKenariModels cloned the native template wholesale, so every
kenari-routed entry inherited tool_mode, use_responses_lite and
multi_agent_version. Drop those OpenAI-private modes so Codex falls back
to classic top-level function tools, which the gateway already handles.

Also normalize dots to dashes in the template lookup. Cache ids use
gpt-5-6-sol while native slugs use gpt-5.6-sol, so no entry ever matched
its own template and everything fell back to nativeModels[0].

Verified end to end: kenari/gpt-5-6-sol and kenari/glm-5-2 both run the
shell tool and return a real directory listing.
@doedja
doedja merged commit c83db7c into main Jul 27, 2026
6 checks passed
@doedja
doedja deleted the fix/codex-kenari-tool-mode branch July 27, 2026 13:33
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.

1 participant