fix(mma-exec): strip ANTHROPIC_API_KEY from subprocess env to use subscription login

When ANTHROPIC_API_KEY is set in the shell environment, claude --print
routes through the API key instead of subscription auth. Stripping it
forces the CLI to use subscription login for all Tier 3/4 delegation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 14:18:57 -05:00
parent 3f8ae2ec3b
commit 36d464f82f

View File

@@ -197,6 +197,7 @@ def execute_agent(role: str, prompt: str, docs: list[str]) -> str:
try:
env = os.environ.copy()
env['CLAUDE_CLI_HOOK_CONTEXT'] = 'mma_headless'
env.pop('ANTHROPIC_API_KEY', None) # Force CLI to use subscription login, not API key
process = subprocess.run(
cmd,
input=command_text,