openai / openai/codex

Excessive token consumption with tool search

Open
#44,228 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI model-behavior rate-limits tool-calls
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.153.4

What subscription do you have?

Max 20

Which model were you using?

gpt-6-astra medium

What platform is your computer?

MacOS

What terminal emulator and version are you using (if applicable)?

Orca

Codex doctor report

What issue are you seeing?

Agent makes too wide tool search call causing 33k token response and 10k tokens added to session. Returned results include results widely with multiple plugins and tool descriptions contain their full Typescript definitions. This can also cause legit tool definitions to be missed as result get truncated.

What steps can reproduce the bug?

Uploaded thread: 01a0871a-f281-7442-b91b-f1e4458089a5

What is the expected behavior?

Agent does more precise search for the tools, and only loads full tool definitions to candidates it actually wants to use.

Additional information

https://gist.github.com/jlitola/381d15761ec108918ddca4e53d1d097f

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the uploaded thread 01a0871a-f281-7442-b91b-f1e4458089a5 and the linked gist, then reproduce the wide tool search with codex-cli 0.153.4 on macOS. Done means search results avoid unnecessary tool definitions, preserve relevant candidates without truncation, and substantially reduce the session's token usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai-infra-agents, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.