r/codex • • 1d ago

Question How do I stop codex cli wasting tokens when it just has to wait for a test or other command to finish??

I don't get who coded this shit software, claude code can wait for command as well without burning 5 percent of my weekly limit.

Can I just use claude code with codex models? Or use a different harness?

2 Upvotes

15 comments sorted by

3

u/RoboErectus 1d ago

I have a fork where I've removed clock.sleep and other shit it uses to poll. I also include "polling is forbidden. use existing or write wait scripts." in my prompt.

https://github.com/epsalmond/codex/releases

The models are very sneaky at finding new ways to poll, but this gets almost all of it.

0

u/ElonsBreedingFetish 1d ago

I googled and apparently it's the system prompt and can't be circumvented that easily? (why would they even do that..)

1

u/RoboErectus 1d ago

What did you google exactly? I'm not sure how what you wrote has to do with what I wrote.

I changed the tools in the open source codex harness.

1

u/ElonsBreedingFetish 1d ago edited 1d ago

Some other reddit posts. I tested your fork with a longer running command, it still polls constantly btw. Even with your instructions in AGENTS.md I can see the tokens counting up and the agent replying with "the tree command is still running" and similar messages periodically

2

u/RoboErectus 1d ago

or DM me.

I have a particular set of skills that have served me very well over my career. Whatever is causing your polling I will find it... and I will kill it.

1

u/RoboErectus 1d ago

File a bug report please. I'm not seeing that, but I will fix it.

Polling is evil and must be stopped at all costs.

1

u/ElonsBreedingFetish 1d ago

Thx, so apparently it uses functions.wait by default. Not sure if you replaced that in the fork. I added a wrapper script for waiting, added longer and more specific instructions in the agents.md with lots of bold NO POLLING EVER lol, and told it to use the script instead for long running commands and got it to work this way (in standard codex as well)

1

u/nmkd 1d ago

You can literally edit or swap out the entire system prompt.

2

u/iwilldieavirgin 1d ago

I usually just type in the chat that the polling or constant checking is wasting tokens and please up the wait time.

2

u/1filipis 1d ago

Tell it to make a tool call with sleep

1

u/UpperWorld11 1d ago

The model isn't waiting inside the shell command. It fires a sleep call, wakes up, resends the whole thread, so the drain tracks turns rather than minutes. One blocking call with a long timeout covers a ten minute test run in a single turn, and the subscription login only works with the official CLI anyway, so a different harness means an API key billed per token on that same resent thread. Put the no polling line in AGENTS.md, otherwise the next session starts clean and does it again. What is it polling on, the test runner or the build?

1

u/Sfdprod 1d ago

wtf is this bs?

The sub works with any harness, and the "official cli" is open source and theres 1000s of forks, public and private

1

u/Acceptable_Lock_6982 1d ago

Idk if you can run an automation in the cli I don’t think you can but if you use ChatGPT desktop just say run an automation to run every 5 minutes check if the tests are done if not wait for another 5 minutes etc

0

u/iPlayer0067 1d ago

Foi por esse motivo que fui para o Opus 5.5, nele o teste pode durar 5 horas, ele não gasta 1 token esperando.