Skip to content

fix(hub): serve Codex models their tools in code mode - #124

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-12050-serve-codex-models-their-tools-in-code-mode-so-the
Nov 4, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-12050-serve-codex-models-their-tools-in-code-mode-so-the

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • The Codex adapter offers Codex models one exec code tool that declares every tool on a typed tools object rendered from its JSON schema, and replays past calls and their results as scripts.
  • The one tools.<name>({...}) call in a model's script reaches Interchange as an ordinary tool call, so approvals, audit and the doom-loop guard apply to it. Scripts are read, never run; arguments are parsed with Bun.JSON5.
  • A script the adapter cannot read is answered with the rules, and the transcript describes that step in plain words.

Verification

  • bun run lint, format:check, typecheck, test (216 pass), pins:verify and vendor:verify pass.
  • Replaying the doom-loop trace through Interchange's reactor against the Codex backend on GPT-6.1 Terra: 16 of 16 runs reply and none hit the doom-loop guard; without this change 7 of 16 runs end in it.
  • request_approval called through exec stops at the approval gate before it runs, in 4 of 4 runs.

Closes CL-12050

Codex models are trained to reach tools through one exec tool that runs
JavaScript. Given plain function tools, GPT-6.1 Terra repeats its last
call with identical arguments until the doom-loop guard fails the run,
and writes placeholder arguments. The Codex adapter offers one exec tool
that declares every tool, under a JavaScript-safe alias of its name, on
a typed tools object rendered from its JSON schema. It replays past
calls as scripts and turns the one tools.<name>({...}) call a script
makes back into an ordinary tool call, so the reactor still gates,
audits and loop-checks it. Scripts are read, never run: the argument is
parsed with Bun.JSON5, and any other script, such as one with a
condition, loop or second call, becomes an exec call answered with the
rules.
A Codex script the hub cannot read reaches the transcript as an exec
call whose result is "unknown tool: exec", which reads like a platform
fault. The step is named as rewriting a tool call and its result says
the assistant was asked to write it again.
@linear-code

linear-code Bot commented Nov 4, 2026

Copy link
Copy Markdown

CL-12050

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review · Comment

The Codex adapter serves Codex models their tools through one exec code tool and turns the call in each script back into an ordinary Interchange tool call; the transcript describes an unreadable script in plain words.

No findings.

@corbits-triage

corbits-triage Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Triage: Pass

No changes needed from you. A maintainer will review this pull request.

Triage will approve, request review.

@TheGreatAxios
TheGreatAxios added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit fff8d3c Nov 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant