Skip to content

feat(spawn): [SI-16] enforce CODEX_FLEET_AGENT_NAME + propagate env#184

Merged
NagyVikt merged 1 commit into
mainfrom
agent/claude-supervisor/si-16-spawn-enforcement
May 18, 2026
Merged

feat(spawn): [SI-16] enforce CODEX_FLEET_AGENT_NAME + propagate env#184
NagyVikt merged 1 commit into
mainfrom
agent/claude-supervisor/si-16-spawn-enforcement

Conversation

@NagyVikt
Copy link
Copy Markdown
Contributor

Fail-fast guard plus explicit env propagation to the spawned codex CLI.

Summary

  • Add fail-fast guard at the top of scripts/codex-fleet/claude-spawn.sh: if CODEX_FLEET_AGENT_NAME is unset, exit 2 with the documented FATAL message BEFORE any tmux operations or pane creation.
  • Propagate the CODEX_FLEET_* family (AGENT_NAME, TIER, SPECIALTY, WORKER_CWD) explicitly through build_pane_cmd's env_str so the values survive codex CLI's env scrubbing and show up under printenv in the spawned worker.
  • New smoke test scripts/codex-fleet/test/run-spawn-enforcement.sh covers:
    • Case 1: unset var -> exit 2 + FATAL banner.
    • Case 2: set var -> dry-run succeeds (exit 0, dry-run banner).
    • Case 2b: rendered env_str contains the CODEX_FLEET_* family.
    • Case 2c: mock-wrapper environ contains the CODEX_FLEET_* family after the rendered env(1) prefix runs.

Context

During the 2026-05-18 pt2 trading-edge run the supervisor observed worker panes self-identifying as the generic codex agent because CODEX_FLEET_AGENT_NAME was missing in the spawn env. Colony's matchmaker then merged multiple panes into one logical agent, causing overlapping claims and confused handoffs. The fail-fast guard makes this misconfiguration impossible to ignore, and the explicit CODEX_FLEET_* propagation closes the gap where the staged values were not visible to printenv inside the worker.

Test plan

  • bash scripts/codex-fleet/test/run-spawn-enforcement.sh -> 13 pass, 0 fail.
  • bash -n scripts/codex-fleet/claude-spawn.sh clean.
  • Manual: bash scripts/codex-fleet/claude-spawn.sh --dry-run -n 1 with var unset -> exit 2 + FATAL banner.
  • Manual: CODEX_FLEET_AGENT_NAME=test-fixture bash scripts/codex-fleet/claude-spawn.sh --dry-run -n 1 -> exit 0, dry-run banner.

Generated with Claude Code

…codex CLI

Fail-fast when CODEX_FLEET_AGENT_NAME is unset, since spawning a pane
that identifies as the generic 'codex' agent causes Colony to see
multiple panes as the same agent (observed 2026-05-18). Also propagate
the CODEX_FLEET_* family through codex CLI's env handling so workers
see the staged values via printenv.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NagyVikt NagyVikt merged commit 68f683c into main May 18, 2026
2 checks passed
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.

1 participant