fix(codex): restore tools for kenari-routed models - #5
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Any model routed through Kenari on the Codex backend had no tools. Codex replied:
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 sendstools: []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.
codexKenariModelscloned the native template wholesale ({...template}), so every kenari entry inheritedtool_mode,use_responses_liteandmulti_agent_version.Confirmed directly against the gateway, identical request twice:
additional_toolsinput itemtoolsfunction_call {"cmd":"ls -la"}Fix
tool_modeandmulti_agent_version, forceuse_responses_lite: falseon kenari catalog entries so Codex uses classic top-level function tools.gpt-5-6-solwhile native slugs usegpt-5.6-sol, sonative.slug === model.idnever matched and every model fell back tonativeModels[0].Verification
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: loweradditional_toolsinput items into real top-level tools before forwarding upstream.