Skip to content

tower: afx architect spawns claude without sanitizing inherited CLAUDE_CODE_* env #1627

Open

Description

@waleedkadous

Split out from the #1219 CMAP review (PR #1626) so it is tracked rather than left in a PR body.

agent-farm/commands/architect.ts:37 spawns claude with { ...process.env, ...env }. It has never stripped CLAUDECODE either, so this is pre-existing rather than a regression from #1626 — and it is outside Tower, which is why #1626 deliberately left it alone.

The consequence is the same as #1219's: running afx architect from inside a Claude Code session gives the new architect a nested-session marker, so its transcript saving is off and the session cannot be resumed.

The machinery already exists — sanitizeAgentEnv() in packages/codev/src/lib/agent-env.ts. This is a one-line change plus an entry in the SPAWN_SITES table in bugfix-1219-claude-env-leak.test.ts, which pins per-file sanitizer call counts.

Worth checking the same way while in there: codev init / adopt's execAsync calls also inherit raw process.env, though those are not agent-spawning paths.

Activity

  1. added
    area/tower
    on Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions