Before Claude Code runs a shell command, it puts a short setup step in front of it, called a prefix. That prefix now removes any alias or shell function named unsetenv, so the standard command is used instead. An alias or shell function is a user-defined shortcut that replaces a command. A matching step for which is also added, but only when a server-controlled switch is turned on.
Claude Code also now recognises the environment variables bash uses to hand such functions from one shell to the next: BASH_FUNC_which%% and BASH_FUNC_unsetenv%%, plus their () and __BASH_FUNC<...>() forms. The parts of the prefix are now joined into one chain. If you set a wrapper with CLAUDE_CODE_SHELL_PREFIX, it is still applied around the whole chain.
If your shell setup defines its own which or unsetenv, those versions could change how Claude Code's shell setup behaves. Clearing them first means Claude Code works with the standard commands. The which step depends on a switch, so the part that always applies is the unsetenv cleanup.