feat(spawn): [SI-16] enforce CODEX_FLEET_AGENT_NAME + propagate env#184
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fail-fast guard plus explicit env propagation to the spawned codex CLI.
Summary
scripts/codex-fleet/claude-spawn.sh: ifCODEX_FLEET_AGENT_NAMEis unset, exit 2 with the documented FATAL message BEFORE any tmux operations or pane creation.CODEX_FLEET_*family (AGENT_NAME, TIER, SPECIALTY, WORKER_CWD) explicitly throughbuild_pane_cmd's env_str so the values survive codex CLI's env scrubbing and show up underprintenvin the spawned worker.scripts/codex-fleet/test/run-spawn-enforcement.shcovers:Context
During the 2026-05-18 pt2 trading-edge run the supervisor observed worker panes self-identifying as the generic
codexagent becauseCODEX_FLEET_AGENT_NAMEwas 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 toprintenvinside the worker.Test plan
bash scripts/codex-fleet/test/run-spawn-enforcement.sh-> 13 pass, 0 fail.bash -n scripts/codex-fleet/claude-spawn.shclean.bash scripts/codex-fleet/claude-spawn.sh --dry-run -n 1with var unset -> exit 2 + FATAL banner.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