Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions skills/ce-setup/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Also remediate these project issues when the report names them:
- `.compound-engineering/config.example.yaml` is missing or outdated
- the health report marks the `ce-work` skill implementation engine unavailable or invalid, detects retired scalar routing keys, or reports malformed dormant `work_engine_preferences`
- the health report marks `docs_root` invalid (`Invalid docs_root ...`) — CE artifacts will not be written until it is fixed
- the health report names a **legacy Compound Codex tool map** in `$CODEX_HOME/AGENTS.md` (or a profile copy) — session-level; point at `docs/install/upgrading.md`. Do not rewrite `ce-work` skip phrases in this skill.

If optional tools are missing, do not offer a bulk install. The diagnostic already printed the relevant install command or project URL. Say: "Install optional tools only for the workflows you use."

Expand Down
44 changes: 44 additions & 0 deletions skills/ce-setup/scripts/check-health
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,40 @@ read_work_engine_preferences() {
has_brew=$(command -v brew >/dev/null 2>&1 && echo "yes" || echo "no")
in_repo=$(git rev-parse --is-inside-work-tree >/dev/null 2>&1 && echo "yes" || echo "no")

# Retired Bun-era Codex tool map (#1099 / #1559). Exact sentinels from docs/install/upgrading.md.
CODEX_TOOL_MAP_START="<!-- BEGIN COMPOUND CODEX TOOL MAP -->"
CODEX_TOOL_MAP_END="<!-- END COMPOUND CODEX TOOL MAP -->"
codex_home="${CODEX_HOME:-$HOME/.codex}"
default_codex_home="$HOME/.codex"
legacy_codex_map_files=()
scan_codex_agents_file() {
local f="$1"
local existing
[ -f "$f" ] || return 0
for existing in "${legacy_codex_map_files[@]}"; do
[ "$existing" = "$f" ] && return 0
done
if grep -F -q -- "$CODEX_TOOL_MAP_START" "$f" && grep -F -q -- "$CODEX_TOOL_MAP_END" "$f"; then
Comment thread
saurabhkagent-lab marked this conversation as resolved.
Outdated
legacy_codex_map_files+=("$f")
fi
}
scan_codex_profile_tree() {
local root="$1"
local f
[ -d "$root/profiles" ] || return 0
for f in "$root/profiles"/*/AGENTS.md; do
[ -f "$f" ] || continue
scan_codex_agents_file "$f"
done
}
scan_codex_agents_file "$codex_home/AGENTS.md"
scan_codex_profile_tree "$codex_home"
# Named profiles live under ~/.codex even when CODEX_HOME points at an active profile.
if [ "$codex_home" != "$default_codex_home" ]; then
scan_codex_agents_file "$default_codex_home/AGENTS.md"
Comment thread
saurabhkagent-lab marked this conversation as resolved.
Outdated
scan_codex_profile_tree "$default_codex_home"
fi

# =====================================================
# Check optional capabilities
# =====================================================
Expand Down Expand Up @@ -627,4 +661,14 @@ if [ "$capability_missing" -gt 0 ]; then
echo " Missing optional tools do not block setup; install them only for the workflows you use."
fi

if [ "${#legacy_codex_map_files[@]}" -gt 0 ]; then
echo ""
section "Codex instructions"
for f in "${legacy_codex_map_files[@]}"; do
warn "Legacy Compound Codex tool map still present in $f"
done
detail "This retired block can make Codex skip ce-code-review as if no runner exists."
detail "Remove only the BEGIN/END COMPOUND CODEX TOOL MAP span — see docs/install/upgrading.md"
Comment thread
saurabhkagent-lab marked this conversation as resolved.
Outdated
fi

echo ""
73 changes: 72 additions & 1 deletion tests/skills/ce-setup-check-health.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ type RunResult = {
stderr: string
}

async function runCheckHealth(cwd: string, pathValue: string): Promise<RunResult> {
async function runCheckHealth(
cwd: string,
pathValue: string,
extraEnv: Record<string, string> = {},
): Promise<RunResult> {
const proc = Bun.spawn(["bash", checkHealthScript], {
cwd,
env: {
...process.env,
HOME: cwd,
PATH: pathValue,
// Isolate from the host Codex install (CI/dev machines often set CODEX_HOME).
CODEX_HOME: path.join(cwd, ".codex"),
...extraEnv,
},
stderr: "pipe",
stdout: "pipe",
Expand Down Expand Up @@ -57,6 +64,70 @@ describe("ce-setup check-health", () => {
expect(script).not.toMatch(/<<<\s/)
})

test("reports the legacy Codex tool map when both sentinels are present", async () => {
const root = await mkdtemp(path.join(os.tmpdir(), "ce-setup-health-"))
try {
await initGitRepo(root)
await mkdir(path.join(root, ".codex"), { recursive: true })
await writeFile(
path.join(root, ".codex", "AGENTS.md"),
[
"keep this",
"<!-- BEGIN COMPOUND CODEX TOOL MAP -->",
"Task (subagent dispatch) / Subagent / Parallel: run sequentially in main thread",
"<!-- END COMPOUND CODEX TOOL MAP -->",
"",
].join("\n"),
)
const result = await runCheckHealth(root, "/usr/bin:/bin")
Comment thread
saurabhkagent-lab marked this conversation as resolved.
expect(result.exitCode).toBe(0)
expect(result.stdout).toContain("Legacy Compound Codex tool map still present")
expect(result.stdout).toContain("docs/install/upgrading.md")
} finally {
await rm(root, { recursive: true, force: true })
}
})

test("does not warn when Codex AGENTS.md has no tool-map sentinels", async () => {
const root = await mkdtemp(path.join(os.tmpdir(), "ce-setup-health-"))
try {
await initGitRepo(root)
await mkdir(path.join(root, ".codex"), { recursive: true })
await writeFile(path.join(root, ".codex", "AGENTS.md"), "# user instructions\n")
const result = await runCheckHealth(root, "/usr/bin:/bin")
expect(result.exitCode).toBe(0)
expect(result.stdout).not.toContain("Legacy Compound Codex tool map still present")
} finally {
await rm(root, { recursive: true, force: true })
}
})

test("still finds named-profile copies under ~/.codex when CODEX_HOME is elsewhere", async () => {
const root = await mkdtemp(path.join(os.tmpdir(), "ce-setup-health-"))
try {
await initGitRepo(root)
const customHome = path.join(root, "custom-codex")
await mkdir(customHome, { recursive: true })
await writeFile(path.join(customHome, "AGENTS.md"), "# active profile, no map\n")
await mkdir(path.join(root, ".codex", "profiles", "work"), { recursive: true })
await writeFile(
path.join(root, ".codex", "profiles", "work", "AGENTS.md"),
[
"<!-- BEGIN COMPOUND CODEX TOOL MAP -->",
"Task (subagent dispatch) / Subagent / Parallel: run sequentially in main thread",
"<!-- END COMPOUND CODEX TOOL MAP -->",
"",
].join("\n"),
)
const result = await runCheckHealth(root, "/usr/bin:/bin", { CODEX_HOME: customHome })
expect(result.exitCode).toBe(0)
expect(result.stdout).toContain("Legacy Compound Codex tool map still present")
expect(result.stdout).toContain("docs/install/upgrading.md")
} finally {
await rm(root, { recursive: true, force: true })
}
})

test("advertises agent-browser only for its current consumers", async () => {
const [script, setupDocs, polishSkill, polishRun, polishDocs] = await Promise.all([
readFile(checkHealthScript, "utf8"),
Expand Down