Skip to content

Run the agent-instruction evals on the real Claude Code and Codex CLIs #950

Done

Description

@Jacksondr5

Upstream's evals/mcp-tool-use checks how agents use T3's MCP tools, but its runner needs a pay-per-use ANTHROPIC_API_KEY for Claude and a CLIProxyAPI server named vibeproxy for GPT models. Neither exists on openclaw. It also never loads J5's own MCP tools (j5_send_message, j5_propose_crew, playbooks, artifacts), so J5's agent instructions are only half covered. A dry run on 2026-11-06 showed that J5's orchestration text does reach the prompt.

Build a J5-owned eval runner that replays upstream's cases, and J5's own, on the real Claude Code and Codex CLIs, using the subscriptions already signed in. Waits on the next upstream advance (#772), which brings upstream's newer cases, the gradeSample export, and the Terra shell simulator.

Design

  • Container: one per run, with pinned Claude Code and Codex versions, an empty home folder, the checkout mounted read-only, and network access only to the model endpoints, through an egress proxy. Each sample gets its own temporary folder and session. Not one container per sample, because one Codex login must not be refreshed by several processes at once.
  • Sign-in: Claude uses a long-lived claude setup-token token passed in as CLAUDE_CODE_OAUTH_TOKEN. Codex uses its own codex login --device-auth in a dedicated volume, never a copy of the host's auth.json. OpenAI's CI guide says copies break each other when one refreshes.
  • Harnesses: Claude runs through the Agent SDK on the pinned claude binary, with options from makeClaudeQueryOptions. Codex runs through codex app-server --stdio, with developerInstructions from buildCodexAdditionalContext.
  • Earlier turns: Codex gets them through thread/inject_items. Claude has no such call, so the runner writes a session file in Claude Code's format and resumes it. That format isn't documented, which makes this the most fragile piece.
  • Tools: a fake MCP server serves upstream's and J5's real tool schemas from source and answers from the case mocks. A PreToolUse hook on both harnesses rewrites shell and file calls (updatedInput) so they print the simulator's answer. Anything a hook misses runs inside the container.
  • Shell simulator: gpt-6.1-terra in a tool-less Codex thread, on the subscription.
  • Grading: upstream's case files and gradeSample. J5's cases go in their own file. Compare only against our own baselines.
  • Location: a new J5 folder under evals/, with no edits to upstream files expected. Once it works, record it in Upstream give-back backlog (hold until V2 merges upstream) #276 as a give-back candidate.
  • Cost: runs use up the same subscription limits as the live fleet. Default concurrency is low, and --case and --stop-on-regression keep runs small.

First step: a one-case prototype

Run review-round-uses-thread-send on one Claude and one Codex model. It proves:

Also measure startup and memory per sample.

Needed from Jackson for the prototype: run claude setup-token once, and enter one device code for the container's Codex login.

Designed with Claude Opus 5.5 in J5 Code.

Activity

  1. Jacksondr5 commented on Nov 17, 2026

    @Jacksondr5
    OwnerAuthor

    Prototype results (2026-11-16)

    The one-case prototype works on both harnesses, and all five proofs hold. The code is in evals/j5-cli/ on branch j5code/find-upstream-instruction-evals. It is not committed yet and edits no upstream file.

    Pinned versions: Claude Code 2.1.326 and Codex 0.169.0 (the host's versions). Models: Sonnet 5.5 and GPT-6.1 Sol. Each case ran once per harness, and every result below passed.

    Case Claude Codex
    review-round-uses-thread-send (earlier turns) pass, 8–15 s pass, 19–23 s
    pr-created-not-linked (shell, then link the PR) pass, 18–23 s pass, 42–55 s

    The five proofs

    1. Forged Claude session resumes. The agent called delegate_task without loading it first, which the forged history had already done. It also passed on the round 1 findings, which exist only in the forged turns.
    2. Codex thread/inject_items counts as history. Codex named its call sol-review-r2, after the round 1 call sol-review-r1 that exists only in the injected items.
    3. Codex updatedInput rewrites shell commands ([Feature request] Extend PreToolUse hooks beyond Bash + implement updatedInput rewrite openai/codex#18491). It also works inside code mode.
      • Caveat: under app-server, --dangerously-bypass-hook-trust is ignored. Unreviewed user hooks don't run there, so the agent's git push ran for real, and the egress proxy blocked it.
      • Fix: the hook is now managed policy in /etc/codex/requirements.toml, baked into the image.
      • Claude's hook is an SDK callback.
    4. The egress allowlist works. Only api.anthropic.com, chatgpt.com and auth.openai.com get through. GitHub, other sites, direct connections and DNS are refused.
      • Codex also tried ab.chatgpt.com (allowed as a subdomain of chatgpt.com) and *.oaiusercontent.com (refused). Neither refusal affected a turn.
    5. Separate logins. Claude uses a claude setup-token token kept outside the repo. Codex uses its own device-code login in the j5-eval-codex-home volume. Jackson's host Codex login still works.

    Costs measured

    • Container start: 0.5 s.
    • Peak memory while a sample runs: about 520 MiB on Claude and 440 MiB on Codex.
    • Model turns take almost all of the time.

    Changes from the design

    • Shell simulator: Claude Haiku 5.5, run through the SDK on the subscription. Terra was planned, but Haiku is upstream's default and needed no extra plumbing. A consequence: Codex runs also need the Claude token.
    • Upstream code reused: after 0.1.7, the runner imports upstream's cases, buildMessages, t3Default, shellRequest, cannedOutput and gradeSample.
    • Upstream code copied: withProductFields and codexMessages are still unexported upstream, so they're copied, and the copy is marked as such.
    • J5's options: Claude gets them from makeClaudeQueryOptions. Codex gets J5's turn parameters from buildCodexTurnStartParams and its thread config from CODEX_THREAD_CONFIG.
    • Correction: gradeSample was already exported before the advance. The earlier note that the advance would bring it was wrong.

    Known gaps for the full runner

    • J5's own MCP tools aren't served yet.
    • Claude's Edit and Write, and Codex's apply_patch, run for real in the throwaway checkout instead of being simulated.
    • The Claude session format is undocumented, so re-check it on every version bump.
    • Codex step numbers are per call, not per model response. That only matters for endsTurnAfter checks.
    • Samples run one at a time. Running several at once needs a separate checkout path for each.
    • The fresh Codex home has Codex's plugins on: one Codex sample searched plugins before doing the task.
  2. bryantderosier commented on Dec 1, 2026

    @bryantderosier
    Collaborator

    Closing this as done. #1125 shipped it on 2026-11-28; it said "Refs #950", so it didn't close this automatically.

    evals/j5-cli replays upstream's cases plus J5's own on the pinned Claude Code (2.1.326) and Codex (0.169.0) CLIs. It runs on the subscription logins, in a Docker container whose only way out is an egress proxy. Claude goes through the Agent SDK with J5's makeClaudeQueryOptions, and Codex through codex app-server with J5's turn params. That's the design here and the prototype from the 11-17 comment. J5's own cases are in evals/j5-cli/cases/, and evals/j5-cli/README.md explains how to run it.

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