mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-09 01:24:49 +08:00
build_runtime_runs_plugin_lifecycle_init_and_shutdown was the only test that set/removed ANTHROPIC_API_KEY without holding the env_lock mutex. Under parallel workspace execution, other tests racing on the same env var could wipe the key mid-construction, causing a flaky credential error. Root cause: process-wide env vars are shared mutable state. All other tests that touch ANTHROPIC_API_KEY already use env_lock(). This test was the only holdout. Fix: add let _guard = env_lock(); at the top of the test.