feat(fleet): [SI-9] CODEX_FLEET_WORKER_CWD override at worker boot#174
Merged
Conversation
Resolve worker cwd by precedence in claude-worker.sh before spawning the Claude CLI: CODEX_FLEET_WORKER_CWD > active-plan-meta writable_roots[0] > $REPO. Forward the env var through claude-spawn.sh, document the precedence in worker-prompt.md, add a yaml example in accounts.example.yml, and ship test/run-worker-cwd.sh covering the four precedence scenarios.
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.
Summary
SI-9 from
openspec/plans/supervisor-improvements-2026-05-18/plan.json.On 2026-05-18 every claude worker spawned in
/home/deadpool/Documents/codex-fleetuibut the active plan's writable_roots pointed at/home/deadpool/Documents/polymarket-cli. Every worker's first action was thereforecd /home/deadpool/Documents/polymarket-cli, wasting a turn (and a chunk of context) before doing useful work.This patch resolves the worker's initial cwd by precedence in
claude-worker.shbefore the Claude CLI starts:CODEX_FLEET_WORKER_CWD(env, e.g. per-account inaccounts.yml)metadata.writable_roots[0]from$REPO/.codex-fleet/active-plan-meta.json$REPO(back-compat)claude-spawn.shforwardsCODEX_FLEET_WORKER_CWDinto the pane env.worker-prompt.mddocuments the precedence.accounts.example.ymlshows aworker_cwd:entry pinning a pane to the polymarket-cli tree. Writingactive-plan-meta.jsonis intentionally out of scope (TODO comment points at SI-3/SI-5/SI-11); the $REPO fallback keeps fleets without it working unchanged.Test plan
bash scripts/codex-fleet/test/run-worker-cwd.sh— 5 scenarios pass (env override; plan-meta; double-fallback; missing env path; missing env + valid plan-meta).bash -nsyntax check on all four touched scripts.bash scripts/codex-fleet/claude-spawn.sh --dry-run -n 1unchanged.Branch:
agent/claude-supervisor/si-9-worker-cwd. Auto-squash-merge requested.