r/OpenaiCodex • • Nov 02 '26

Bugs or problems Codex agent ignored repository instructions and consumed excessive token budget

I’m using Codex on a repository with explicit AGENTS.md rules covering delegation, scope control, review cost, and model usage.

During a bounded visual UI slice, the agent made these six operational mistakes:

  1. It allowed too many repeated wait operations for a subagent.
  2. It launched reviews against the entire dirty workspace instead of limiting them to the current slice.
  3. It continued after the scope expanded instead of stopping and asking for direction.
  4. It repeated review/correction cycles for non-blocking warnings.
  5. It switched between multiple models—Terra, Luna, and Sol—even though the repository rules did not require model switching for this visual task.
  6. It initially claimed that the model changes were required by AGENTS.md, then later acknowledged that this was incorrect.

The result was a significant increase in token consumption: approximately 9% in four minutes, 20% in eight, etc.., despite using medium effort and having explicit cost-control rules in the repository.

The agent eventually acknowledged that the issue was its orchestration rather than a required project rule.

I would like clarification on:

  • Why Codex did not reliably enforce the repository’s AGENTS.md instructions.
  • Whether model switching is automatic or agent-controlled.
  • How to prevent workspace-wide reviews for bounded slices.
  • Whether there is a recommended hard-stop or configuration mechanism to prevent repeated expensive tool calls.
0 Upvotes

12 comments sorted by

2

u/RemoraEdge Nov 02 '26

Yup that’s common with all AI agents after some time.
It forgets. Gets focus on a specific task. Gets “dumb”
Large context size will do that and long running sessions. You need to handhold it and steer it back and reset control. Or start a new session

2

u/Life_Assist5275 Nov 02 '26

Literally, there were only 3 chats, and all 6 problems occurred within those 3 chats. I already had clear rules, skills, and even an "engram" [mental framework/pattern] in place, but they literally said, "I didn't follow the rules."

2

u/Murph-Dog Nov 02 '26

This is where the low, medium, high, matter.

Even then, it's all non-deterministic.

Harken back to the 2017 paper which led to the current LLM acceleration: Attention is all you need

The main LLM problem is focusing on what matters versus what does not. As context fills, it loses track of goals.

1

u/Capable_Economist280 Nov 04 '26

Te letteralmente vivi nel mondo delle favole, come puoi pagare 100/200/500 e pensare di dover fare il baby sitter all’attuale macchina più costosa del mondo?

Qualcuno ha fatto veramente molto bene il suo lavoro di marketing, mi sembra quasi che sia più l’IA che rende stupidi gli umani o per lo meno ti renda talmente inerme da non renderti conto di quanto ti stanno realmente fregando.

1

u/RemoraEdge Nov 04 '26

I’m living in a fairytale world?

Because I’m working through the problem instead of crying about it? Meanwhile you are paying for something and using it and feel like you are being screwed. Maybe stop using it then?

Meanwhile I’m loving AI and it’s allowing me to create things I would never otherwise be able to do.

2

u/[deleted] Nov 02 '26

i ran into an issue kinda like this where the Agent deployed fellow Astra Subagents instead of SOL/Luna one time and it used 50% of my weekly budget in like 2 hours. hasnt happened again ever since i enforced SOL/Luna for subagent tasks, but it was pretty brutal

1

u/Life_Assist5275 Nov 02 '26

I worked with that type of workflow; I specifically told him to use 'Luna' and to switch between different efforts depending on the task, but he "chose" a different path.

1

u/Asleep_Stage_451 Nov 02 '26

It doesn’t work like that.

1

u/Asleep_Stage_451 Nov 02 '26

There is a specific way to have a model create subagents of a different model. If you don’t set this up in advance, it’ll spawn agents of same model.

1

u/Shep_Alderson Nov 02 '26

There is no “hard” way to enforce agents.md rules. They should only be considered suggestions. If you need hard enforcement, that requires a non-agent control outside the agent’s session.

Model switching is generally controlled by things like subagent definitions or what you tell it, but is also still not guaranteed.

Your best bet for reducing the scope of a review is to use git shas for a start and end target encapsulating the slice. Anything looser than that cannot be guaranteed, and even that’s not bullet proof. It’s not always the best option either. Sometimes you make changes in say, one PR, but those changes interact with code outside the diff. Reviewing that interaction is good. One side note: you mentioned “dirty workspace”. Do you mean this as in you have a lot of unrelated code changes in a git repo that are just sitting there unstaged? Or do you mean your codebase is a mess and it’s going off trying to solve issues it finds during reviews of connected code?

There is no way to enforce a hard stop within the prompt call/response itself. The agent has no concept of time nor usage while processing and responding to a prompt. The best it could do is perform a tool call after it finishes processing the prompt to check usage, but that would be after the usage is consumed. If you need this strictly, you will need to rely on an external tool, though usage reporting seems to lag by many seconds or even minutes, so that still won’t be perfect. There’s a lot of usage related to thinking that you have no visibility into outside of the usage report from the OpenAI API. Best you can do is have an external program watch the usage report and then maybe have a way to send a hard stop request to the harness, but that’s probably not going to go well for you. You’ll probably end up with a lot of partially completed responses and potentially tool calls going haywire.