From c14765e701c64d9dc9b2c6b5a8fa4b45c499362d Mon Sep 17 00:00:00 2001 From: Lidang-Jiang Date: Sat, 28 Mar 2026 10:59:19 +0800 Subject: [PATCH] fix(codex): add persistent_instructions to baseline and relax sanity check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The global sanity check (check-codex-global-state.sh) hard-fails when persistent_instructions is missing from ~/.codex/config.toml, but neither the baseline .codex/config.toml nor the sync script ever define this field. This causes a clean install to report a failing sanity check even though the sync otherwise succeeds (#967). - Add persistent_instructions to the baseline .codex/config.toml so that users who cp the config get a working default. - Downgrade the sanity check from fail to warn, since persistent_instructions is additive and optional — users who rely solely on AGENTS.md should not be blocked. Fixes #967 (persistent_instructions part; context7 naming addressed by #970) Co-Authored-By: Claude Opus 4.6 Signed-off-by: Lidang-Jiang --- .codex/config.toml | 5 ++++- scripts/codex/check-codex-global-state.sh | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.codex/config.toml b/.codex/config.toml index e1e1bf52..43f51800 100644 --- a/.codex/config.toml +++ b/.codex/config.toml @@ -27,7 +27,10 @@ notify = [ "-sound", "default", ] -# Prefer AGENTS.md and project-local .codex/AGENTS.md for instructions. +# Persistent instructions are appended to every prompt (additive, unlike +# model_instructions_file which replaces AGENTS.md). +persistent_instructions = "Follow project AGENTS.md guidelines. Use available MCP servers when they can help." + # model_instructions_file replaces built-in instructions instead of AGENTS.md, # so leave it unset unless you intentionally want a single override file. # model_instructions_file = "/absolute/path/to/instructions.md" diff --git a/scripts/codex/check-codex-global-state.sh b/scripts/codex/check-codex-global-state.sh index f0c2242c..c5291c87 100755 --- a/scripts/codex/check-codex-global-state.sh +++ b/scripts/codex/check-codex-global-state.sh @@ -89,7 +89,13 @@ fi if [[ -f "$CONFIG_FILE" ]]; then check_config_pattern '^multi_agent\s*=\s*true' "multi_agent is enabled" check_config_absent '^\s*collab\s*=' "deprecated collab flag is absent" - check_config_pattern '^persistent_instructions\s*=' "persistent_instructions is configured" + # persistent_instructions is recommended but optional; warn instead of fail + # so users who rely on AGENTS.md alone are not blocked (#967). + if rg -n '^persistent_instructions\s*=' "$CONFIG_FILE" >/dev/null 2>&1; then + ok "persistent_instructions is configured" + else + warn "persistent_instructions is not set (recommended but optional)" + fi check_config_pattern '^\[profiles\.strict\]' "profiles.strict exists" check_config_pattern '^\[profiles\.yolo\]' "profiles.yolo exists"