openai / openai/codex

Codex Desktop loads global AGENTS.md but stale memory overrides its explicit rule

Open
#39,223 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug memory windows-os
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of the Codex App are you using (From “About Codex” dialog)?

Codex Desktop package 26.814.5167.0; session metadata reports bundled CLI 0.148.0-alpha.15.

What subscription do you have?

Not included in this public report.

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What issue are you seeing?

Codex Desktop loaded both the global ~/.codex/AGENTS.md and the repository AGENTS.md into the task context, but the agent ignored a distinctive current global rule and instead followed stale validation-gate guidance recovered from persistent memory.

The global rule explicitly defined this sequence for validation-gate requests:

  1. Ponytail Review
  2. Ponytail cuts
  3. Clean Code Guard
  4. Test Guard

When asked to apply the validation gates, the agent instead invoked an unrelated security workflow based on stale memory. It only discovered and followed the current global rule after the user challenged the behavior.

This initially looked like an AGENTS.md discovery failure. Inspection of the task rollout disproved that: the first user-context item and world state contain both the distinctive global rule and the repository instructions. The problem is instruction precedence/compliance: stale memory was treated as more authoritative than the current, explicitly loaded global AGENTS.md.

What steps can reproduce the bug?
  1. Put a distinctive workflow rule in ~/.codex/AGENTS.md.
  2. Have older persistent memory contain a conflicting workflow for the same request.
  3. Open a Codex Desktop task in a repository that also has a repository AGENTS.md.
  4. Ask Codex to execute the workflow named by the global rule.
  5. Observe that Codex follows the stale memory workflow instead of the currently loaded global rule.
  6. Inspect the task rollout under ~/.codex/sessions: confirm that the global and repository AGENTS.md contents were present at task start.

Observed session ID: 01a01512-ddef-77c3-b0cd-8c5610997742.

The local rollout contains both instruction sources in the initial context; no private transcript or workspace content is attached to this public issue.

What is the expected behavior?

A current, successfully loaded AGENTS.md rule should win over conflicting stale memory for repository work. Persistent memory should provide historical context, not silently override explicit current operating instructions.

If these sources are intentionally assigned different prompt priorities, Codex Desktop should ensure stale memory cannot become an authoritative workflow policy that defeats the current AGENTS.md chain.

Additional information

This is distinct from a pure discovery failure such as #18189: the rollout proves the global file was loaded.

It is related to instruction-enforcement concerns reported in #19369, but this reproduction specifically shows a current global rule losing to stale persistent memory in Codex Desktop.

Official documentation says Codex builds an instruction chain from global and project AGENTS.md files before work begins:
https://developers.openai.com/codex/guides/agents-md

Impact: users can receive false confidence that current repository/global controls are active while older remembered workflows silently drive tool selection and execution.

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 inspecting the rollout for session 01a01512-ddef-77c3-b0cd-8c5610997742 under ~/.codex/sessions, along with the global and repository AGENTS.md files. Compare the loaded current instructions with the stale memory workflow and verify that an explicit current AGENTS.md rule takes precedence; done means the reproduced request follows the current validation-gate sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai-infra-agents, devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.