Skip to content

feat(fleet): [SI-9] CODEX_FLEET_WORKER_CWD override at worker boot#174

Merged
NagyVikt merged 1 commit into
mainfrom
agent/claude-supervisor/si-9-worker-cwd
May 18, 2026
Merged

feat(fleet): [SI-9] CODEX_FLEET_WORKER_CWD override at worker boot#174
NagyVikt merged 1 commit into
mainfrom
agent/claude-supervisor/si-9-worker-cwd

Conversation

@NagyVikt

Copy link
Copy Markdown
Contributor

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-fleetui but the active plan's writable_roots pointed at /home/deadpool/Documents/polymarket-cli. Every worker's first action was therefore cd /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.sh before the Claude CLI starts:

  1. CODEX_FLEET_WORKER_CWD (env, e.g. per-account in accounts.yml)
  2. priority plan's metadata.writable_roots[0] from $REPO/.codex-fleet/active-plan-meta.json
  3. fallback: $REPO (back-compat)

claude-spawn.sh forwards CODEX_FLEET_WORKER_CWD into the pane env. worker-prompt.md documents the precedence. accounts.example.yml shows a worker_cwd: entry pinning a pane to the polymarket-cli tree. Writing active-plan-meta.json is 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 -n syntax check on all four touched scripts.
  • bash scripts/codex-fleet/claude-spawn.sh --dry-run -n 1 unchanged.
  • CI: cargo fmt / clippy / test (no Rust changes, expected pass).

Branch: agent/claude-supervisor/si-9-worker-cwd. Auto-squash-merge requested.

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.
@NagyVikt NagyVikt merged commit eab0d75 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