Skip to content

fix(ce-setup): detect the retired Codex tool map - #1577

Merged
tmchow merged 2 commits into
mainfrom
fix/ce-setup-codex-tool-map-detection
Aug 29, 2026
Merged

fix(ce-setup): detect the retired Codex tool map#1577
tmchow merged 2 commits into
mainfrom
fix/ce-setup-codex-tool-map-detection

Conversation

@tmchow

@tmchow tmchow commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Replaces #1570 (closed). Addresses the detection half of #1559; see "What this does not fix" below.

Summary

check-health never looked at the Codex home instructions file, so an install still carrying the retired <!-- BEGIN COMPOUND CODEX TOOL MAP --> block reported a clean environment. The Bun-era installer wrote that block; ca474429b strips it only when someone re-runs the Bun CLI, so anyone who moved to the native marketplace install keeps it indefinitely with nothing surfacing it.

The check now scans ${CODEX_HOME:-$HOME/.codex}/AGENTS.md, reports the block alongside the other diagnostics, and adds a line to the verdict so the report does not read as all-clear while it stands. ce-setup offers the removal from a skill-local reference.

Design decisions

Detection is one condition, not a set of cases. The block is present when a standalone BEGIN sentinel line is followed by a standalone END sentinel line. That single condition decides every case #1570 accumulated over its review rounds — inline mentions of both markers in prose, a stray END before the first BEGIN, END/BEGIN/END — in six lines of awk rather than ~50 lines of branching. Verified against all of them plus CRLF line endings and a missing file.

No change to src/utils/codex-agents.ts. #1570 also tightened removeCodexAgentsToolMapBlock to match. The Bun writer (buildCodexAgentsBlock) always emitted sentinels on their own lines, so no file that stripper will ever see is affected. Leaving shipped CLI behavior alone.

The remediation is session-level, so it sits outside the Phase 2 gate. Phase 2 is skipped when there is no writable checkout — which is the reported scenario. The offer is stated where that decision is made rather than in the repo-local project-issues list.

Dropped ~/.codex/profiles/*/AGENTS.md. Codex resolves user instructions from $CODEX_HOME/AGENTS.md (falling back to $HOME/.codex); profiles are [profiles.<name>] tables in config.toml selected with codex -p, not directories with their own AGENTS.md. That path entered the docs as a hedge in #1118. Removed from the upgrade guide too.

Validation

  • bun run test — 3647 pass, 0 fail
  • bun run release:validate — in sync
  • Script behavior verified directly against six fixtures: valid block, inline prose mention, reversed pair, stray END then a valid pair, no sentinels, no file, and CRLF. Runs under bash 3.2 (macOS default).

Skill eval

bun run test:skill-eval-cell -- --skill ce-setup --read-only, Claude and Codex, prompted with real check-health output. Two scenarios; the pre arm ran against #1570's tree.

Scenario Arm Claude Codex
Report names the tool map, no writable checkout pre (#1570) offered removal offered removal
Report names the tool map, no writable checkout post offered removal offered removal
Report names the tool map, writable checkout post offered removal and Phase 2 fixes offered removal and Phase 2 fixes

Both arms offered the removal on both hosts, so the placement change is a correctness-of-representation fix, not a demonstrated routing fix — recording that plainly rather than claiming a behavior win. The writable-checkout row is there because moving the bullet out of the Phase 2 list could have dropped one side or the other; neither host dropped either.

What the eval did discriminate is what reaches the user. The pre arm relayed the accumulated edge-case rules into the user-facing instructions ("a stray END before the first BEGIN doesn't count", "inline mentions of those strings are not a block") and — on both hosts — told the user to also check ~/.codex/profiles/*/AGENTS.md, a directory that does not exist. The post arm gave one condition and one path.

What this does not fix

This does not close #1559. The failure that issue reports is ce-work emitting Code review: skipped (ce-code-review unavailable) with the reason "no callable ce-code-review runner in the current harness" — which is not one of the states that gate enumerates (skills/ce-work/references/shipping-workflow.md:41: dispatch unavailable, unauthenticated, hard-capped, or a failed/degraded/skipped return). Detection does not touch that. Leaving #1559 open for it.

Credit

The gap, and the CODEX_HOME fixture isolation kept here, are from @saurabhkagent-lab's work in #1570.


Compound Engineering

Security Disclosure

The health check reads one additional file, ${CODEX_HOME:-$HOME/.codex}/AGENTS.md, and only when it exists. It is read-only — awk matches two exact literal lines and the script never writes to it. The path comes from an environment variable already trusted by the surrounding script and is quoted at every use. Removal remains a user-approved action performed by the agent, not by this script. No other security-relevant changes.

Agent Disclosure

  • Model: Claude Code · claude-opus-5[1m]

check-health never read the Codex home instructions file, so an install
still carrying the retired COMPOUND CODEX TOOL MAP block reported a clean
environment. The Bun-era installer wrote that block and the Bun CLI only
strips it on a re-run, so native marketplace installs keep it indefinitely.

Scan ${CODEX_HOME:-$HOME/.codex}/AGENTS.md for the block, report it with
the other diagnostics, and note it in the verdict so the report does not
read as all-clear. ce-setup offers the removal from a skill-local
reference, stated outside the Phase 2 gate because the file is in the
user's Codex home rather than the checkout.

Detection is one condition -- a standalone BEGIN sentinel line followed by
a standalone END sentinel line -- which decides inline prose mentions,
reversed sentinels, and a stray END before a valid pair without
enumerating them.

Replaces #1570. Refs #1559.

Claude-Session: https://claude.ai/code/session_01KDDrb1CmAhvfRNb49kE3UQ
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-29T08:48:05.382035Z 6fd89c2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fd89c251a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread skills/ce-setup/SKILL.md
Comment thread skills/ce-setup/SKILL.md
…ummary

The session-level tool-map remediation was wired into the bundled script's
report and the Phase 2 decision, but not into the two other layers it
travels through.

The Step 2 inline fallback checklist had no Codex-home scan, so on the
script-unavailable path the report could never name the map and the Step 3
gate never fired. Mirror the script's condition as a seventh inline check.

The Phase 3 summary slots were scoped to repo-local work, so a Codex-home
removal had nowhere to land and the run could report "Fixed: none" after
editing the user's AGENTS.md. Drop the repo-local qualifier so the slots
state what changed and what was declined, rather than which scope it came
from.

Addresses review feedback on #1577.

Claude-Session: https://claude.ai/code/session_01KDDrb1CmAhvfRNb49kE3UQ
@tmchow
tmchow merged commit a1f601f into main Aug 29, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 29, 2026
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.

ce-setup misses legacy Codex tool map that can cause false ce-code-review unavailable skips

1 participant