codex - 💡(How to fix) Fix VS Code extension does not reliably enforce delegated global AGENTS.md directives [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19369Fetched 2026-04-25 06:10:36
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2closed ×1unlabeled ×1

Root Cause

Global AGENTS.md files are safety and operating directives. If the VS Code extension/session runtime surfaces a global AGENTS.md but does not ensure delegated rules are followed, users can get false confidence that global safety controls are being honored.

This is especially concerning for directives like:

  • do not modify specific directories/workspaces
  • back up files before editing
  • do not perform destructive/system actions without permission
  • load workspace-local safety instructions before doing anything else

Code Example

Before doing anything else, read `/path/to/workspace/AGENTS.md` and follow it.

---

Before doing anything else, read `/some/workspace/AGENTS.md` and follow it.
RAW_BUFFERClick to expand / collapse

What happened

A global AGENTS.md contained a top-level safety directive equivalent to:

Before doing anything else, read `/path/to/workspace/AGENTS.md` and follow it.

In a Codex VS Code session, after being asked to read the global agents file, Codex read and summarized the global file but did not clearly verify/enforce the delegated workspace AGENTS.md startup chain before responding. The delegated workspace instructions included additional startup files and live reminder checks.

Some referenced instructions had been read earlier in the session, but the behavior was still unsafe/ambiguous: the global directive was treated like content to summarize rather than an active directive whose compliance should be verified before continuing.

Why this matters

Global AGENTS.md files are safety and operating directives. If the VS Code extension/session runtime surfaces a global AGENTS.md but does not ensure delegated rules are followed, users can get false confidence that global safety controls are being honored.

This is especially concerning for directives like:

  • do not modify specific directories/workspaces
  • back up files before editing
  • do not perform destructive/system actions without permission
  • load workspace-local safety instructions before doing anything else

Expected behavior

When a global AGENTS.md delegates to another AGENTS.md and says to follow it, Codex should either:

  • automatically load and apply the referenced instructions, including required startup chains, before doing other work; or
  • explicitly block/report that it cannot follow the delegated directive.

Actual behavior

Codex read and reported the global AGENTS.md contents, but did not clearly enforce or verify the delegated startup chain before responding.

Minimal repro

  1. Create a global AGENTS.md with a directive like:
Before doing anything else, read `/some/workspace/AGENTS.md` and follow it.
  1. Put additional required startup/safety steps in /some/workspace/AGENTS.md.
  2. Start a Codex VS Code session and ask it to read the global agents file.
  3. Observe whether it summarizes the global file instead of recursively enforcing the delegated AGENTS.md chain before replying.

Notes

This report intentionally omits private workspace paths and project details. The issue is about directive handling and safety semantics, not the specific project content.

extent analysis

TL;DR

To fix the issue, Codex should be modified to either automatically load and apply delegated AGENTS.md instructions or explicitly block/report that it cannot follow the directive.

Guidance

  • Review the Codex code to identify where the global AGENTS.md file is being read and summarized, and modify it to also verify and enforce delegated directives.
  • Consider adding a recursive function to handle nested AGENTS.md files and ensure all safety instructions are followed before proceeding.
  • Update the Codex session runtime to prioritize safety directives over content summarization, ensuring that users are not given false confidence about global safety controls.
  • Test the modified Codex with the minimal repro steps provided to verify that it correctly enforces delegated AGENTS.md chains.

Example

// Pseudocode example of recursive function to handle nested AGENTS.md files
function followAgentsMdDirective(file_path) {
  const file_content = readFile(file_path);
  const directives = parseDirectives(file_content);
  for (const directive of directives) {
    if (directive.type === 'delegate') {
      followAgentsMdDirective(directive.path);
    } else {
      // Apply the directive
    }
  }
}

Notes

The solution requires modifying the Codex code to handle delegated AGENTS.md files correctly, which may involve significant changes to the existing implementation.

Recommendation

Apply a workaround to modify the Codex code to correctly handle delegated AGENTS.md files, as there is no clear indication of a fixed version available. This will ensure that safety directives are properly enforced and users are not given false confidence about global safety controls.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When a global AGENTS.md delegates to another AGENTS.md and says to follow it, Codex should either:

  • automatically load and apply the referenced instructions, including required startup chains, before doing other work; or
  • explicitly block/report that it cannot follow the delegated directive.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix VS Code extension does not reliably enforce delegated global AGENTS.md directives [2 comments, 3 participants]