Skip to content

Fix Codex global RTK reference path on macOS#1002

Open
jiemojiemo wants to merge 1 commit intortk-ai:developfrom
jiemojiemo:fix_macos_codex_rtk
Open

Fix Codex global RTK reference path on macOS#1002
jiemojiemo wants to merge 1 commit intortk-ai:developfrom
jiemojiemo:fix_macos_codex_rtk

Conversation

@jiemojiemo
Copy link
Copy Markdown

Description:

Summary

This PR fixes a Codex global init issue on macOS where rtk init -g --codex wrote @RTK.md into ~/.codex/AGENTS.md, but Codex resolved that reference relative to the current project instead of ~/.codex. As a result, Codex could fail to find the global RTK.md when opened in another repository.

What changed

  • Update Codex global init to write the absolute ~/.codex/RTK.md path into ~/.codex/AGENTS.md
  • Keep local Codex init behavior unchanged and continue using the project-local @RTK.md reference
  • Make AGENTS.md patching migrate legacy global @RTK.md references to the new absolute-path format
  • Make Codex uninstall and config detection handle both legacy relative references and the new absolute reference
  • Update Codex documentation to describe the correct global behavior

Tests

Added and updated unit tests covering:

  • adding the RTK reference only once
  • creating a missing AGENTS.md
  • migrating inline RTK blocks
  • migrating a legacy global @RTK.md reference to an absolute path
  • removing the absolute-path reference during Codex uninstall
  • preserving uninstall idempotency

Validated with:

cargo test patch_agents_md -- --nocapture
cargo test uninstall_codex_at -- --nocapture

Why this matters

Codex global instructions should remain valid no matter which project is opened. Writing an absolute path for global Codex setup makes the configuration stable across repositories, while preserving the existing local-project workflow.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 3, 2026

CLA assistant check
All committers have signed the CLA.

@Valmonzo
Copy link
Copy Markdown

Valmonzo commented Apr 3, 2026

Thx mate , wanted to do it this weekend but u are so reactive ❤️

@jiemojiemo jiemojiemo changed the base branch from master to develop April 3, 2026 15:26
@jiemojiemo jiemojiemo force-pushed the fix_macos_codex_rtk branch from df1e594 to 925100c Compare April 3, 2026 22:41
@jiemojiemo jiemojiemo force-pushed the fix_macos_codex_rtk branch from 925100c to 76709a4 Compare April 5, 2026 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants